Sum function discrite time

1 回表示 (過去 30 日間)
alp onur karacay
alp onur karacay 2021 年 3 月 18 日
コメント済み: Walter Roberson 2021 年 3 月 19 日
hello guys, i am beginner, i try to solve this however just did this equation and no more y3 = symsum(x,k,1000,6000);
Thank for your support
  1 件のコメント
Walter Roberson
Walter Roberson 2021 年 3 月 19 日
In practice, you cannot use symsum() for recursive formulas: if x[n] is defined in terms of x[previous value] then you will need to define the output through iteration. symsum() is only for cases where you can define each individual element according to a formula that can be computed without computing the previous entries.
Also, you can never use a symbolic variable as a subscript, so you cannot use symsum() with subscripting. It is not for example possible to do
X = randi(9, 1, 10);
syms n
symsum(gamma(X(n)), n, 1, 10) %NOT LEGAL
Instead you should take the different definite values and sum them:
sum(gamma(X))

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

回答 (1 件)

Mathieu NOE
Mathieu NOE 2021 年 3 月 19 日
hello
this is an example of echo simulation - please adapt to your parameters
hope it helps
clear all;
close all;
infile='DirectGuitar.wav';
outfile='out_echo.wav';
% read the sample waveform
[x,Fs] = audioread(infile);
% normalize x to +/- 1 amplitude
x = x ./ (max(abs(x)));
% parameters
N_delay=20; % delay in samples
C = 0.7; % amplitude of direct sound
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
y = zeros(length(x),1); % create empty out vector
y(1:N_delay)=x(1:N_delay); % to avoid referencing of negative samples
% for each sample > N_delay
for i = (N_delay+1):length(x)
y(i) = C*x(i) + (1-C)*(x(i-N_delay)); % add delayed sample
end
% write output
% normalize y to +/- 1 amplitude
y = y ./ (max(abs(y)));
audiowrite(outfile, y, Fs);
figure(1)
hold on
plot(x,'r');
plot(y,'b');
title('Echoed and original Signal');
sound(y,Fs);

カテゴリ

Help Center および File ExchangeAudio I/O and Waveform Generation についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by