MATLAB Answers

0

plot with input arguments

Asked by Roger Nadal on 5 Dec 2019 at 0:51
Latest activity Commented on by Roger Nadal about 13 hours ago
i want to subplot 4 string containg cell array from ( sin, cos, tan,sinh) and vector (+,o,*,x,s) and the mathmatical function should be ploted in interval (-2pi,2pi)with step 0.3

  0 Comments

Sign in to comment.

1 Answer

Answer by Walter Roberson
on 5 Dec 2019 at 0:58
 Accepted Answer

funs_cell = {'sin', 'cos', 'tan', 'sinh'};
markers = {'+', 'o', '*', 'x', 's'};
funs = cellfun(@str2fun, funs_cell, 'uniform', 0);
for K = 1 : length(funs)
plot(x, funs{K}(x), markers{K}, 'DisplayName', funs_cell{K});
hold on
end

  17 Comments

Roger Nadal ongeveer een uur ago
no the function should plot on interval [-2pi ,2pi] but the x axes i want [-10 10]. the order of plot is different than argument pass in fuction {sin', 'sinh', 'cos', 'cosh'} the plot order is sinh,cosh,sin,cos.
Walter Roberson
alrededor de 4 horas ago
xlim controls the axes boundaries no matter what is plotted inside.
You asked for random order.
Roger Nadal alrededor de 3 horas ago
Ok got it.

Sign in to comment.