sawtooth 関数で三角波の位相をシフトしたい

27 views (last 30 days)
Musashi Ito
Musashi Ito on 21 Feb 2020
Commented: Musashi Ito on 25 Feb 2020
Singal Processing Toolbox の sawtooth 関数 で三角波をプロットしたく、以下のドキュメンテーションを参考にしてます。
波形の位相を45°や90°シフトしたい時はどのようにプログラムを記述すればできますか?

Accepted Answer

Kenta
Kenta on 21 Feb 2020
こんにちは、sawtooth(t)自体はtでののこぎり波の値を返すので、プロットするxの値をずらして、
ずらしたxの値とsawtoothの値を対応させればちょうどご質問のようなデータを作成できると思ったのですがいかがでしょうか。例えば下のコードだと、pi/2分ずらすことができている気がします...
clear;clc;close all
fundamentalFrequency=1/2;%unit:Hz
numWave=4;
T = numWave*(1/fundamentalFrequency)*pi;%T repreesents the x value to terminate
fs = 100;% number of plots
t = 0:T/fs:T-1/fs;
PhaseShift=1/2*pi;
x = sawtooth(t);
figure;
plot(t,x);hold on;plot(t-PhaseShift,x-2)
set(gca,'XTick',0:2*pi:8*pi)
set(gca,'XTickLabel',{'0','2pi','4pi','6pi','8pi'})
grid on
  2 Comments
Musashi Ito
Musashi Ito on 25 Feb 2020
Kenta さん、Akira Agata さん、回答ありがとうございます。位相シフトすることができました。

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!