Order from us for quality, customized work in due time of your choice.
Project
5: MATLAB Loops
Due
Date:
1. Write
a script to calculate all intege
Project
5: MATLAB Loops
Due
Date:
1. Write
a script to calculate all integers divisible by 67 between 1 and 1000 using for
loops.
2. Write
a script to calculate the first 20 Fibonacci numbers using for loops and show
only the even Fibonacci numbers.
3. Write
a script that will display a rectangle of asterisk using for loops. The length
and width of the rectangle should be specified by the user.
4. Loop application: Find summations in Series
The following program calculates the sum of the
series: using
“while end”. The program stops when increment is less than 0.00001.
increment=1; %starting
increment
n=1; %initial
number
sum=0; %
initial sum
while(increment>0.00001)
increment=1/2^n;
sum=sum+increment;
n=n+1;
end
fprintf(‘the sum of series is
%d’,sum)
Answer: the sum of series is 0.999992
Modify the program to find the sum of this series:
Is your result close to this value ?
5. Loop Application: Finding Roots
The following program finds the roots of y=sin(3x)
between and with an accuracy of . A rule of thumb is that
when a root exists, the sign of y changes either from negative to positive or
vice versa.
clc
clear
x1=-2*pi % initial x
y1=sin(3*x1); % initial y
for i=-2*pi:pi/1000:2*pi
y2=sin(3*i); % The value of y
if sign(y2)~=sign(y1)
root=i;
fprintf(‘%f is a rootn’,i)
end
y1=y2;% calculated value will be an
initial value for the next iteration
end
-5.233893 is a root
-4.187743 is a root
-3.141593 is a root
-2.092301 is a root
-1.046150 is a root
0.000000 is a root
0.003142 is a root
1.049292 is a root
2.095442 is a root
3.144734 is a root
4.190885 is a root
5.237035 is a root
Modify the above program to find the roots of between and with an accuracy of . Please show both your
program and outputs.
Order from us for quality, customized work in due time of your choice.