What's wrong in the code? I cant generate the same graph as the question required.

2 次查看(过去 30 天)
function y = f(x)
x = -5:5;
y = sin(x.^2).*exp(cos(x));
plot(x,y)
end

采纳的回答

Chunru
Chunru 2021-11-17
x = -5:0.1:5;
y = sin(x.^2).*exp(cos(x));
plot(x,y)

更多回答(1 个)

Yusuf Suer Erdem
Yusuf Suer Erdem 2021-11-17
x = linspace(-5,5);
k = sin(x.^2);
l= exp(cos(x));
y = k.*l;
plot(x,y)
USE THIS WAY, IT HELPS. I THINK YOU WERE JUST MISSING 'LINSPACE' COMMAND. GOOD LUCK!

类别

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

Community Treasure Hunt

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

Start Hunting!

Translated by