So I'm very puzzled as to how I find out my C values from the C lin fit. It tells me define my formula's as function handles, no worries done that easy. Then it tells me perform least squares fit or nlinfit of my X function (the Tib model for distance). So I've laid it out in my code the same way I've done it before and I get the error you see in the title. Now I'm confused because X relies on A, and A relies on C. I tried doing an nlinfit on A to find C but no luck there. So I'm stuck on part a where things are highlighted.
I read others with similar errors and the soulition seemed to be pass something through your function, which I tried by
c = nlinfit(x,t,X(c,t),c0);
but that didn't work either, just told me c was an unknown variable.
clc
clear
V = @(c, t) A*(1-exp(-c(1)*K))-c(2).*t;
X = @(c, t) A*K-(c(1)/2)*K^2-(A/c(2))*(1-exp(-c(2)*K));
A = @(c) (xe+c(1)/2)*(K^2)/(K-((1/c(2))*1-exp(-c(2)*K)));
c0 = [.01;1;];
c0 = [.01; 1];
load sprint.dat
x = sprint(:,1);
tbolt1 = sprint(:,2);
tbolt2= sprint(:,3);
tlewis1 = sprint(:,4);
tjohn1= sprint(:,4);
t0 = tbolt1(1);
te = tbolt1(11);
t = tbolt1;
K = te-t0;
xe = 100;
A = @(c) (xe+c(1)/2)*(K^2)/(K-((1/c(2))*1-exp(-c(2)*K)));
V = @(c, t) A*(1-exp(-c(1)*K))-c(2).*t;
X = @(c, t) A*K-(c(1)/2)*K^2-(A/c(2))*(1-exp(-c(2)*K));
c = nlinfit(x,t,X,c0);
0 件のコメント
サインインしてコメントする。