function in MATLAB that will take a sequence x[n], and shift it to the left or to the right by a given number of samples. use the function written to find the sum of the results obtained by shifting x[n] to the right by 2 samples and and obtained by shifting x[n] to the left by 2 samples. kindly provide the codes🙏
Check this video please-->Signal addition in MATALB ruclips.net/video/cHb8Gsk2fFQ/видео.html Now if you have the original signal and shifted one , you can add simply :-) For example , in the above case , if you want to add , the code will be like this--> n1=0:4; x=[0 1 2 3 3]; n2=n1-2; y=x; u=min(min(n1),min(n2)); t=max(max(n1),max(n2)); r=u:1:t; z1=[]; temp=1; for i=1:length(r) if(r(i)max(n1)) z1=[z1 0]; else z1=[z1 x(temp)]; temp=temp+1; end end z2=[]; temp=1; for i=1:length(r) if(r(i)max(n2)) z2=[z2 0]; else z2=[z2 y(temp)]; temp=temp+1; end end z=z1+z2; subplot(3,1,1); stem(r,z1); subplot(3,1,2); stem(r,z2); subplot(3,1,3); stem(r,z);
@@werewolfwaghela752 This is the code--> n1=-4:4; x=(n1>=0); n2=n1+1; y=x; u=min(min(n1),min(n2)); t=max(max(n1),max(n2)); r=u:1:t; z1=[]; temp=1; for i=1:length(r) if(r(i)max(n1)) z1=[z1 0]; else z1=[z1 x(temp)]; temp=temp+1; end end z2=[]; temp=1; for i=1:length(r) if(r(i)max(n2)) z2=[z2 0]; else z2=[z2 y(temp)]; temp=temp+1; end end z=z1+z2; subplot(3,1,1); stem(r,z1); subplot(3,1,2); stem(r,z2); subplot(3,1,3); stem(r,z);
I have explained in the video as N+2 but later I have shown the reverse case too , so for that I have used n-2 , watch the whole video please and then comment :-)
@@ninaddevdas6953 please watch the figure at 3:56 , I have done that ony , N-2 means delaying the signal , which means signal should move towards the positive axis , to timplement that in MATLAB , you have to write m=n+2
You have done a good job, Very easily you have explained it. Very well Done buddy Keep up the good work and Keep Educating people. Best Wishes
Thank You Arpit , Happy Learning:-)
function in MATLAB that will take a sequence x[n], and shift it to the left or to the right by a given number of samples. use the function written to find the sum of the results obtained by shifting x[n] to the right by 2 samples and and obtained by shifting x[n] to the left by 2 samples. kindly provide the codes🙏
Sir If I have the signal like y(n)=x(n-5)-x(n+2) what will be the code
Hi knowledge. Thank you for the informative video. Can you show how to make an animation of a time shift?
Sure , I will make one video on this topic , Stay tuned :-)
Bro I want to do shifting by getting input from user
How to add the original and the shifted signal
Check this video please-->Signal addition in MATALB
ruclips.net/video/cHb8Gsk2fFQ/видео.html
Now if you have the original signal and shifted one , you can add simply :-)
For example , in the above case , if you want to add , the code will be like this-->
n1=0:4;
x=[0 1 2 3 3];
n2=n1-2;
y=x;
u=min(min(n1),min(n2));
t=max(max(n1),max(n2));
r=u:1:t;
z1=[];
temp=1;
for i=1:length(r)
if(r(i)max(n1))
z1=[z1 0];
else
z1=[z1 x(temp)];
temp=temp+1;
end
end
z2=[];
temp=1;
for i=1:length(r)
if(r(i)max(n2))
z2=[z2 0];
else
z2=[z2 y(temp)];
temp=temp+1;
end
end
z=z1+z2;
subplot(3,1,1);
stem(r,z1);
subplot(3,1,2);
stem(r,z2);
subplot(3,1,3);
stem(r,z);
Just can u just tell me the code for
U(n)+u(n-1) .
@@KnowledgeAmplifier1 plzz help
@@werewolfwaghela752 This is the code-->
n1=-4:4;
x=(n1>=0);
n2=n1+1;
y=x;
u=min(min(n1),min(n2));
t=max(max(n1),max(n2));
r=u:1:t;
z1=[];
temp=1;
for i=1:length(r)
if(r(i)max(n1))
z1=[z1 0];
else
z1=[z1 x(temp)];
temp=temp+1;
end
end
z2=[];
temp=1;
for i=1:length(r)
if(r(i)max(n2))
z2=[z2 0];
else
z2=[z2 y(temp)];
temp=temp+1;
end
end
z=z1+z2;
subplot(3,1,1);
stem(r,z1);
subplot(3,1,2);
stem(r,z2);
subplot(3,1,3);
stem(r,z);
@@KnowledgeAmplifier1 thanks 😁
sorry to say but it is wrong N+2 means advancing the signal which means the signal should move to the opposite side as shown in your video
I have explained in the video as N+2 but later I have shown the reverse case too , so for that I have used n-2 , watch the whole video please and then comment :-)
N-2 means delaying the signal in which the signal should move towards the positive axis But it is opposite in your video
you can take Signal and System by nagoor kani as reference
@@ninaddevdas6953 please watch the figure at 3:56 , I have done that ony , N-2 means delaying the signal , which means signal should move towards the positive axis , to timplement that in MATLAB , you have to write m=n+2
@@ninaddevdas6953 ya , you check the figure at 3:56 and verify whether it is correct or not
n-2 means advance and n+2 means delay..
No the reverse one correct , check the theory properly
ruclips.net/video/gMYNwG_aWxQ/видео.html
Don't get confused :-)
It is wrong
No for sure , it's correct :-)