MATLAB Answers

Need help finding a value on a graph

25 views (last 30 days)
Grant Piephoff
Grant Piephoff on 26 Oct 2017
Answered: Walter Roberson on 26 Oct 2017
I am doing a short problem where we graph stress amplitudes against logarithms of cycle failures.
I have completed the graphing part correctly, I just need to know how to code so that it outputs me an x value given a y value. The code is below, and given a Stress amplitude of 120, what will be the logarithm cycles to failure? Note: The part in the code about fatigue strength was a separate part where we were given the x value and told to find the y.
SA=[170 148 130 114 92 80 74];
CTF=[log10(3.7*10^4) log10(1.0*10^5) log10(3.0*10^5) log10(1.0*10^6) log10(1.0*10^7) log10(1*10^8) log10(1*10^9)];
hold on, grid on
title('Stress Amplitude vs. Logarithm of Cycles to Failure');
xlabel('Logarithm Cycles to Failure');
ylabel('Stress Amplitude, S (MPA)');

Answers (2)

Star Strider
Star Strider on 26 Oct 2017
One option is to use the interp1 function. Remember that if you want to find x for a given y, use (y,x) rather than (x,y).
If you are supposed to use your regression model, you want to know where the root of ‘p’ equals 120. Set the polynomial ‘p’ to have a root at 120, and use the roots function to find it. Remember that you have to subtract 120 from only the constant term of ‘p’, not the entire polynomial.

Walter Roberson
Walter Roberson on 26 Oct 2017
Your f values are changing monotonically. You can use interp1() to find any particular value.
interp1(f, CTF, f_being_looked_for)

Community Treasure Hunt

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

Start Hunting!