Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Please provide the matlab code for this question. Thank you. Let y_1 = 1 and y_2

ID: 3695352 • Letter: P

Question

Please provide the matlab code for this question. Thank you.

Let y_1 = 1 and y_2 = 1. Define y_n+1 = y_n-1 for n = 2,3,... This sequence generates the Fibonacci numbers which appear in many places. Compute the first 50 Fibonacci numbers y_1 up to y_50 TASK: Save the value of y_50in the file A01.dat Let z_n= ln(y_n). If you plot z_n vs. n as points, you should see a nearly linear relationship. z_n is equivalent to c_1n+ c_2 Use the method polyfit to obtain c_1 and c_2 from these 50 data points. TASK: Save the column vector [c_1: c_2 in the A02.dat Exponentiating the previous approximation of z_n yields y_n is equivalent to exp(c_1n+c_2) = c_3^n where C = exp(c_2) and beta = exp(c_1) TASK: Save the value of beta in the file A03.dat

Explanation / Answer

%---fibnocii series

y(1)=1;
y(2)=2;
for n=3:50
y(n) =y(n-1)+y(n-2)
end
A01=y;

%---saving into a file----
save('A01.mat');

%2))))))))))))))

for n=1:50
z(n)=log(y(n));
end
x=[1:50]
plot(z,x)
c=polyfit(x,z,1)
A02=c;

save('A02.mat');

%3)))))))))))

for i=1:50
y1(i)=exp(c(1)*i+c(2))
end
C=exp(c(2));
beta=exp(c(1));
A03=beta;
save('A03.mat');

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote