フィルターのクリア

how to create a triangle wave in matlab?

92 ビュー (過去 30 日間)
Ningyi Liu
Ningyi Liu 2017 年 11 月 9 日
回答済み: Simon Leary 2022 年 4 月 11 日
How do I plot "a triangle wave with frequency of 1 kHz that's 3 V peak-to-peak with a minimum voltage of 0 volts" in matlab?
I attached the excel graphs that is my simulation plot and measured plot, the theoretical graph created from Matlab should look similar to it.

回答 (3 件)

Simon Leary
Simon Leary 2022 年 4 月 11 日
function output = triangle(t, period, amplitude)
% sawtooth uses amplitude of time array to get period
% multiply t by 2pi, divide by your desired period
t1 = t*2*pi/period;
% 0.5 is the fraction of the period where sawtooth peaks, I think
output = sawtooth(t1, 0.5);
% default range of sawtooth is -1 to 1, add 1 to get 0 to 2
% then divide by 1 to get 0 to 1
output = (output + 1)/2;
output = output*amplitude;
end

Image Analyst
Image Analyst 2017 年 11 月 9 日

Eyad Samaan
Eyad Samaan 2018 年 3 月 19 日
V=10; f0=1; w0=2*pi*f0; T=1/f0; T1=T/2; T2=1-T/2; f1=1/T1; f2=1/T2; d=1/2; dT=T/512; t1=0:dT: d* T-dT ; t2=d*T:dT: T-dT; t=[t1 t2]; figure; v1= V * triangle ( 2* pi* f1*t1 ); v2=-V*triangle (2*pi*f2*t2);

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by