フィルターのクリア

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 Center および File ExchangeSwitches and Breakers についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by