Asked by Passband Modulation
on 5 Oct 2012

I have a sound file named “message.txt” containing the waveform of a voice message embedded in a sinusoid with frequency of 220 Hz, and the sampling frequency is 22000 Hz.

file content consisting of 65120 rows of item as following shows

file source: http://www.2shared.com/document/LCmLelLW/message.html

load the file, and the speech heard

load message.txt soundsc(message, 22000)

Now what I want to do is do some mathematical calculations of these data.

where r[k] corresponds to message. say for example: r[k] corresponds to the floating point number in first row of the file for k=0. r[k] corresponds to the floating point number in second row of the file for k=1. r[k] corresponds to the floating point number in third row of the file for k=2. and so on. finally, r[k] corresponds to the floating point number in last row of the file for k=65119.

(the lenght of the message/signal length is 65120, obtained using length(message))

how to do that? does anyone get what i mean?

*No products are associated with this question.*

Answer by Walter Roberson
on 5 Oct 2012

Accepted answer

sum( message .* sind(3.6 * (0:length(message)-1))

Show 4 older comments

Passband Modulation
on 5 Oct 2012

last question, sry for bother u again. i want to plot s[k] using the following equation, where r[k] again corresponds to message.

s[k]=r[k]-56.97cos(3.6k)-31.98sin(3.6k)

for k=0:length(message)-1

i tried, but again failed.

load message.txt N=65120; k=0:N-1; s = message - 56.97*cosd(3.6*k)-31.98*sind(3.6*k); s k=0:N-1; plot(k,s) xlabel('k');

could u fit it, if u dun mind and are available. ylabel('s[k]');

Walter Roberson
on 5 Oct 2012

Already answered in the Question you created for this.

Passband Modulation
on 6 Oct 2012

many ths!

Related Content

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn moreOpportunities for recent engineering grads.

Apply Today
## 3 Comments

## Walter Roberson (view profile)

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/49929#comment_103195

(file is a column list of floating point numbers in text representation.)

## Walter Roberson (view profile)

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/49929#comment_103196

I am not sure what you mean about r[k] ?

Once you have loaded the data into the array "message" it will just be a numeric array and you can do any mathematical processing you want on it.

## Passband Modulation (view profile)

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/49929#comment_103199

r[k] corresponds to file massage. Say, r[k] corresponds to the floating point number in first row of the file for k=1.

i really dun know how to do the mathematical processing with matlab, could u write down the code? (plz note sin(3.6k) should be in degree)