How do I save my answers with 2 for loops.
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
更多回答(1 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Loops and Conditional Statements 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!