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

use a matlab program gram description below Program Description: The purpose of

ID: 2249020 • Letter: U

Question

use a matlab program


gram description below Program Description: The purpose of this program is to create four plots of the fractal function % given in problem 7.7 on page 204 of the text. maximize efficiency only % one for loop should be used. The first graph should plot the first 250 % points of the x and y vectors. The other graphs should include the % following points: Graph 2: 1st 2500 points, Grap 3: 1st 5000 points, Graph 4: All 20000 points. Use the point ( . ) marker type with a marker size of 0.5 to pro- duce the four graphs in a single figure window as shown below. The resolution of the graphs below is less than that in the Matlab figure window Fractal Plot with 250 Points Fractal Plot with 2500 Points 1.5 0.5 05 05 0 5 -0.5 0.5 0.5 Fractal Plot with 5000 Points Fractal Plot with 20000 Points

Explanation / Answer

THe question is incomplete. Lots of information is missing. The fractal equations for sunflower ..etc are not given, even though the matlab code is generated it will work fine for these quations.

Xk+1=Yk(1+sin0.7Xk) -1.2rad(abs(xk))

Yk+1 =0.21 - Xk

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

x = zeros(1, 250);
y = zeros(1, 250);
for k=2:250
x(k)=(y(k-1)*(1+sin(0.7*x(k-1))))-(1.2*abs(x(k-1)));
y(k)=0.21-x(k-1);
end
figure
subplot(2,2,1) % add first plot in 2 x 2 grid
plot(x,y,'.'); % line plot
xlim([-1 0.5])
ylim([-0.5 1])
title('Fractal Plot with 250 points')

x1 = zeros(1, 2500);
y1 = zeros(1, 2500);
for k=2:2500
x1(k)=(y1(k-1)*(1+sin(0.7*x1(k-1))))-(1.2*abs(x1(k-1)));
y1(k)=0.21-x1(k-1);
end
subplot(2,2,2) % add second plot in 2 x 2 grid
plot(x1,y1,'.');
xlim([-1 0.5])
ylim([-0.5 1.5])
title('Fractal Plot with 2500 points')

x2 = zeros(1, 5000);
y2 = zeros(1, 5000);

for k=2:5000
x2(k)=(y2(k-1)*(1+sin(0.7*x2(k-1))))-(1.2*abs(x2(k-1)));
y2(k)=0.21-x2(k-1);
end

subplot(2,2,3) % add third plot in 2 x 2 grid
plot(x2,y2,'.');
xlim([-1 0.5])
ylim([-0.5 1.5])
title('Fractal Plot with 5000 points');

x3 = zeros(1, 20000);
y3 = zeros(1, 20000);

for k=2:20000
x3(k)=(y3(k-1)*(1+sin(0.7*x3(k-1))))-(1.2*abs(x3(k-1)));
y3(k)=0.21-x3(k-1);
end

subplot(2,2,4) % add fourth plot in 2 x 2 grid
plot(x3,y3,'.');  
xlim([-1 0.5])
ylim([-0.5 1.5])
title('Fractal Plot with 20000 points')