Help with Matlab code
1 view (last 30 days)
Show older comments
Devanee Moreno
on 3 Dec 2019
Commented: Image Analyst
on 3 Dec 2019
Hi i need help creatimg a code for tbe question attached. I've plotted the point but im not getting the equation that I need. Is there anyone out there who can help with a code?
0 Comments
Accepted Answer
Image Analyst
on 3 Dec 2019
Looks like polyfit() should do it
temperature = [.........
enthalpy = [...........
coefficients = polyfit(temperature, enthalpy, 1);
% Slope = coefficients(1), intercept = coefficients(2)
See if you can finish it.
2 Comments
Image Analyst
on 3 Dec 2019
slope = coefficients(1)
intercept = coefficients(2)
y = slope * x + intercept
Don't use semicolons so that they print to the command window.
y is the fitted enthalpy and x is what temperature values you want it over, like perhaps the original temperature values, or even more temperatures if you want
numPoints = 500; % Whatever you want.
x = linspace(min(temperature), max(temperature), numPoints);
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!