How do I save my answers with 2 for loops.
1 view (last 30 days)
Show older comments
So I have a transfer function x= 1/(w+4m). m goes from 1 to 5 and w goes from 1 to 3. The first for loop is m and w is the loop inside. So basically I need to save my answer as the following array
x =[m1w1 m1w2 m1w3 m2w1 m2w2 m2w3 m3w1 m3w2 m3w3 m4......till m5w3]
the answer would be
x =[1/5 1/6 1/7 1/9 1/10 1/11.........1/23]
right now I have
y = zeros(1,15);
for m = 1:5
for w= 1:3
x = 1/((w+m*4));
y(m) = x;
end
end
I know it's wrong.. how do i fix it? Thank you.
0 Comments
Accepted Answer
More Answers (1)
See Also
Categories
Find more on Matrix Indexing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!