Write a MATLAB program which prints the Fibonacci series using loop. 1 1 2 3 5 8 13 21 34 …
Posted in matlab
No comments
Wednesday, July 30, 2014 By Anonymous
Write
a MATLAB program which prints the Fibonacci series using loop.
1
1 2 3 5 8 13 21 34 …
Solution:
function
QUESTION3() %Function
start
start=input('ENTER
STARTING NO: '); %Input
starting no of Fiboonaci
END=input('ENTER
ENDING NO: '); %How
many Terms Required
next=start;
disp(start);
for
n=start:END %Loop
start to end
disp(next); %Display
the series
temp=next+start;
start=next;
next=temp;
end %END
For loop
end %END
Function
Related posts
- Plot the following MATLAB functions y = ln(exp(x^-1)) with x = 1, 1.5, 2, ..., 4
- Plot the following MATLAB functions: y = exp(-x^2) with x = 0, 0.1, 0.2, ..., 2
- Plot the following MATLAB functions: y = 3x+2 with x = 0, 0.25, 0.5, ...., 7.75, 8
- MATLAB function that takes a matrix as argument and then ask from the user
- MATLAB program which computes the mean and standard deviation of the data. Use FOR LOOPs.
Share this post
0 comments: