how to remove Error using contour (line 48) Z must be at least a 2x2 matrix to plot contour lines

1 次查看(过去 30 天)
I need to plot contour lines but I have got the error Error using contour (line 48) Z must be at least a 2x2 matrix.So what is the problem and how can i solve it.The code is given below.
dt=1e-6;
v1=11:0.2:16;
v2=250:10:450;
[V1,V2] = meshgrid(v1,v2);
L=18.7e-6;
IP=(sum(V1-n.*V2.^2).*dt)/L ;
contour(V1,V2,rms(Ip))

回答(1 个)

Cris LaPierre
Cris LaPierre 2019-4-3
The error is that the third input to countour (Z) must be a matrix. This doc link describes what the inputs to contour must be.
To at least get something plotted, try this.
n=.4;
dt=1e-6;
v1=11:0.2:16;
v2=250:10:450;
[V1,V2] = meshgrid(v1,v2);
L=18.7e-6;
IP=((V1-n.*V2.^2).*dt)/L ;
contour(V1,V2,IP)
I made IP a matrix by removing the sum and rms commands.

类别

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