Signal is not properly sampling at the rising edge of clock.
1 view (last 30 days)
Show older comments
Hi. I am sampling my input signal of frequency 50hz at the rising edge of clock and I am using simulatin time to sample my input. I am using simulation time because I have to introduce some delay later on clock.but it sample every time at zero. I am attaching my simulink model plus my sampler code below. The sampler block is inside of triggered subsystem. It seems it does not sample properly. Please help me in that model so I can solve this problem. Also can I use "pulstran" function instead of ideal clock ? If it does not work.
function Vin = sample(ip) coder.extrinsic('stem'); coder.extrinsic('get_param') persistent x1;
if isempty(x1) % Initialization x1=0; end
f=50; % input signal frequency sim_t=get_param('check','SimulationTime')
x1=sin(2*pi*f*sim_t);
stem(sim_t,x1); % plotting discrete samples on the input signal1
Vin=x1;
Thanks
0 Comments
Answers (0)
See Also
Categories
Find more on Simulation, Tuning, and Visualization in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!