Question
Not getting plots written in for loop, but getting values in command window
Expert Answer
John Williams
PhD Expert
Answered Aug 14, 2026
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
100% Run Guarantee
3-Hour Fast-Track Delivery
Need a Custom Version or Complete Simulation for This Problem?
Our 500+ PhD engineers build, debug, and optimize working MATLAB scripts and Simulink (.slx) models tailored to your exact assignment rubrics with zero plagiarism.
Tested on MATLAB R2024b / R2026a
Turnitin 0% Plagiarism Report
Free 7-Day Revisions Guarantee
Have a different question? Ask here
Related matlab Questions & Solutions
Browse All →
Explore similar technical troubleshooting questions and verified MATLAB solutions:
Ready-to-Run MATLAB & Simulink Projects
Browse All Projects →