Does anybody know how to generate a signal for this? T=0.01 seconds and sampling frequency = 10000Hz.

1 view (last 30 days)

Accepted Answer

Dimitris Kalogiros
Dimitris Kalogiros on 6 Sep 2018
clear; clc; close all;
% parameters
T=0.01;
Fs=10E3;
Ts=1/Fs;
% define base signal
s= @(t) ((0<=t) & (t<=T/2))*1
% create wanted signal
t=-T:Ts:5*T;
signal=s(t)+s(t-T)+s(t-2*T)+s(t-3*T);
% plot wanted signal
figure;
plot(t,signal,'-b.'); zoom on; grid on;
xlabel('t'); ylabel('signal');
Your signal is stored into the "signal" variable.
If you run the script, you will get the following:
  3 Comments
Dimitris Kalogiros
Dimitris Kalogiros on 6 Sep 2018
Edited: Dimitris Kalogiros on 6 Sep 2018
Could you explain me please why did you choose 5 in t=-T:Ts:5*T;
You need 4 replicas of your signal, which is defined inside the interval [0 T]. So I created an interval of duration (1+4+1)*T
And a little explanation for the base signal: s= @(t) ((0<=t) & (t<=T/2))*1
I defined a function, usind the function handler @ , in order to define the "branched" signal (s(t) with the tilde).

Sign in to comment.

More Answers (0)

Categories

Find more on Programming in Help Center and File Exchange

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!