필터 지우기
필터 지우기

Can someone help me with the square wave plot here?

조회 수: 4 (최근 30일)
TBiggs
TBiggs 2023년 1월 19일
댓글: TBiggs 2023년 1월 19일
I've outlined most of my code below, but I'm having issues getting my plot to display the correct time scale.
Any help would be appreciated!
function funPulseTrainPlot(N,T,D,A)
clc
t = linspace(0,T,N*T);% create time vector
x = A*square(t/T*2*pi, D);% create pulse train signal
plot(t, x);
%xlim([0 40]);
xlabel('Time (sec)');
ylabel('Amplitude');
title(['Pulse Train with N = ' num2str(N) ', D = ' num2str(D) ', A = ' num2str(A) ', T = ' num2str(T) ' sec']);
end

답변 (1개)

prasanth s
prasanth s 2023년 1월 19일
T=12;
N=3;
D=25;
A=3;
t= 0:0.001:1;
x = A*((1+square(2*pi*N*t,D))/2);
t2=t*T*N;
plot(t2, x);
  댓글 수: 1
TBiggs
TBiggs 2023년 1월 19일
Thank you, this was very close to what I was trying to do!

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 MATLAB에 대해 자세히 알아보기

태그

제품


릴리스

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by