Question: Graphical Data Representation - Histogram Normal Distribution To create a histogram from a simulation of a normal distribution, the randn function is needed. The format
Graphical Data Representation Histogram Normal Distribution
To create a histogram from a simulation of a normal distribution, the randn function is needed. The
format is as follows:
Variablename musigmarandnarray
ESET Six Sigma and Applied Statistics
where mu is the mean and sigma is the standard deviation. This variable will act as your frequency axis,
or as vector Y for your histogram. The function for plotting the histogram on MATLAB is histYX X in
this case, will be the individual range of your frequencies. This is defined as a vector with constant
spacing.
With this in mind, plot a histogram with the following constraints:
A x randomly generated array with a mean of mu and a standard deviation of
sigma and a bin width array that increments by one from to
Save your m file with your initials as LabMATLABInitials and save the histogram figure as a
separate image file. Does this graph look symmetrically bellshaped, or normal?
Now change the number to and repeat the same steps. Compare the histogram with the
one you get the step Does this graph look symmetrically bellshaped, or normal?
Simulinksimulation for dynamic systems such as motors
Run a model in Simulink
Copy the Simulink model DCPMmotorNonParametrized from eCampus to the Current
Folder window in MATLAB. In the Current Folder double click the file
DCPMmotorNonParametrized. Exam the values for parameters such as Jinv, Vbatt, and
Linv by double clicking the corresponding blocks. For example, double click on the Jinv
gain block, you will find the Gain is defined as
Click the green Run button, then double click the Scope and Scope blocks to look at the
motor current and motor speed.
Try to zoom inout and change the scale XY axes limits
ESET Six Sigma and Applied Statistics
Fig. Motor speed trace
Run a model from an m file
Copy the file MfileforSimulinkm from eCampus to the Current Folder of MATLAB, then double
click it in the Current Folder. You should see the m file open with lines of codes. Read the code
and try to understand what each line does. Use help commandname in the command window
to read the documentation For example, help sim, help plot, help figure
Explore the Simulink model by double clicking DCPMmotor in the Current Folder and then
double clicking each block in it Do you find the value for the parameter in each block?
Now run the mfile MfileforSimulink.m You should see plots.
Set all the parameters, such as Linv, Jinv, etc., in these two methods to be the same, then you
have the same result from these two methods. The mfile method allows the user to easily
change parameters and rerun the model. For example, you can add code to the m file so that a
for loop is created to change parameter values.
Use the mfile to plot the steadystate speed the limit of the speed when time goes to infinity as
a function of the voltage applied Vbatt
First define a voltage vector: Vbatti::;
Then create a for loop:
for i:N
VbattVbattii;
TXYsimDCPMmotormdl::;
Vbattji Vbatt;
Speedimax Y:;
end
figure
plotVbattj Speed
grid on
Test your code with N If your code works as you expected, insert the following before the for
loop:
NsizeVbatti;
NN;
Change the values of the second and third parameters in
simDCPMmotormdl::
Try :::::: and other values. Discuss what you observed in the two
scopes.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
