現在この質問をフォロー中です
- フォローしているコンテンツ フィードに更新が表示されます。
- コミュニケーション基本設定に応じて電子メールを受け取ることができます。
エラーが発生しました
ページに変更が加えられたため、アクションを完了できません。ページを再度読み込み、更新された状態を確認してください。
古いコメントを表示
Hi
I have a simple query.
Suppose i have a signal s = randn(1,10), if I want to add delay 100ms to this signal, what should i do?
I heard about upsampling the signal and then adding zeros, but can you help me with an example code
s = randn(1,8);
delay = 100ms;
s1 = upsample(s,?);
s_delay = [how many zeros, s1]?
Is that approach right?
採用された回答
Walter Roberson
2012 年 1 月 19 日
It is not possible to add a delay to a signal unless you know what the sampling frequency is.
12 件のコメント
PChoppala
2012 年 1 月 19 日
Okay, here is my actual prob
load handel.mat;
hfile = 'handel.wav';
[y,Fs] = wavread(hfile); % this will give me a broadband signal with 73113 samples and Fs = 8192;
I want to add a delay of 1.3 ms to this 'y'. How do I do that?
I assume I need to pad fix((Fs*1.3e-3)) zeros in the front, is that right?
In this case
fix(Fs*1.3e-3)% =10, so i need to pad 10 zeros in the beginning
x = vertcat(zeros(10,1), y(1:length(y)-10));
Is 'x' the 1.3ms delayed signal?
But I gather there is another method...wherein, we upsample the signal and low pass filter it...can you please help me with that?
Cheers
Walter Roberson
2012 年 1 月 19 日
Express the intervals as fractions.
1.3 ms is 13/10000 .
Fs is 1/8192
solve as a fraction:
13/10000 = x/8192
which gives x = 6656/625
Cross-check: (1/10000)*(13*625) = 6656*(1/8192) gives 13/16 = 13/16 which is true.
Therefore, the signal must be upsampled by a factor of 6656, after which 1.3 ms will correspond to 13*625 = 8125 zeros.
Adding fix((Fs*1.3e-3)) zeros will *not* get you a 1.3 ms delay: it will get you a 1.22 ms delay, which is not a good enough approximation for sound processing purposes.
PChoppala
2012 年 1 月 19 日
Agh, I understand it now. Thank you very much.
Please allow me to ask one more query.
1. The signal in the above quoted case 'y' has 73113 samples.
If I use
x = upsample(y,6656), I get the error
'Maximum variable size allowed by the program is exceeded'
What to do about that?
2. Fs is 8192, not 1/8192. Is it a mistake you typed in the 3rd statement?
3. Of the topic, how can we find the sampling frequency of a signal of the form s = randn(1,1000)?
Please help me as I am struggling with this concept for a couple of days.
Thanks a lot
Walter Roberson
2012 年 1 月 19 日
2. Yes, sorry, the sampling interval is 1/Fs, 1/8192
1. I am mildly surprised that upsample said that the maximum variable size allowed by the program was exceeded, as the result would only be 3.6+ gigabytes, which would fit in to 32 bit memory if only everything else was out of the way. I would have thus expected "out of memory" instead of maximum variable size. In any case, Yup, it's too big for you to compute using upsample() unless you switch to the 64 bit version of MATLAB.
What to do about it? The usual way is to use a fractional delay filter instead of using upsample.
3. There is no sampling frequency for a signal defined by its samples. If someone from another of our departments were to send me a data file with 1000 samples, I would not know whether it was a measurement off of one of our attosecond (1E-18 second) lasers, or a measurement that had been done once a week for about 21 years.
Walter Roberson
2012 年 1 月 19 日
Yup. But in your "actual prob" from your first comment, you do not have a random signal and you know the Fs from the wavread() command, so the question of sampling frequency for randn(1,1000) is not relevant to that situation.
PChoppala
2012 年 1 月 19 日
Hi again,
Bear with me this one time.
1. Yeah, Fs for randn is not relevant. Sorry.
2. I read the document on design.fracdelay, but could not understand how to upsample a sequence or add delay to 'y', in the above stated context. I have not worked on filters or used the command.
Can you just give me an example of how to use the command to upsample or add delay?
I can start my coding once I can do that.
Please.
and thanks for the method, it will be a big relief for me, if I can get this going today!
Cheers
PChoppala
2012 年 1 月 19 日
For a signal having 1000 samples, on my machine, the signal can be upsampled by a max of '99999'.
Walter Roberson
2012 年 1 月 19 日
entiredelay = 0.0013 * Fs;
wholesamplesdelay = floor(entiredelay);
fracdelaysamples = entiredelay - wholesamplesdelay;
d = fdesign.fracdelay(fracdelaysamples);
H = design(d, 'lagrange', 'FilterStructure', 'farrowfd');
I have not researched to see how you would use H. Whatever output you get from using it needs to be pre-padded with wholesamplesdelay 0's.
upsampling would not come in to it. upsampling is an alternative method.
It would not surprise me if there is an fft() based method of implementing the delay, perhaps by adjusting the phase.
PChoppala
2012 年 1 月 19 日
Okay so here is how I used
entiredelay = 0.0013 * Fs;
wholesamplesdelay = floor(entiredelay);
fracdelaysamples = entiredelay - wholesamplesdelay;
d = fdesign.fracdelay(fracdelaysamples);
H = design(d, 'lagrange', 'FilterStructure', 'farrowfd');
y1 = filter(H,y);
y1 = vertcat(zeros(wholesampledelay,1),y1);
is that right?
Walter Roberson
2012 年 1 月 19 日
Looks plausible to within my limited filter knowledge.
PChoppala
2012 年 1 月 19 日
Hmm, okay, let me see how this goes.... Thank you very much. Good day
PChoppala
2012 年 1 月 19 日
Hi again, Morning!
Just realized that we may use the translation property of Fourier transform, but unable to figure out how.
if h(x) = ƒ(x − x0), then H(w)= e^{-2 π i x0 ω }F(ω)
Can you help me with this approach?
Cheers
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Multirate Signal Processing についてさらに検索
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の MathWorks のサイトは、お客様の地域からのアクセスが最適化されていません。
南北アメリカ
- América Latina (Español)
- Canada (English)
- United States (English)
ヨーロッパ
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
