[問題] 新手請教...已回收

看板MATLAB作者 (老人)時間16年前 (2009/03/22 17:06), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/1
function [max_v] = sim_tx_pulse_piston(x,y,z) %%%%%%%%%%%%%%%%%%%%%% Acquire channel data %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% f0=3.5e6; % Transducer center frequency [Hz] fs=100e6; % Sampling frequency [Hz] c=1540; % Speed of sound [m/s] lambda=c/f0; % Wavelength [m] R=17.5/1000; % Radius of transducer ele_size=1/1000; % Size of mathematical elements Focal_radius=55/1000; % Focal radius % 抽樣頻率 set_sampling(fs); % 產生發射的孔 xmit_aperture = xdc_concave (R,Focal_radius,ele_size); % change to xdc_piston % 確定發出孔的脈波、激勵 impulse_response=sin(2*pi*f0*(0:1/fs:2/f0)); impulse_response=impulse_response.*hanning(max(size(impulse_response)))'; xdc_impulse (xmit_aperture, impulse_response); excitation=sin(2*pi*f0*(0:1/fs:20/f0)); %excitation=[1]; xdc_excitation (xmit_aperture, excitation); % Do the calculation [v,t]=calc_hp (xmit_aperture, [x y z]/1000); plot([0:length(v)-1]/fs+t,v) xdc_free (xmit_aperture) 以上是程式碼,原本的程式沒有最上面的function [max_v] = sim_tx_pulse_piston(x,y,z) 而且[v,t]=calc_hp (xmit_aperture, [x y z]/1000);中的x=0 y=0 z=55 我想將原程式弄成function讓我可以在之後的程式中變動xyz的值就得知其v的最大值 ps:原程式的其他FUNTION是 fieldII SIMULATION 中的 可這程式無法執行.... 想問問題出在哪? 謝謝!! -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.118.233.146
文章代碼(AID): #19nV-ExK (MATLAB)
文章代碼(AID): #19nV-ExK (MATLAB)