이 질문을 팔로우합니다.
- 팔로우하는 게시물 피드에서 업데이트를 확인할 수 있습니다.
- 정보 수신 기본 설정에 따라 이메일을 받을 수 있습니다.
help me to write a code for processing an audio signal using taylor series
조회 수: 3 (최근 30일)
이전 댓글 표시
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
Elavarasi E
2019년 9월 20일
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
2019년 9월 28일
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
채택된 답변
darova
2019년 9월 20일
Try gradient instead of diff
dx = gradient(x);
dx2 = gradient(dx);
result = x + (h.*dx) + (h^2.*dx2)./factorial(2);
댓글 수: 21
Elavarasi E
2019년 9월 23일
this is my code to read an audio signal
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');
h = 0.347;
dx = gradient(x);
dx2 = gradient(dx);
for t1 = 0:dt:(length(x)*dt)-dt
(x+h) == x + (h.*dx) + (h^2.*dx2)./factorial(2);
end
figure(2)
hold on
plot(t,x,'blue',t1(:,1:length(x+h)),(x+h), 'red')
hold off
legend('actual','taylorseries')
the lengths same now. but, the for loop does not excecute nor do it shows me any error except doble equal sign. the second figure does appear at all.
darova
2019년 9월 23일
What does it mean?
for t1 = 0:dt:(length(x)*dt)-dt
(x+h) == x + (h.*dx) + (h^2.*dx2)./factorial(2);
end
Elavarasi E
2019년 9월 23일
am equating the time t1 to t which nothing but dt . in this for loop i get an error wrt equal sign
Elavarasi E
2019년 9월 23일
i need to process the read audio signal through taylor series. the length of the fine processed audio signal will be same as that of the actual signal. so i use a 'for' loop as the length of time 't' and plot the fine processed signal wrt 't'. but the for loop is not exceuting nor does it show me any error.
Elavarasi E
2019년 9월 23일
the only error it shows is about equal sign n it guides me to use double equal sign.
Elavarasi E
2019년 9월 23일
f(x+h) = f(x) + hf'(x) + h^2f''(x)/2!
i need to find the intermediate value of f(x) at instance z = x+dt where both time n signal are variable.
darova
2019년 9월 23일
Please show the error occurs and why it guides you to use double sign
Why it doesn't work?
result = x + (h.*dx) + (h^2.*dx2)./factorial(2);
Elavarasi E
2019년 9월 28일
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.
this my modified code again does not work for the "for" loop
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')
Elavarasi E
2019년 9월 30일
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');
for t = 1:dt:(length(x)/4*dt)-dt
for k = 1:length(x)/32
dx(k) = gradient(x(k));
dx2(k) = gradient(dx(k));
h = 0.347;
y(t+h) = x(k) + (h.*dx(k)) + (h^2.*dx2(k))./factorial(2);
end
end
figure(2)
% hold on
plot(t,x,'blue',t,y, 'red')
% hold off
legend('actual','taylorseries')
Results :
Name Size Bytes Class Attributes
x 2395137x2 38322192 double 44100
Array indices must be positive integers or logical values.
Error in eaudiodiff (line 24)
y(t+h) = x(k) + (h.*dx(k)) + (h^2.*dx2(k))./factorial(2);
1) guide me to solve theabove error.
2) when i execute these statements individually on comment window
k = 1:length(x)/32
dx(k) = gradient(x(k))
dx2(k) = gradient(dx(k))
h = 0.347
y(t+h) = x(k) + (h.*dx(k)) + (h^2.*dx2(k))./factorial(2)
I get an error as memoryspace exceeded.
darova
2019년 9월 30일
I don't have your data so i generated some random
n = 100;
Fs = 2000;
dt = 1/Fs;
t = 0:dt:(n*dt)-dt;
x = 0.05*sin(2000*t) + cos(100*t); % random data
dx = gradient(x);
dx2 = gradient(dx);
h = 0.347;
x1 = x + h.*dx + h^2.*dx2./factorial(2);
plot(t,x,'blue',t,x1, '.r')
legend('actual','taylorseries')
xlabel('Seconds');
ylabel('Amplitude');
And here are the results


Slightly differs is it?
Elavarasi E
2019년 10월 1일
Appreciate your kindness. Ya it differs. Actually I have to process it on any audio signal.
when I execute the entire code I get these errors
Array indices must be positive integers or logical values.
Error in eaudiodiff (line 24)
y(t+h) = x(k) + (h.*dx(k)) + (h^2.*dx2(k))./factorial(2);
1) guide me to solve the above error.
2) when i execute these statements individually on comment window
k = 1:length(x)/32
dx(k) = gradient(x(k))
dx2(k) = gradient(dx(k))
h = 0.347
I get the correct values but when the below equation is executed
y(t+h) = x(k) + (h.*dx(k)) + (h^2.*dx2(k))./factorial(2)
I get an error as memoryspace exceeded.
need to rectify these two errors.
Elavarasi E
2019년 10월 1일
ur code is correct but its only for one instance at x1, which should actually be x+h, i.e x1 = (x+h). i need to evaluate it for all the values of x displaced by the instance 'h' wrt to 't'.
i.e., y(t+h) = x(k) + (h.*dx(k)) + (h^2.*dx2(k))./factorial(2)
y(0+h) is the output at instance x(0). were x(0) is calculated using taylor series. this has to repeat for all 't'.
darova
2019년 10월 1일
Maybe try this
result = x + (h.*dx) + (h^2.*dx2)./factorial(2);
result = result + h;
% result = result - h;
Elavarasi E
2019년 10월 2일
Very much appreciate your prompt response.
here I need to find the value at instance (t+h) but result = result + h will give me output + h and not output at time (t+h).
i.e if output is 20 , t= 5 and h = 0.112
as per result = result + h; i'll get the result as 20.112 at time t = 5 but at the instance t = 5.112 it will be some 'xx' value.
I need this 'xx' value. this can be done only by varying both time and amplitude.
darova
2019년 10월 2일
So add it to t
x1 = x + (h.*dx) + (h^2.*dx2)./factorial(2);
t1 = t + h;
plot(t,x,t1,x1)
Elavarasi E
2019년 10월 23일
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.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Audio Processing Algorithm Design에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!오류 발생
페이지가 변경되었기 때문에 동작을 완료할 수 없습니다. 업데이트된 상태를 보려면 페이지를 다시 불러오십시오.
웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom(English)
아시아 태평양
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)