Coordinates of an area graph

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.

 채택된 답변

Mahdi
Mahdi 2013년 4월 1일

0 개 추천

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

Son Goku ssj4
Son Goku ssj4 2013년 4월 1일
편집: Son Goku ssj4 2013년 4월 2일
Well, not so sure if it works.
If I write it like this:
Index1=find([M1,M2,M3]==maximumM)
x(Index1)
Then the result is:
Index1 =
51 52
Undefined function 'x' for input arguments of type 'double'.
So it tells me that the x-position is between 51 and 52 column (row?) of equations M1,M2. Now how to get the x-axe coordinates :-)
The second try was the:
Index1=find(M1==141499.264)
x(Index1)
But the result is:
Index1 =
Empty matrix: 1-by-0
Undefined function 'x' for input arguments of type 'double'.
So I don't quite understand what's happening.
Edit:
I understand your solution, but I don't know what replacement should I chose for your "y" in "y == 141499.264" The point is (I think) read the value -from graph-.
Mahdi
Mahdi 2013년 4월 2일
편집: Mahdi 2013년 4월 2일
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.
Son Goku ssj4
Son Goku ssj4 2013년 4월 2일
Oh my GOD you're a GENIUS! :-) Thank youu!
Till later :-P
I've got two more questions but I suppose it's better to create a new thread.
Really, thank YOU very much.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

제품

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by