Function returning one value
19 ビュー (過去 30 日間)
古いコメントを表示
clear
clc
close all
x = linspace(-8, 8, 19);
y = (x.*((x.^2)-1)/((x.^2)+1).^2);
figure
plot(x, y)

0 件のコメント
回答 (1 件)
Ameer Hamza
2020 年 12 月 5 日
編集済み: Ameer Hamza
2020 年 12 月 5 日
You need to use element-wise division
y = (x.*((x.^2)-1)./((x.^2)+1).^2);
%^ put a dot here
Read about element-wise operators here: https://www.mathworks.com/help/matlab/matlab_prog/array-vs-matrix-operations.html
2 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!