Asked • 07/12/19

Matlab - Iterating through an array and appending to a new one?

I got an array that is a audio recording, and I'd like to add some noise on it so later I can remove it in Simulink and compare the original to the one that I removed the noise. My problem is that I'm pretty new to Matlab's languages/functions, so I got stucked in a for loop that I didnt understand how It works properly in Matlab. I got this huge array (voice recorded): voice = [0.0012 0.0012; 0.0003 0.0005; (....) (....);] And what I'd like to do is to add some values to each line, so it will be noisy (another array): noise = [0.0142 0.0143] To do It I would do line by line in python with a pseudo code like this: new_audio = [] for line in voice: new_line = (line+noise) new_audio.append(new_line) I need to keep the original so I can compare later. Could you guys give me a hand on it? I'd love to know how to make it happen in Matlab. Obs: (This is also me trying to update an oldcode from my teacher so It works in new Matlab for other students)

1 Expert Answer

By:

Thien D. answered • 07/12/19

Tutor
5 (1)

MS in Biomedical Engineering with 4 Years of MATLAB Experience

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.