Discussion Closed This discussion was created more than 6 months ago and has been closed. To start a new discussion with a link back to this one, click here.
Tuning Fork Bisection Example
Posted 16 mars 2020, 12:14 UTC−4 LiveLink for MATLAB Version 5.4 0 Replies
Please login with a confirmed email address before reporting spam
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
Hello Sinéad Mannion
Your Discussion has gone 30 days without a reply. If you still need help with COMSOL and have an on-subscription license, please visit our Support Center for help.
If you do not hold an on-subscription license, you may find an answer in another Discussion or in the Knowledge Base.