MATLAB Answers

Write this without a for loop?

1 view (last 30 days)
Michelle
Michelle on 3 Mar 2019
Commented: Walter Roberson on 15 Nov 2020
for c= delaySamples+1:length(audioVec)
EchoVec(c)=audioVec(c)+z(c-(delaySamples)*EchoGain);
end
  4 Comments
Walter Roberson
Walter Roberson on 15 Nov 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.

Sign in to comment.

Answers (1)

Alex Mcaulley
Alex Mcaulley on 4 Mar 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);

Community Treasure Hunt

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

Start Hunting!