Getting values for equation written in for loop but not getting plots

Illustration
Brooklynn - 2020-12-08T10:54:04+00:00
Question: Getting values for equation written in for loop but not getting plots

Not getting plots written in for loop, but getting values in command window

Expert Answer

Profile picture of John Williams John Williams answered . 2025-11-20

rol = 5:10;
plot(rol,V2fl);
you dont need for loop when you are using element wise multiplication .*
delete the loop and plot again or
Otherwise you can use index of for loop without .* in eqn
 
V2fl(rol) = ((2*3.14)...);
figure(1)
hold on
plot(rol,V2fl)


Another way

Replace your plot(r,z_1) with this:
 
plot(r,z_1,'.'); hold on
If you don't turn the "hold" to "on" then the figure is overwritten with each iteration.
You can also achieve this by adding these commands before the loop:
 
figure; hold on


Not satisfied with the answer ?? ASK NOW

Get a Free Consultation or a Sample Assignment Review!