Experiment and Model not fitting well
Show older comments
filename = 'dotun2.csv';
%delimiterIn = ',';
headerlinesIn = 1;
A = importdata(filename,delimiterIn,headerlinesIn);
ndata = A.data(:,2);
ydata = A.data(:,1);
plot(ydata,ndata,'o')
xlabel 'n'
ylabel 'b'
f = optimvar('f');
g = optimvar('g');
fun = (ndata*18)/(0.1*2.8*10^7)+g*18.*exp(f*log(ndata/(0.1*284)));
obj = sum((fun - ydata).^2);
lsqproblem = optimproblem("Objective",obj);
x0.f = 0.45;
x0.g = 0.184;
show(lsqproblem)
[sol,fval] = solve(lsqproblem,x0);
disp(sol)
figure
responsedata = evaluate(fun,sol);
plot(ydata,ndata,'bo',responsedata,ndata,'o')
plot(ydata,ndata,responsedata,ndata)
%text(0.1,20, '0.1in 100C')
set(gca,'FontSize',30)
legend('Expt','Model', 'text','FontSize', 18)
xlabel ('\it d','FontSize',16,'FontWeight','bold')
ylabel ('\it F','FontSize',16,'FontWeight','bold')
set(gca,'FontSize',20)
set(gca, 'FontName', 'Cambria')
%title("Fitted Response")
axis([0 0.16 0 300])

1 Comment
Torsten
on 4 Jan 2023
Are you sure that your "fun" is adequate ? Shouldn't it asymtotically approach a fixed value as d grows ? Your "fun" grows without limit.
Accepted Answer
More Answers (0)
Categories
Find more on Noncentral Chi-Square Distribution in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!






