MATLAB: How to plot all results in a for loop

loopplot

I have tried to plot a 2D figure for a for loop function but the results does nor show in one figure?
My code:
function fluid_dynamics
F=input('Enter the inpulse force:');
for x=0:0.1:8*pi;
y1= F*exp(-0.246*x)*sin(0.806*x);
end
figure
plot(x, y1, 'r*');

Best Answer

You forgot to put an index for y1. Try this:
fontSize = 30;
F=input('Enter the inpulse force:');
x = 0 : 0.1 : 8*pi;
for index = 1 : length(x)
y1(index) = F * exp(-0.246*x(index)) * sin(0.806*x(index));
end
figure
plot(x, y1, 'r*-', 'LineWidth', 3);
xlabel('x', 'FontSize', fontSize);
ylabel('y1', 'FontSize', fontSize);
grid on;
% Enlarge figure to full screen.
set(gcf, 'Units', 'Normalized', 'OuterPosition', [0 0 1 1]);