117k views
5 votes
1) (10 pts) Write a function PlotData.m that will receive one input argument: which is a handle to a plot function (such as plot(), bar(), etc.). Inside the function, a vector of 10 random integers between [-10, 10] will first generated. Then these random data will be plotted using the type of plot function specified in the input argument. Display the type of plot function as the title of the plot.

User Epochwolf
by
5.4k points

1 Answer

7 votes

Answer:

output:

-1 6 -4 6 -1 -10 -7 5 -1 -7

Step-by-step explanation:

The MATLAB function

clear

clc

% PlotData function

PlotData(atbar); //change the at with at sign

function [] = PlotData(plot)

% [-10,10] is the range 1 is row and 10 is columns

y=randi([-10,10],1,10);

disp(y);

plot(y);

end

See attachment for the graph

1) (10 pts) Write a function PlotData.m that will receive one input argument: which-example-1
User Divesh Salian
by
5.9k points