untitled Simulink student use A Scope 6 As File Tools View S
Solution
let you know about the program as below
clc
clear all
t=0:1:40
y=5*cos(30*pi*t+0.25*pi)
sub plot(2,1,1)
plot(x,y)%CT
title(\'CT cos wave\')
grid
subplot(2,1,2)
stem(t,y) %DT
title (\'DT cos wave\')
grid
notes
plot(x,y) : is used for CT continuous signals
stem(x,y): is used for DT discrete signals
or else go for this method adding a MATLAB function block to a model
1. create a new simulink model and add a MATLAB function block to the model from the user-defined functions library.
2.add source and sink blocks
3. from the source library, add a constant block to the left of the MATLAB function block and set its value to vector like[2 3 4 5];from the sink library,add two display blocks to the right
4.in the simulink editor,select File> save as and save the model as call_stats_block1.
programming the MATLAB function block
1.open the call_stats_block1 model .double click on it to open to edit
2. edit the function header line
function[mean.stdev]=stats(vals)
3.save the model as call_stats_block2
4.complete the connections between the blocks
5.now edit functional blockand save it
checking for errors
1.change the default complier to mex-setup
2.open the call_stats_block 2 and double click on it for editing
3. in MATLAB functional block editor,select build model.build to compile and build the example.

