How can I add linspace in a For Loop

E
Edson · Apr 17, 2023 · 2.3K views
Question
Hello good day,I wish to have a 'for' or 'while' loop which keeps increasing the value of 'x' as the value of 'phi' keeps increasing from 0 - 77.3049 with 100 numbers. I attempted a few times but kept getting errors. Any idea how this can be implemented?
Expert Answer
Profile picture of Prashant Kumar
Prashant Kumar PhD Expert
Answered Aug 30, 2026
There is not enough information (such as a description of what you want to do).
 
However one possibility is something like this —
phi = linspace(0, 77.3049, 100);
for k = 1:numel(phi)
    x(k) = some_calculation_using(phi(k)); 
end

 

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

Get a Free Consultation or a Sample Assignment Review!