Complicated matlab for loop using user's input

Hello everybody,
So i ran into this problem, where i've got a number x=m:.1:m+4*pi and i have to create a for loop which would increase the m value by pi/8 every 0.5 seconds for 15 times and then graph it and I just have no idea how to make it work.. so far I have done this much:
%------
prompt='Iveskite skaiciu m: ';
m=input(prompt);
x=m:.1:m+4*pi;
prompt2='Pasirinkite funkcija cos(B)/sin(A): ';
f=input(prompt2,'s');
if strcmp(f,'A')
fun=@sin;
elseif strcmp(f,'B')
fun=@cos;
else
error('invalid selection')
end
figure(1),clf(1)
plot(x,fun(x))
%------
for a = 0:15
for k = m:0.1:m<m+4*pi
x(a,k) = m:.1:m+4*pi;
end
end
It's not much, but I tried my best.
By the way, the number m is a user's input.

Answers (1)

str2func() should play a role here just look into the doc

1 Comment

Could you give an example how and where would it play the role in my loop?

Sign in to comment.

Categories

Find more on Loops and Conditional Statements in Help Center and File Exchange

Asked:

on 11 Dec 2018

Commented:

on 11 Dec 2018

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!