how could i plot a contour

1 次查看(过去 30 天)
Hi
i want to plot the following contour but i always encounter an error
x=-pi:0.001*pi:pi;
y=0:0.1*6:6;
[x,y]=meshgrid(x,y);
z=(100*sqrt(2*pi)/sqrt(2*pi.*(y-2.))).*cos(x/2).*(1.-sin(x/2.).*sin(3.*x/2.));
contour(x,y,z)
  1 个评论
Abolfazl Chaman Motlagh
become imaginary for . so one of conceptional error are there. the z become complex. the other one is in Arif solution. should use dot before / .

请先登录,再进行评论。

采纳的回答

Arif Hoq
Arif Hoq 2022-2-28
编辑:Arif Hoq 2022-2-28
you shoud demontrate element wise multiplication/division in the variable z. most porbably this contour is allowed to plot real value.
x=-pi:0.001*pi:pi;
y=0:0.1*6:6;
[x,y]=meshgrid(x,y);
z=(100*sqrt(2*pi)./sqrt(2*pi.*(y-2))).*cos(x./2).*(1-sin(x./2).*sin(3*x./2));
% contour(x,y,z)
contour(real(z))

更多回答(0 个)

类别

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

Community Treasure Hunt

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

Start Hunting!

Translated by