How do I plot individual points on an existing graph
24 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Matthew Orsie
le 13 Nov 2017
Commenté : Star Strider
le 13 Nov 2017
%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 commentaires
Réponse acceptée
Star Strider
le 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.
2 commentaires
Star Strider
le 13 Nov 2017
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.)
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Annotations dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!