How can I generate audio wave files of harmonic series/partials for a specific frequency in Matlab this is the only code I know, but it is for one specific frequency and not for its harmonic series, I am trying to get all the partials as individual files, eg. If I want to generate 40hz sine wavwrite file and its harmonic series which would be 40-80-120-140hz etc, about 551 individual audio sine wav files all at harmonic series frequency values in one go generated with an Matlab Code...

fs = 44100; % sampling frequency
nbits= 16;
file = 'output.wav'
d = 40; % duration
f = 60; % wave frequency
phi = pi/2; % phase shift - will produce cosinusoid for pi/2
t = linspace(1/fs, d, d*fs); % time vector
y = sin(2*pi*f*t + phi);
plot(t,y);
wavwrite( y, fs, nbits, file)
use a for loop to save each frequency into a different named wav file, use string manipulation command num2str() of Matlab. The following will help:

clc; clear all; close all;

Fs = 44100;         % Sampling frequency
F0 = 200;            % base frequency
t = [0:1/Fs:0.1];   % time index
k = 0;              % harmonic index

for fsine=F0:F0:Fs/2
    x = sin(2*pi*fsine*t);
    filename = ['wav' num2str(k)];
    wavwrite(x, Fs,16, filename);
    k = k+1;  
 end