hi i write this matlap code but when i plot it i get an empty graph
3 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
shaker mahmood
il 16 Gen 2018
Risposto: shaker mahmood
il 16 Gen 2018
vt=-7; w=0.47; L=0.025; m=1.22; c0=34.515e-9;k=(w*m*c0/(2*L));
for vg=0:10:40
Id=k*(vg-vt).^2
plot(vg,Id,'r');
hold on;
end
0 Commenti
Risposta accettata
Walter Roberson
il 16 Gen 2018
Change the 'r' to 'r*'
2 Commenti
Walter Roberson
il 16 Gen 2018
You only ask it to plot one point at a time. MATLAB has no way of knowing that you want the points to be connected. If you want points to be connected in a plot then you need to give plot at least two points, the place to draw from and the place to draw to.
All of which is leading to the fact that you should not be plotting inside the loop. Instead you should be calculating the coordinates and storing them in a vector, and then you can plot the vector after the loop.
Più risposte (1)
Vedere anche
Categorie
Scopri di più su 2-D and 3-D Plots in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!