Sie sind auf Seite 1von 3

Lecture: 1-4

1. Now the 2 main data types in MATLAB :- scalars and matrices or arrays or vectors.

2.
3.

4.

5. Fibonnachi Series:- Using For loop

%%Fibonacchi Series using For loop%%


n=10;
fibo=[1,1];
for i=3:n
fibo(i)=fibo(i-1)+fibo(i-2);
end

6. Fibo using while

%%Fibonacchi Series using while loop%%


fibo=[1,1];
while (fibo(end)<200)
fibonew=fibo(end) + fibo(end-1);
fibo=[fibo,fibonew];
end

Solution:

Das könnte Ihnen auch gefallen