Info

This question is closed. Reopen it to edit or answer.

Stuck, How do I use an input and try to check it against my excel data?

1 view (last 30 days)
Hello,
I have written a code that takes information from an excel file that has four columns. The first column represents a Height while the next three columns contain the velocity pressure exposure coefficients. I have been able to ask a user to input the Height and the Exposure type. I have no idea how to take that input and if it is not an exact height that matches one of the values in the first column, to interpolate the coefficient value based on the input's upper and lower bounds.
Here is the code I have written so far:
data = xlsread('HW23.xlsx');
num_rows=size(data,1);
num_columns=size(data,2);
hvar=input('Input the height above ground: ');
A=-1;
B=0;
C=1;
exposure=input('Input the exposure type (A, B, or C): ');
if exposure < 0;
y = data(:,2);
elseif exposure == 0;
y = data(:,3);
elseif exposure > 0;
y = data(:,4);
end
I have also attached the Excel spreadsheet with all the values.
I do not want an answer, only some hints and guidance.
Thank you!

Answers (1)

dpb
dpb on 6 May 2015
doc interp1
  2 Comments
Ryan Albawab
Ryan Albawab on 6 May 2015
I am sorry I should have mentioned this, We are not allowed to hardcode or use the following commands: interp1, interp2, interp3, interpn, interpft.
dpb
dpb on 6 May 2015
Well, it would seem you've got to write a replacement for it yourself then. The hint in that regards starts with "How would you solve the problem with paper and pencil?" Then, write a function to do that.

Community Treasure Hunt

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

Start Hunting!