ํ•„ํ„ฐ ์ง€์šฐ๊ธฐ
ํ•„ํ„ฐ ์ง€์šฐ๊ธฐ

Inputting signal at teager energy equation

์กฐํšŒ ์ˆ˜: 9 (์ตœ๊ทผ 30์ผ)
Sadi M Jawad Ahsan
Sadi M Jawad Ahsan 2022๋…„ 5์›” 20์ผ
๋‹ต๋ณ€: Sai Pavan 2024๋…„ 1์›” 24์ผ
Question:
4. Here we use Teagerโ€™s energy tracker instead. For an input signal ๐‘ (๐‘˜) sampled at ๐‘ก = ๐‘˜๐‘‡s, Teagerโ€™s tracker computes
๐‘‡(๐‘˜) = ๐‘ (๐‘˜)^2 โˆ’ ๐‘ (๐‘˜ + 1)๐‘ (๐‘˜ โˆ’ 1).
Plot ๐‘‡0(๐‘˜), which is ๐‘‡(๐‘˜) when ๐‘ (๐‘˜) = ANS, and ๐‘‡1(๐‘˜), which is when ๐‘ (๐‘˜) = ANSam. Also plottheir Fourier transforms. Confirm that ๐‘‡0(๐‘˜) is a d.c. signal and ๐‘‡1(๐‘˜) is a d.c. plus a tone. What is the frequency of the tone?
Code:
function [ey,ex]=energyop(sig,gr)
%% %calculates the energy operator of a signal
%% %input
1. Raw signal (Vector)
2. gr (Plot or not plot)
%% %Output
Energy operator signal (ey)
Teager operator (ex)
%%
if nargin<2
gr=0;
end
sig=sig(:);
%% (x(t)) = (dx/dt)^2+ x(t)(d^2x/dt^2)
%Operator 1
y=diff(sig);
y=[0;y];
squ=y(2:length(y)-1).^2;
oddi=y(1:length(y)-2);
eveni=y(3:length(y));
ey=squ - (oddi.*eveni);
%% [x[n]] = x^2[n] - x[n - 1]x[n + 1]
%operator ex
squ1=sig(2:length(sig)-1).^2;
oddi1=sig(1:length(sig)-2);
eveni1=sig(3:length(sig));
ex=squ1 - (oddi1.*eveni1);
ex = [ex(1); ex; ex(length(sig)-2)]; %make it the same length
%% plots
if gr
figure,ax(1)=subplot(211);plot((sig/max(sig))-mean(sig/max(sig)),'b'),
hold on,
plot((ey/max(ey))-mean(ey/max(ey)),'Linewidth',2,'LineStyle','--','color','r'),
axis tight;
hleg1=legend('Original Signal','Energy Operator');
set(hleg1,'Location','NorthWest')
ax(2)=subplot(212);plot((sig/max(sig))-mean(sig/max(sig)),'b'),
hold on,
plot((ex/max(ex))-mean(ex/max(ex)),'Linewidth',2,'LineStyle','--','color','g'),
hleg2=legend('Original Signal','Teager Energy');
set(hleg2,'Location','NorthWest')
axis tight,
zoom on;
linkaxes(ax,'x');
end
How to input my signals here???

๋‹ต๋ณ€ (1๊ฐœ)

Sai Pavan
Sai Pavan 2024๋…„ 1์›” 24์ผ
Hello,
I understand that you want to know how to input a signal into the Teager energy function 'energyop'.
The 'energyop' function needs to be called with the input signal as the first argument 'sig'. The second argument 'gr' is optional and controls whether or not the function will plot the results. The results can be plotted by setting the 'gr' parameter to 1.
Please refer to the below code snippet illustrating the procedure to input a DC signal and an amplitude modulated signal into the 'energyop' function and plotting it by setting the second argument of the function to 1:
% Define signal parameters
A = 1; % Amplitude of the carrier signal
a = 1; % Amplitude of the message signal
N = 1000; % Number of samples
m = 1; % Frequency of the message signal in Hz
S = 5; % Carrier frequency of the signal in Hz
fs = 100; % Sampling frequency in Hz
t = (0:N-1)/fs; % Time vector
% Create the signals
s0 = A * ones(size(t)); % DC signal
s1 = A * (1 + a * cos(2 * pi * m * t)) .* cos(2 * pi * S * t); % Amplitude modulated signal
% Use energyop function
[ey0, ex0] = energyop(s0, 1); % For the DC signal
[ey1, ex1] = energyop(s1, 1); % For the amplitude modulated signal
Hope it helps!

์นดํ…Œ๊ณ ๋ฆฌ

Help Center ๋ฐ File Exchange์—์„œ Spectral Measurements์— ๋Œ€ํ•ด ์ž์„ธํžˆ ์•Œ์•„๋ณด๊ธฐ

ํƒœ๊ทธ

Community Treasure Hunt

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

Start Hunting!

Translated by