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 CenterFile Exchange에서 Multirate Signal Processing에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by