Not sure what I'm doing wrong.
1 回表示 (過去 30 日間)
古いコメントを表示
%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 件のコメント
Jan
2017 年 11 月 13 日
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?
採用された回答
Star Strider
2017 年 11 月 13 日
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 件のコメント
Star Strider
2017 年 11 月 13 日
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.
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!