Clear Filters
Clear Filters

Sum function discrite time

2 views (last 30 days)
alp onur karacay
alp onur karacay on 18 Mar 2021
Commented: Walter Roberson on 19 Mar 2021
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 Comment
Walter Roberson
Walter Roberson on 19 Mar 2021
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))

Sign in to comment.

Answers (1)

Mathieu NOE
Mathieu NOE on 19 Mar 2021
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);

Tags

Community Treasure Hunt

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

Start Hunting!