Coordinates of an area graph
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I've got 9 equations (correspond Y-axe) and 9 sections (correspond X-axe) from which I plot an Area Graph.
Equations:
M1 = -F_E_1*sind(alpha_E_1+gama_1)*(x1) + F_E_2*sind(alpha_E_2+gama_1)*(x1);
M2 = M1i_max + T1i_max*(x2) + F_D*sind(alpha_D+gama_1)*(x2);
M3 = M2i_max + T2i_max*(x3) - F_C_1*sind(alpha_C_1-gama_1)*(x3);
M4 = M3i_max + N3i_max*R_1*(1-cosd(phi_4)) + T3i_max*R_1*sind(phi_4);
etc
x-axe sections:
x1p = 0 : l1/50 : l1;
x2p = l1 : l2/50 : l1+l2;
x3p = l1+l2 : l3/50 : l1+l2+l3;
x4p = l1+l2+l3 : ra4/50 : l1+l2+l3+ra4;
etc
Ten I plot the Area graph:
subplot(3,1,3); % Moments
title('Momentové složky [Nmm]')
hold on
area(x1pr,M1r);
area(x2pr,M2r);
area(x3pr,M3r);
area(x4pr,M4r);
area(x5pr,M5r);
area(x6pr,M6r);
area(x7pr,M7r);
area(x8pr,M8r);
area(x9pr,M9r);
set(gca,'XTick', 0:50:1200);
grid on
colorbar
And the final result is here:
Now I need to find coordinates of the point, where is maximum.
I found maximum by:
maximumM=max([M1 M2 M3 M4 M5 M6 M7 M8 M9 ]); %max M
So I have the y-axe value (which is › Max: 141499.264 [Nmm])
But I don't know how to find the location of this maximum. The problem is (maybe) because the plot curve is not from 1 equation, but from 9 of them. I don't know if this is problem.
Can anybody help please? I tried to find the solution here and in google but to no avail.
0 Kommentare
Akzeptierte Antwort
Mahdi
am 1 Apr. 2013
My solution would be to use the find() function. Since you have the max, you can search the data for where that value exists and then use that value to determine where it is on the x-axis:
Index1=find(y==141499.264) % Finds where in y-data the point is found
x(Index1) % Gives you the same spot with the x-value outputted.
This assumes that the x and y are in one matrix for all of the values. Otherwise, you can look through each matrix if that y-value exists.
3 Kommentare
Mahdi
am 2 Apr. 2013
Bearbeitet: Mahdi
am 2 Apr. 2013
Use the first way that you suggested. I just put a number inside for illustration purposes.
Did you put all of your x-data in one matrix? As in:
x=[x1p. x2p, x3p, x4p];
x(Index1)
It might be that you are creating multiple columns and that's why it can't find the index.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Line Plots finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!