How can I add linspace in a For Loop

Illustration
Edson - 2023-04-17T09:32:59+00:00
Question: How can I add linspace in a For Loop

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 answered . 2025-11-20

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

 


Not satisfied with the answer ?? ASK NOW

Get a Free Consultation or a Sample Assignment Review!