Hiya,
I'm trying to use bisection to find the correct prong length for a tuning fork to give a specific freq eg 400 Hz.
function[optlength,optfreq]=optimize_tuning_fork(model,freq_target)
%simple bisection
disp('****Initial interval****')
%interval = [80 90];
highInt = 90;
lowInt = 80;
for i=1:20
int = (highInt+lowInt)/2;
freq_1 = solve(model, int);
%freq_1 = solve(int);
disp(int,freq_1)
if freq_1 < freq_target
highInt = int
else
lowInt = int
end
end
optlength = int
optfreq = freq_1
function freq = solve(model,Lp)
%solve the model for different values of L
disp('Solving model')
Lp
model.param.set('Lp',Lp);
model.study('std1').run;
freq = mphglobal(model,'freq')
I get the attached error.
Error using disp
Too many input arguements.
Error in optizimse_tuning_fork (line 14)
display(int, freq)
Any help would be much appreciated...
Thanks, Sinéad