You are on page 1of 1

EXPONENTIAL EQUATION

BATCH-TB2 ROLL NO-24


-------------------PROGRAM--------------------------n=input('enter the value of n=');
for i=1:n
x(i)=input('enter the value of x=');
y(i)=input('enter the value of y=');
y(i)=log(y(i));
end
s1=0;
s2=0;
s3=0;
s4=0;
for i=1:n
s1=s1+x(i);
s2=s2+y(i);
s3=s3+(x(i)*y(i));
s4=s4+(x(i)*x(i));
end
d=((s1*s1)-(n*s4));
da1=((s2*s1)-(n*s3));
db1=((s1*s3)-(s2*s4));
a1=(da1/d);
b1=(db1/d);
a=exp(b1);
b=exp(a1);
fprintf('the equation is y=%f*(exp^(%f*x))',a,b);
----------------OUTPUT---------------------------enter the value
enter the value
enter the value
enter the value
enter the value
enter the value
enter the value
enter the value
enter the value
enter the value
enter the value
enter the value
enter the value
enter the value
enter the value
the equation is

of n=7
of x=1
of y=0.5
of x=2
of y=2.5
of x=3
of y=2
of x=4
of y=4
of x=5
of y=3.5
of x=6
of y=6
of x=7
of y=5.5
y=0.7044*(exp^(1.404157*x))>>

You might also like