How to extract element in a vector based on the position another element in another vector.
Mostrar comentarios más antiguos
Here is the code:
___________________________________________________
D = [0:0.1:1.4]/200;
L = [0 1 2 3 4 5 6 6.8 6.5 6 5.5 5.4 5.3 5.25 5.22]*1000;
% Calculating the deflection and load
Deflection = [0:.01:1.4]/200;
Load = spline(D,L,Deflection);
Load = Load+rand(size(Load))*100;
figure(1)
plot(Deflection,Load)
____________________________________________________
I have used the max() function to obtain where the numeric value of Load is the greatest value, but I also want to find the value of Deflection at that same coordinate. (Load is on the y-axis and deflection is on the x-axis) I am having trouble gaining the exact value. Given that the coordinates of the graphs using these variables are 2 vectors containing 140 elements each, and also knowing the numerical value of max(Load), how can I find the corresponding x-value(Deflection)?
Thanks
Respuestas (1)
Walter Roberson
el 2 de Nov. de 2015
[maxLoad, maxidx] = max(Load);
Deflection_at_max = Deflection(maxidx);
Categorías
Más información sobre Graphics Object Properties en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!