Fit a line and integration
Ältere Kommentare anzeigen
Hi all
I have a data set of solid fraction (fs) as a function of Temperature (T), ( attcahed file"results1'). I would like to calculate the integration of this expression: fs^2/(1-fs)^3, within the temperature range of [558,649] .First, I found the curve fit , fsfit, using poly4 and then converted it to a symbolic variable,fsvart. Then, I develped the equation fss which is basically the expression above, and converted it to a MATLAB function, ht to be integrated. Now, I do not think the fsfit is returning the correct fs value at a given temperature because the integral value is very off from what I expected.
I hope someone can help me here.
clc; close all; clear all;
syms x
% reading the data
filename='Results1.xlsx';
sheet='Sheet1';
fs = xlsread(filename,sheet,'A2:A57');
Temp = xlsread(filename,sheet,'B2:B57');
% find the curve fit
fsfit = fit(Temp,fs,'poly4','normalize','on');
% convert the fs into symbolic variables to perform the integration after
fsvar = subs(str2sym(formula(fsfit)),coeffnames(fsfit),num2cell(coeffvalues(fsfit).'));
vars = sym(indepnames(fsfit));
% Bulding the equation based on fs and inetgration
fss=fsvar^2/(1-fsvar)^3;
ht = matlabFunction(fss);
s1=integral(ht,831,922);
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Logical finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!