How to extract element in a vector based on the position another element in another vector.

3 views (last 30 days)
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

Answers (1)

Walter Roberson
Walter Roberson on 2 Nov 2015
[maxLoad, maxidx] = max(Load);
Deflection_at_max = Deflection(maxidx);

Categories

Find more on Graph and Network Algorithms in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!