필터 지우기
필터 지우기

How to time shift a signal

조회 수: 12 (최근 30일)
Rohan Repale
Rohan Repale 2013년 5월 20일
답변: Sk Group 2021년 10월 27일
Hi,
I have this code,
clear all; close all; clc;
fc=30e3;
for n=1:3;
tc = gauspuls('cutoff',fc,0.4,[],-40);
t = -tc : 1e-7 : tc;
yi = gauspuls(t,fc,0.6);
plot(t,yi)
hold on
fc=fc+10e3;
end
It is supposed to generate 3 gaussian pulses each at 30kHz, 40kHz and 50kHz respectively. However they overlap each other and I want them to be time shifted in such a way that first is 30k then 40k and then 50k.
Thanks

채택된 답변

Wayne King
Wayne King 2013년 5월 20일
You can just create a vector of zeros and fill it with the pulses
fc=30e3;
t = -tc : 1e-7 : tc;
y = zeros(3*length(t),1);
startidx = 1;
endidx = length(t);
for n = 1:3
yi = gauspuls(t,fc,0.6);
y(startidx:endidx) = yi;
fc = fc+1e4;
startidx = startidx+length(t)+1;
endidx = endidx+length(t)+1;
end
plot(y)
  댓글 수: 2
Youssef  Khmou
Youssef Khmou 2013년 5월 20일
right !
Rohan Repale
Rohan Repale 2013년 5월 20일
Thank you, exactly what I wanted

댓글을 달려면 로그인하십시오.

추가 답변 (2개)

Youssef  Khmou
Youssef Khmou 2013년 5월 20일
hi, try :
clear all; close all; clc;
fc=30e3;
for n=1:3
tc = gauspuls('cutoff',fc,0.4,[],-40);
t = -tc : 1e-7 : tc;
yi = gauspuls(t+n*1e-5,fc,0.6);
plot(t,yi)
hold on
fc=fc+10e3;
end

Sk Group
Sk Group 2021년 10월 27일

카테고리

Help CenterFile Exchange에서 Waveform Generation에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by