How do I plot individual points on an existing graph
24 次查看(过去 30 天)
显示 更早的评论
%Define Values
d = [ 0.25, 0.5 , 1 , 1.5 , 2 ];
m = 1;
k = 1;
omeganought = 1;
omega = linspace (0, 2);
%Creating a graph for all damping values
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
%Plotting points (omega_d, M(omega_d))
%plot graph
plot (omega, FA)
%Labels
xlabel ('Frequency');
ylabel ('Frequency response');
Title ('Frequency response curve')
So, My question is asking me to plot the points (omega_d, M(omega_d)). These points represent the maximum gain for each damping factor 'd'. I think it just wants me to put points on the Max of each curve and I'm not sure how to do so. Any help is appreciated.
0 个评论
采纳的回答
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.
2 个评论
Star Strider
2017-11-13
You can plot a vertical line at omega=1 with:
%plot graph
figure(1)
plot (omega, FA)
hold on
plot([Omga{:}], [Peak{:}], '^r', 'MarkerFaceColor','r')
plot([1 1], ylim, '--')
hold off
Plotting a vertical line there is a mystery to me, too, especially since the peak of the first curve is at 0.990, not 1. (It’s the second plot call in the hold block.)
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Annotations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!