plot with input arguments

1 Ansicht (letzte 30 Tage)
Roger Nadal
Roger Nadal am 5 Dez. 2019
Kommentiert: Roger Nadal am 11 Dez. 2019
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

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 5 Dez. 2019
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
  33 Kommentare
Roger Nadal
Roger Nadal am 11 Dez. 2019
Thank you
Roger Nadal
Roger Nadal am 11 Dez. 2019
If I don’t want to generate random order for then should I remove randperm?

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by