Why should we write x(i,1)=cos(theta(1,i) in this format while using the for loop?

2 views (last 30 days)
S Priya
S Priya on 17 Aug 2021
Commented: S Priya on 17 Aug 2021
I have a doubt regarding this way of represention.
for i=1:n+1
Why cant we represent it as-

Accepted Answer

KSSV on 17 Aug 2021
Edited: KSSV on 17 Aug 2021
x = zeros(n+1,1) ;
for i=1:n+1
You can very much write like you shown. But keep in mind that the variables should be vectors.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by