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!