for loop with multiple inputs
显示 更早的评论
So I know I've done this a million times but it's been a few years since I've used MATLAB and I forget exactly how to go about this. I want to graph two equations as a variable changes, but it doesn't seem to be working. Here's the full problem:
"Graph amplification and phase angle for 0 <= r <= 2.5."
Here's my code:
for r = 0:0.1:2.5
X = (f_0/omega_n^2)/(sqrt((1-r^2)^2+(2*zeta*r)^2)); %Amplification Equation
phi = atan2((2*zeta*r),(1-r^2)); %Phase angle equation
end
However this is giving me a single value for both phase angle and amplification. (All the variables are correctly defined) How do I get it to spit out a matrix with every value for amplification and phase angle between 0 and 2.5? Do I need an if statement?
Thanks in advance.
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Mathematics 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!