help me to write a code for processing an audio signal using taylor series

9 views (last 30 days)
clc;
clear all;
[x,Fs] = audioread('audioe.wav');
sound(x,Fs);
whos x
disp(Fs)
x = x(:,1);
dt = 1/Fs;
t = 0:dt:(length(x)*dt)-dt;
figure(1)
plot(t,x); xlabel('Seconds'); ylabel('Amplitude');
h = spectrum.periodogram; % create a periodogram spectral estimator.
figure(2)
psd(h,x,'Fs',Fs); % Calculates and plots the two-sided PSD.
%plot(psd(spectrum.periodogram,x,'Fs',Fs,'NFFT',length(x)));
y = interp(x,4);%resample data at a higher rate using lowpass interpolation
%[y, ty] = resample(x,t,Fs);
%y =resample(x,3,2);
figure(3)
subplot(211);
stem(x);
title('Original Signal');
subplot(212);
stem(y);
title('Interpolated Signal');
SNR = snr(x);
SNR1 = snr(y);
a=2;
N =2;
z = taylor(x,a,N);
plot(z);
  3 Comments
Elavarasi E
Elavarasi E on 20 Sep 2019
i need to sum up three different dimensions, which is in taylor series. this is in matrix and the equation is :
(x+h) = x + (h.*diff(x)) + (h^2.*diff(x,2))./factorial(2);
(x+h) is of same length of 'x' while first derivative is one lessthan 'x' and second derivative is of two lessthan of 'x'.
Elavarasi E
Elavarasi E on 28 Sep 2019
In an audio signal, I need to find the intermediate samples. To read the intermediate I make use of taylor series. Audio signal is read thro’ [x,Fs] = audioread('audioe.wav');
The taylor series am using is f(x+h) = f(x) + hf’(x) + h2f’’(x)/2! .
Were f(x) is ‘x’ . Accordingly f(x+h) should be x(t)+h but this doesn’t work. ‘h’ is some intermediate value.
clc;
close all;
clear all;
[x,Fs] = audioread('audioe.wav');
sound(x,Fs);
whos x
disp(Fs)
x= x(:,1);
dt = 1/Fs;
t = 0:dt:(length(x)*dt)-dt;
figure(1)
plot(t,x);
xlabel('Seconds');
ylabel('Amplitude');
dx = gradient(x);
dx2 = gradient(dx);
for t = 0:dt:(length(x)/4*dt)-dt
for x = 0:dt:(length(x)/4*dt)-dt
h = 0.347;
y(t+h) = x + (h.*dx) + (h^2.*dx2)./factorial(2);
end
end
figure(2)
% hold on
plot(t,x,'blue',t,y, 'red')
% hold off
legend('actual','taylorseries')
for loop doesnt work

Sign in to comment.

Accepted Answer

darova
darova on 20 Sep 2019
Try gradient instead of diff
dx = gradient(x);
dx2 = gradient(dx);
result = x + (h.*dx) + (h^2.*dx2)./factorial(2);
  21 Comments
Elavarasi E
Elavarasi E on 23 Oct 2019
hi !
let 'n' be a sequence. it should be broken down into samples of length 1024.
i.e n/1024 = y spectrum.
i should plot this 'y' spectrum as overlapped spectrums with an overlap of 48 samples on each spectrum. the last spectrum can be padded with zeroes at the last.

Sign in to comment.

More Answers (0)

Categories

Find more on Signal Generation and Preprocessing in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!