Exponential Regression | ExpoFit | MATLAB
Code:-
clc
clear all
close all
x=[1 2 3 4 5 6];
y=[1 2.03 4.08 8.22 16.56 33.34];
plot(x,y,'o');
y=log(y);
hold on;
a=[];
for i=1:length(x)
a=[a ; x(i) 1];
end
c =a\y';
c(2)=exp(c(2));
hold on;
x=min(x):0.01:max(x);
y=c(2)*exp(c(1)*x);
plot(x,y,'g');
grid on;
clc
clear all
close all
x=[1 2 3 4 5 6];
y=[1 2.03 4.08 8.22 16.56 33.34];
plot(x,y,'o');
y=log(y);
hold on;
a=[];
for i=1:length(x)
a=[a ; x(i) 1];
end
c =a\y';
c(2)=exp(c(2));
hold on;
x=min(x):0.01:max(x);
y=c(2)*exp(c(1)*x);
plot(x,y,'g');
grid on;
No comments