Function returning one value
显示 更早的评论
clear
clc
close all
x = linspace(-8, 8, 19);
y = (x.*((x.^2)-1)/((x.^2)+1).^2);
figure
plot(x, y)

回答(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 个评论
salar rohani nejad
2020-12-5
Ameer Hamza
2020-12-5
编辑:Ameer Hamza
2020-12-5
I am glad to be of help!!!
类别
在 帮助中心 和 File Exchange 中查找有关 Mathematics 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!