LZ试试看,这个行不行:
clc
clear
u1 = 340;
u2 = 1450;
freq = 200; %频率,这里自己改数值
wavelen1 = u1/freq; %算空气中的波长
disp(['In air for a frequency of ',num2str(freq),...
'Hz the wavelength of the acoustic waves is',...
num2str(wavelen1),'m']) %显示答案
wavelen2 = u2/freq; %算水中的波长
disp(['In water for a frequency of ',num2str(freq),...
'Hz the wavelength of the acoustic waves is',...
num2str(wavelen2),'m'])
温馨提示:答案为网友推荐,仅供参考