필터 지우기
필터 지우기

Applying phase selection on chirp

조회 수: 3 (최근 30일)
tony karamp
tony karamp 2013년 4월 1일
hello,
I am trying to create a swept-frequency cosine, and I want to be able to set the phase as I please. I tried that code, but I get an error. I want to create a vector mat(1:40), where I can manually set its phase.
Fs = 32000; %Sampling Frequency
t = 0: 1/Fs: 10 -1/Fs; %Time
tt = 10; %Time when the chance occurs
f1 = 20; %Starting Frequency
f2 = 250; %Ending Frequency
cosineph = zeros(1,40); %Phase of sines
for iMat= 1:40
k=iMat/2;
mat(iMat) = chirp(t,k*f1,tt,k*f2,'linear',cosineph(iMat));
end
The error that I am getting is " In an assignment A(I) = B, the number of elements in B and I must be the same."
Now, I am guessing it refers to variable t, so I tried implementing that into an embedded for, but didn't get the results I wanted.
Any advice?
Thanks

채택된 답변

tony karamp
tony karamp 2013년 4월 1일
it seems that the way to go is to replace the vector, with a cell. So the code alters like that:
for iMat= 1:40
k=iMat/2;
mat{iMat} = chirp(t,k*f1,tt,k*f2,'linear',cosineph(iMat));
end

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Switches and Breakers에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by