# This is my attempt to generate and plot this signal .. which one of these is right? .. please help

조회 수: 2(최근 30일)
Rama a 2021년 6월 5일
편집: Rama a 2021년 6월 5일
This is my attempt to generate and plot this signal
x (t)=π[(t -3)/A ]+π[(t -C) /B]
A = 3, B = 4 and C = 4.
syms X t;
y1 =rectangularPulse(t-3\3); %pi(t-3\3)
y2 =rectangularPulse(t-4\4); %pi(t-4\4)
x=y1+y2;
fplot(x); %to make (2*2)figure ezplot(x,[0 20 0 10]); %to plots the signal
title('X2(t) = pi( ( t-3 ) /3 )+ pi( ( t-4) /4 ) '); %to make title for figure
xlabel('t');
ylabel('X(t)');
grid on; % ****************************************
syms t
A=3
A = 3
B=4
B = 4
C=4
C = 4
t= 0: 0.02:5;
u=t>= 3+0.5*A;
u1=t>= 3-0.5*A;
u2=t>= C+0.5*B;
u3=t>= C-0.5*B;
X= u-u1+u2-u3;
plot(t,X) ##### 댓글 수: 1표시숨기기 없음
Could you show how the result should look like?

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

### 채택된 답변

A = 3;
[B, C] = deal(4);
u = @(t) t >= 3 + 0.5 * A;
u1 = @(t) t >= 3 - 0.5 * A;
u2 = @(t) t >= C + 0.5 * B;
u3 = @(t) t >= C - 0.5 * B;
X = @(t) u(t) - u1(t) + u2(t) - u3(t);
fplot(X) ##### 댓글 수: 2표시숨기기 이전 댓글 수: 1
Rama a 2021년 6월 5일
thanks !

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

### Community Treasure Hunt

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

Start Hunting!