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