(adsbygoogle = window.adsbygoogle || []).push({}); 1. The problem statement, all variables and given/known data

For the given set of data, find the least-square curve:

A) f(x)=Ce^Ax, by using the change of variable X=x, Y=ln(y), and C=e^B to linearize the data points.

B) f(x) = 1/(Ax+B), by using the change of variable X=x and Y = 1/y to linearize the data points.

x : [ -1 0 1 2 3]

y : [ 6.62 3.94 2.17 1.35 0.89]

I need the matlab code on how to do these 2 problems im confused and which curve gives a better fit. ??

2. Relevant equations

This is the only code i know but idk how to do it with the question they are asking i need to pertain it to that

function C = poly(X,Y,M)

n=length(X);

B=zeros(1:M+1);

F=zeros(n,M+1);

for k=1:M+1

F(:,k)=X'.^(k-1);

end

A=F'*F;

B=F'*Y';

C=A\B;

C=flipud(C);

3. The attempt at a solution

These are the coefficients:

-0.0458x^3

0.5225x^2

-2.1567x

3.9040

I am confused with what the question is asking i know im suppose to have a ans for part A and B

**Physics Forums - The Fusion of Science and Community**

# Curve fitting using matlab

Know someone interested in this topic? Share a link to this question via email,
Google+,
Twitter, or
Facebook

Have something to add?

- Similar discussions for: Curve fitting using matlab

Loading...

**Physics Forums - The Fusion of Science and Community**