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

1 vue (au cours des 30 derniers jours)
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))

Réponses (1)

Cris LaPierre
Cris LaPierre le 3 Avr 2019
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.

Catégories

En savoir plus sur Contour Plots dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by