Clear Filters
Clear Filters

how can i plot contour

1 view (last 30 days)
i encounter an error while trying to plot the following contour
x=0:0.1:4;
x1=-pi:0.001*pi:pi;
y1=(100*sqrt(2*pi)./sqrt(x.*2*pi)).*cos(x1/2).*(1.-sin(x1/2.).*sin(3.*x1/2.));
y2=(100*sqrt(2*pi)./sqrt(x.*2*pi)).*cos(x1/2).*(1.+sin(x1/2.).*sin(3.*x1/2.));
y3=(100*sqrt(2*pi)./sqrt(x.*2*pi)).*cos(x1/2).*sin(x1/2.).*sin(3.*x1/2.);
y4=(1/2).*((y1-y2)^2+y1^2+y2^2+6.*y3^2);
z=abs(sqrt(y4));
[x,x1]=meshgrid(x,x1);
% contour(x,x1,z)
contour(real(z))

Accepted Answer

Walter Roberson
Walter Roberson on 1 Mar 2022
x = (0:0.1:4).';
x1=-pi:0.001*pi:pi;
y1=(100*sqrt(2*pi)./sqrt(x.*2*pi)).*cos(x1/2).*(1.-sin(x1/2.).*sin(3.*x1/2.));
y2=(100*sqrt(2*pi)./sqrt(x.*2*pi)).*cos(x1/2).*(1.+sin(x1/2.).*sin(3.*x1/2.));
y3=(100*sqrt(2*pi)./sqrt(x.*2*pi)).*cos(x1/2).*sin(x1/2.).*sin(3.*x1/2.);
y4 = (1/2).*((y1-y2).^2+y1.^2+y2.^2+6.*y3);
z = sqrt(y4);
[x,y]=meshgrid(x1,x);
% contour(x,x1,z)
contour(x, y, real(z))
  5 Comments
khaled Abdelghafar
khaled Abdelghafar on 1 Mar 2022
i would changed to r and theta
the question how i plot the contour in x,y not r and thata
how could i do it

Sign in to comment.

More Answers (0)

Categories

Find more on Contour Plots in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!