for loop with multiple inputs
Show older comments
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.
Accepted Answer
More Answers (0)
Categories
Find more on Mathematics 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!