How to generate a signal

6 ビュー (過去 30 日間)
Ricardo Duarte
Ricardo Duarte 2022 年 1 月 7 日
コメント済み: Star Strider 2022 年 1 月 7 日
Dear all,
I want to generate a signal similar to the one in the following picture (black line only).
How can I do that.
I tried to do it by hand and I obtained the next picture
The thing is that I need more resolution (I have now 41 points and I need to have 4096). How can I do that?
Thanks in advance,
  1 件のコメント
Image Analyst
Image Analyst 2022 年 1 月 7 日
What does "do it by hand" mean? How did you actually get that second plot above?
Do you mean that you had an image of the graph and you used something like drawfreehand() to hand-trace the curve? And then plotted the coordinates that you traced? If you need more than drawfreehand() gave you, you can just use interp1().

サインインしてコメントする。

採用された回答

Star Strider
Star Strider 2022 年 1 月 7 日
I would use the interp1 function —
x = linspace(0, 0.015, 41); % Independent Variable
y = randn(size(x)); % Synthesize Signal
xi = linspace(min(x), max(x), 4096);
yi = interp1(x, y, xi, 'linear');
figure
subplot(2,1,1)
plot(x, y, '.-')
grid
title('Original Signal')
subplot(2,1,2)
plot(xi, yi, '.-')
grid
title('Interpolated Original Signal Shjowing Interpolated Points')
figure
subplot(2,1,1)
plot(x, y, '.-')
grid
title('Original Signal')
xlim([4.1 4.15]*1E-3)
subplot(2,1,2)
plot(xi, yi, '.-')
grid
title('Interpolated Original Signal Shjowing Interpolated Points')
xlim([4.1 4.15]*1E-3)
sgtitle('Enlarged To Show Detail')
The original and interpolated vectors are plotted as dots connected by lines.
.
  2 件のコメント
Ricardo Duarte
Ricardo Duarte 2022 年 1 月 7 日
Thank you very much! It was exactly this what I wanted!
Star Strider
Star Strider 2022 年 1 月 7 日
As always, my pleasure!
.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMultirate Signal Processing についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by