2nd degree fit with x^2 unknown

4 views (last 30 days)
emelie Flood
emelie Flood on 22 Jul 2011
Hi, i want to make a curv fit to this eq: t=r^2*x^2+t(1) where r and t are known and vectors ( r=[0 2.1 4.2 6.3 8.4 10.5 12.6 ]
t =[93.3168 0 91.1868 0 93.0526 91.9160 88.0559] ) and then get x. I also want to exclude the values where t=0 and their corresponding r. Anyone that knows how to? Ive been searching forever but all functions asunme that i plug in x and y and want the coefficients but thats not the case here!
Thanks allot!!

Answers (1)

bym
bym on 22 Jul 2011
If r & t are known, you can solve for x - no curve fitting required
clc;clear
t = [93.3168 0 91.1868 0 93.0526 91.9160 88.0559];
r = [0 2.1 4.2 6.3 8.4 10.5 12.6 ];
r = r(t~=0); %discard r where t = 0
t = t(t~=0); %discard t = 0
x = sqrt((t-t(1))./r.^2)
  1 Comment
emelie Flood
emelie Flood on 23 Jul 2011
<hi! Thanks for the answer, the thing is though that i want the x that fits the curve the best, only one x and not a vector! anyone knows how to do this?
<thanks allot!!
/Emelie

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!