You are on page 1of 2

clc;

close all;
clear all;
plot(t,x);
y1=t.*(t>=0);
y2=-(t-1).*(t>=1);
y3=-(t>=1);
y=y1+y2+y3;
plot(t,y)
t1=-5:0.001:5;
z1=(t1-1).*(t1>=1);
z2=-2*(t1-2).*(t1>=2);
z3=(t1-3).*(t1>=3);
z=z1+z2+z3;
plot(t1,z)
a1=t.*(t>=0);
a2=-(t-1).*(t>=1);
a=a1+a2;
plot(t,a)
a1=t1.*(t1>=0);
a2=-(t1-1).*(t1>=1 & t1<=2);
a=a1+a2;
plot(t1,a)
p=-(t1-1).*(t1>=1);
>> plot(t1,p)
>> p1=t1.*(t1>=0);
>> p2=-(t1>=2);
>> p3=p+p1+p2;
>> plot(t1,p3)

>>
>>
>>
>>

n=-3:4;
x=[2 4 1 5 3 1 3 2];
x1=fliplr(x);
x1

x1 =
2

>> n1=-fliplr(n);
>> m=min(min(n),min(n1)):max(max(n),max(n1));
>> y1=zeros(1,length(m));
>> y2=y1;
>> y1(find((m>=min(n) & m<=max(n)==1))=x1;
??? y1(find((m>=min(n) & m<=max(n)==1))=x1;
|
Error: The expression to the left of the equals sign is not a valid target for a
n assignment.
>> y1(find((m>=min(n) && m<=max(n)==1))=x1;
??? y1(find((m>=min(n) && m<=max(n)==1))=x1;

|
Error: The expression to the left of the equals sign is not a valid target for a
n assignment.
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>

y1(find((m>=min(n)) & (m<=max(n))==1))=x1;


y2(find((m>=min(n1)) & (m<=max(n1))==1))=x1;
y1(find((m>=min(n)) & (m<=max(n))==1))=x;
e=(y1+y2)/2;
o=(y1-y2)/2;
z=e+o;
subplot(2,1,1)
plot(n,x)
subplot(2,1,2)
plot(m,z)
subplot(2,1,1)
stem(n,x)
subplot(2,1,2)
stem(m,z)

You might also like