我的代码在下面,我想要做的是获取 5 个单独的 ft 数组并将它们添加到 for 循环中,这样我就可以播放它们全部叠加的声音。谢谢你的帮助!
`fs = 44100; % standard sampling rate
T = 1/fs; % sampling period
t = 0:T:5; % time vector
conv = 1E5; % conversion factor for frequencies
phi=2*pi*rand(1,1); % random phase
Msun = 2E30; % mass of the sun
Rsun = 6.9599E5; % radius of the sun
M = 1E32; % mass of target star
R = 7E5; % radius of target star
Teff = 6000;
% frequency of maximum oscillation mode
vmax = 3090*(M/Msun)*(R/Rsun)^(-2) * (Teff/5777)^(-1/2);
% difference between consecutive frequencies
dv = 134.9*(M/Msun)^(1/2) * (R/Rsun)^(-3/2);
for n = 0:1:4
vi = vmax + n.*dv; % pulsation mode frequencies
ft = sin(2*pi.*vi.*t + phi); % sinusoidal perturbation function
cft = conv.*ft; % converted perturbation for human audible range
sound(cft, fs) % play sound of each frequency mode
end
`