Not sure what I'm doing wrong.
1 view (last 30 days)
Show older comments
Matthew Orsie
on 13 Nov 2017
Commented: Star Strider
on 13 Nov 2017
%Define Values
d = [ 0.25, 0.5 , 1 , 1.5 , 2 ];
m = 1;
k = 1;
omeganought = 1;
omega = linspace (0, 2);
%graph
FA = 1 / sqrt ( power(m,2)*power((power(omeganought,2)-power(omega,2)),2) + power(d,2)*power(omega,2));
%plot graph
plot (FA)
For my question, I need to plot a graph with all of those damping values ( d = o.25, 0.5, 1, 1.5 2), plugged into that function.
My question also says that I need to fit it in a window [0 , 2] by [0 , 4] and I'm not sure how to do that either. I could use some serious help for I haven't a clue about what I'm doing.
2 Comments
Jan
on 13 Nov 2017
Start with using the "{} Code" button to format your code. Currently it is not readable and the question is not clear. What is the problem with the shown code?
Accepted Answer
Star Strider
on 13 Nov 2017
I would use a loop through the values of ‘d’, then plot:
%Define Values
d = [ 0.25, 0.5 , 1 , 1.5 , 2 ];
m = 1;
k = 1;
omeganought = 1;
omega = linspace (0, 2);
%graph
for k1 = 1:length(d)
FA(k1,:) = 1 ./ sqrt ( power(m,2)*power((power(omeganought,2)-power(omega,2)),2) + power(d(k1),2)*power(omega,2));
end
%plot graph
plot (omega, FA)
2 Comments
Star Strider
on 13 Nov 2017
Only three have definable peaks.
That said, this works:
%Define Values
d = [ 0.25, 0.5 , 1 , 1.5 , 2 ];
m = 1;
k = 1;
omeganought = 1;
omega = linspace (0, 2);
%graph
for k1 = 1:length(d)
FA(k1,:) = 1 ./ sqrt ( power(m,2)*power((power(omeganought,2)-power(omega,2)),2) + power(d(k1),2)*power(omega,2));
[Peak{k1},Omga{k1}] = findpeaks(FA(k1,:), omega);
end
%plot graph
figure(1)
plot (omega, FA)
hold on
plot([Omga{:}], [Peak{:}], '^r', 'MarkerFaceColor','r')
hold off
I am not certain how you want to handle the last two.
More Answers (0)
See Also
Categories
Find more on 2-D and 3-D Plots 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!