フィルターのクリア

Even and Odd parts

92 ビュー (過去 30 日間)
zee
zee 2013 年 11 月 18 日
コメント済み: Mashhood Saeed 2021 年 11 月 18 日
Function that gives the even and the odd parts of any given signal
  1 件のコメント
Mashhood Saeed
Mashhood Saeed 2021 年 11 月 18 日
n=-5:5;
yn= 0*(n<0)+1*(n==0)+1*(n>0);
yflip=fliplr(yn);
subplot(3,1,1);
stem(n,yn,'r');
title('plot of yn');
xlabel('time');
ylabel('yn');
ye = (1/2)*(yn+yflip);
subplot(3,1,2);
stem(n,ye,'b');
title('plot of even');
xlabel('time');
ylabel('y even');
yo= (1/2)*(yn-yflip);
subplot(3,1,3);
stem(n,yo);
title('plot of odd');
xlabel('time');
ylabel('y odd');

サインインしてコメントする。

回答 (8 件)

Azzi Abdelmalek
Azzi Abdelmalek 2013 年 11 月 18 日
t=-10:10; %vector time
x=rand(1,numel(t)); % Your signal
xmt=[fliplr(x(t>=0)) fliplr(x(t<0))]
xe=0.5*(xmt+x)
xo=0.5*(x-xmt)
subplot(3,1,1);
plot(t,x);
title('Your signal x')
subplot(3,1,2);
plot(t,xe);
title('Even part')
subplot(3,1,3);
plot(t,xo);
title('Odd part')
  2 件のコメント
suhaib Dawood
suhaib Dawood 2016 年 9 月 23 日
If you have heaviside function what to do to find the even and odd portion ?
JUGAL SUGGALA 17BEC0423
JUGAL SUGGALA 17BEC0423 2018 年 8 月 30 日
Please can you explain each command or function briefly, how it is working as i am not able to understand the code.

サインインしてコメントする。


Siddharth Mishra
Siddharth Mishra 2019 年 11 月 4 日
clc;
clear all;
close all;
x=input("enter the values");
n=0:length(x)-1;
n1=(1-length(x))*0.5:(length(x)-1)*0.5;
y=flip(x);
y
x
x_e=(x+y)*0.5;
x_e
x_o=(x-y)*0.5;
x_o
subplot(311)
stem(n1,x);
title('ACTUAL SIGNAL');
subplot(312)
stem(n1,x_e);
title('EVEN SIGNAL');
subplot(313)
stem(n1,x_o);
title('ODD SIGNAL');

Sean de Wolski
Sean de Wolski 2013 年 11 月 18 日
signal = rand(1000,1);
even = signal(2:2:end);
odd = signal(1:2:end);
Like this?
  1 件のコメント
zee
zee 2013 年 11 月 18 日
編集済み: zee 2013 年 11 月 18 日
i don't think so , what i meant by even and odd is like this , assume you have x(t) = x the even part is xe(t) = 1/2 * (x(t) + x(-t)) and the odd part is xo(t) = 1/2 * (x(t) - x(-t))
now how i get these from matlab functions ?!

サインインしてコメントする。


Sandeep Maurya
Sandeep Maurya 2017 年 9 月 7 日
n=-10:15; x=[zeros(1,10) ones(1,10) zeros(1,0)]; m=fliplr(n); m1=min([m,n]); m2=max([m,n]); n1=1:length(n); x1=zeros(1,length(m)); x1(n1+nm)=x: x=x1; xe=0.5*(x+fliplr(x)); xo=0.5*(x-fliplr(x)); figure; t=-15:15; subplot(3,1,1);stem(t,x); axis([-15 15 0 1.5]); title('ORIGINAL SIGNAL'); subplot(3,1,2); stem(t,xe); title('Even signal X(n)'); subplot(3,1,3); stem(t,xo); axis([-15 15 -1 1]); xlabel('-----Time-----'); ylabel('--Amplitude--'); title('Odd part of signal');
  1 件のコメント
Walter Roberson
Walter Roberson 2019 年 11 月 4 日
The phrase
x1(n1+nm)=x: x=x1
is invalid. It would probably be valid if a semi-colon were used instead of a colon.

サインインしてコメントする。


Christian Stoddard
Christian Stoddard 2019 年 2 月 10 日
myeven = @(x) (1/2)*(myfun(x)+myfun(-x));
myodd = @(x) (1/2)*(myfun(x)-myfun(-x));

sushma medabalimi
sushma medabalimi 2019 年 8 月 29 日
tmin=-10; dt=0.1; tmax=10;
t=tmin:dt:tmax;
a = 2;
% Generate exponential signal
x1 = exp(a*t);
%Perform time reversal operation
x2 = exp(-a*t);
%Condition to check odd signal
if(x2==x1)
disp('The given signal is even signal')
else if (x2==(-x1))
disp('The given signal is an odd signal')
else
disp('The given signal is neither even nor odd signal')
end
end

Kshitiz
Kshitiz 2019 年 10 月 4 日
clc;
close all;
clear all;
prompt = 'Enter the values';
x=input(prompt)
x_dash=flip(-x);
t1=0:1:length(x)-1;
t1_dash=flip(-t1);
for i=1:length(x)
odd(i)=x_dash(i)/2;
end
for i=2:length(x)
odd(i+length(x))=x(i)/2;
end
odd(length(x))=0;
for i=1:length(x)
t(i)=t1_dash(i);
end
for i=1:length(x)
t(i+length(x))=t1(i);
end
length(t)
length(odd)
subplot(311)
stem(t,odd)
xlim([-10 10])
title('ODD SIGNAL');
x_dash=flip(x);
t1=0:1:length(x)-1;
t1_dash=flip(-t1);
for i=1:length(x)
odd(i)=x_dash(i)/2;
end
for i=1:length(x)
odd(length(x))=x(i)/2;
end
odd(length(x)+1)=x(1);
for i=1:length(x)
t(i)=t1_dash(i);
end
for i=1:length(x)
t(length(x))=t1(i);
end
length(t)
length(odd)
length(odd)
subplot(312)
stem(t,odd)
xlim([-10 10])
title('EVEN SIGNAL');
subplot(313)
stem(t1,x)
xlim([-10 10])
title('ACTUAL SIGNAL')

MD asgar
MD asgar 2020 年 7 月 18 日
Consider the discrete function x=4*sin(t)+2*cos(t), Write the Matlab code to evaluate the odd even part of Y and plot the subplots in a single plot.

カテゴリ

Help Center および File ExchangeDenoising and Compression についてさらに検索

タグ

タグが未入力です。

Community Treasure Hunt

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

Start Hunting!

Translated by