Q:

Write a function plot2fnhand that will receive two function handles as input arguments, and will display in two Figure Windows plots of these functions,

0

 Write a function plot2fnhand that will receive two function handles as input arguments, and will display in two Figure Windows plots of these functions, with the function names in the titles. The function will create an x vector that ranges from 1 to n (where n is a random integer in the inclusive range from 4 to 10). For example, if the function is called as follows >> plot2fnhand(@sqrt, @exp) and the random integer is 5, the first Figure Window would display the sqrt function of x = 1:5, and the second Figure Window would display exp(x) for x = 1:5. 

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

plot2fnhand.m

function plot2fnhand(funh1, funh2)

% Plots 2 function handles in 2 Figure Windows

% Format of call: plot2fnhand(fn hand1, fn hand2)

% Does not return any values

x = 1:randi([4, 10]);

figure(1)

y = funh1(x);

plot(x,y, 'ko')

title(func2str(funh1))

figure(2)

y = funh2(x);

plot(x,y,'ko')

title(func2str(funh2))

end

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now