rise/fall time

조회 수: 5 (최근 30일)
Parisa
Parisa 2020년 7월 31일
댓글: Shae Morgan 2020년 8월 7일
Hi, can anyone help me to generate 2 sounds of 500 and 1000 Hz with 25 ms duration with ISI of 30 ms and rise/fall time of 10 ms with Fs of 44100 and I want to 500 Hz be 10 dB less than 1000 Hz

채택된 답변

Shae Morgan
Shae Morgan 2020년 7월 31일
편집: Shae Morgan 2020년 7월 31일
%set-up parameters
fs=44100; %CD quality - also conveniently divisible by 30 and 25
stim_dur=.025; %duration in seconds
ISI_dur=.030; %ISI duration in seconds
ramp_dur=.010; %ramp duration in seconds
t=0:1/fs:stim_dur-1/fs;
f1=500;
f2=1000;
%create signals
xt1=sin(2*pi*f1*t);
xt2=sin(2*pi*f2*t);
%setup ramp
rampSamps = floor(fs*ramp_dur);
window=hanning(2*rampSamps)'; %hanning window is cosine^2 this will change depending on the kind of ramp you want
w1=window(1:ceil((length(window))/2)); %use the first half of hanning function for onramp
w2=window(ceil((length(window))/2)+1:end); %use second half of hanning function of off ramp
w1 = [w1 ones(1,length(xt1)-length(w1))];
w2 = [ones(1,length(xt1)-length(w2)) w2];
%ramp stimuli
xt1_ramped = xt1.*w1.*w2;
xt2_ramped = xt2.*w1.*w2;
%generate ISI
ISI=zeros(ISI_dur*fs,1);
%final stimulus
out=[xt1_ramped';ISI;xt2_ramped'];
plot(out)
  댓글 수: 9
Parisa
Parisa 2020년 8월 7일
편집: Parisa 2020년 8월 7일
Hi dear Shae
I asked another question but nobody answered it. can you see if you can answer me please?
I want to replace 500 Hz to a 200 ms 950 to 1050 Hz noise with 10 ms rise/ fall time and 10 dB SNR with 10 ms ISI
Generating pure tone and noise
Shae Morgan
Shae Morgan 2020년 8월 7일
I looked at your question and submitted an answer - there you asked for a 20 ms ISI, so I answered the question you asked there, not here. Please update the question if it isn't what you need and I'll be happy to submit an answer.
If the solution works, please choose to accept my answer! It helps me a lot as I try to help you!

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Timing and presenting 2D and 3D stimuli에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by