Write this without a for loop?

for c= delaySamples+1:length(audioVec)
EchoVec(c)=audioVec(c)+z(c-(delaySamples)*EchoGain);
end

4 comentarios

Andrei Bobrov
Andrei Bobrov el 3 de Mzo. de 2019
Editada: Andrei Bobrov el 3 de Mzo. de 2019
What is z, EchoGain?
Michelle
Michelle el 3 de Mzo. de 2019
heres the entire code for my function
function EchoVec=soundEcho(audioVec,Fs,delay,EchoGain)
EchoGain=input('enter how loud echo should be:');
delay=input('enter in a delay value in seconds:');
delaySamples=Fs*delay;
z=[zeros(1,delaySamples),audioVec'];
audioVec(length(delaySamples))=0;
for c= delaySamples+1:length(audioVec)
EchoVec(c)=audioVec(c)+z(c-(delaySamples)*EchoGain);
end
sound(EchoVec,Fs);
end
madhan ravi
madhan ravi el 3 de Mzo. de 2019
Editada: madhan ravi el 3 de Mzo. de 2019
when a third person runs your code (it is not possible to run) , nobody has the power to know what is in your computer
Walter Roberson
Walter Roberson el 15 de Nov. de 2020
Michelle, if you feel that the question is unclear, then as you are the person who posted the question, you should be the one who clarifies it to make it more clear.

Iniciar sesión para comentar.

Respuestas (1)

Alex Mcaulley
Alex Mcaulley el 4 de Mzo. de 2019
If audioVec is a column array and you ensure that (delaySamples)*EchoGain is a valid index:
c = delaySamples+1:length(audioVec);
EchoVec(delaySamples+1:length(audioVec))=audioVec(delaySamples+1:end)+z(c-(delaySamples)*EchoGain);

Categorías

Más información sobre Entering Commands en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 3 de Mzo. de 2019

Comentada:

el 15 de Nov. de 2020

Community Treasure Hunt

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

Start Hunting!

Translated by