Couldn’t really think of the best title for this thread, so if anyone can come up with something that describes the below better, please suggest!

Anyway, not used Matlab for quite a while, can just about remember the basics but I’m doing calculations based on data from a wind-tunnel lab I did recently.

The background isn’t that important, but I’ve got a load cell, and I want to manipulate the calculation data. I’ve managed to plot three sets of loading different loads against voltage data, taken the average then plotted a least-squares fit with polyval.

That’s fine, but I want to use this to find the force for a given voltage now.

So what matlab function do I use to do the reverse of plotting, and find the x value for a given y value on this new line (function) I’ve created?

I can’t really think of the name for doing this, which means I’m finding it hard to search for help on the internet!

I am not sure how you are using polyval here, but ployfit is what you want to use to fit a set of data. polyfit(x,y,1) will do a linear fit. [polyfit(x,y,2) does a quadratic, polyfit(x,y,3) does a cubic etc. etc.] You will get a vector of two terms from there. Then you do polyval([vector from polyfit],#), where # is the x value that you want to calculate y at.