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'])
u1=340;u2=1450;
f1=200;f2=2000;
m11=u1/f1;m12=u2/f2;m21=u2/f1;m22=u2/f2;