Function returning one value

1 次查看(过去 30 天)
salar rohani nejad
salar rohani nejad 2020-12-5
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
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

类别

Help CenterFile Exchange 中查找有关 Matrix Indexing 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by