I got a data of safety factor and its corresponding force, I wan to make it like prompting and asking ”what is the safety factor?’ then the user will enter the value of safety factor and I wan an output displays the corresponding force in the data table
thx for any help.
Since you want to search a value in first column and print the corresponding value from second column you can do something like this:
This assumes that you will always find the corresponding value of
yin first column ofA. If that is not the case, you need to modify the code:you can also use
try-catchblock instead ofif-elsestatement.Interpolation can be bit trick as you need to model it correctly. It is still much easier to interpolate than extrapolate.
Assuming your the values in first column are arranged in increasing or decreasing order, you can use
interp1as follows, for first order interpolation,z = interp1( A(:,1), A(:,2) , y);