Compute intersections of two functions

1 view (last 30 days)
Hello all,
I am trying to find the numbers that minimizes two functions.
clear; close all; clc;
h=10;
b1=3; b2=5;
r1=2.8; r2=3.2;
m1=b1^2*r1;
m2=b2^2*r2;
f=(0:0.01:0.4);
w=2*pi*f;
c=(b1+0.002*(1:1000));
y=h*sqrt((1/b1^2)-((1./c.^2)));
Y2=(m2/m1)*sqrt(((1./c.^2)-(1/b2^2))./((1/b1^2)-(1./c.^2)));
ymax=h*sqrt((1/b1^2- 1/b2^2));
PE= @(YY, bb1, bb2, mm1, mm2,cc) YY-((mm2*sqrt((1./cc.^2)-(1/bb2^2)))/(mm1*sqrt((1/bb1^2)-(1./cc.^2))));
%identify fundamental modes
for i=1:length(w)
yy(:,i)=w(i)*y;
for j=1:length(c)
if yy(j,i) >= (pi/2)
Y1(j,i)=0;
else
Y1(j,i)=tan(yy(j,i));
end
end
end
for i=1:length(w)
for j=1:length(c)
if Y1(j,i) ~= 0
ccc(i,:)=fminsearch(@(cc) PE(Y1(j,i), b1, b2, m1, m2 ,cc),5);
end
end
end
Here I compute some modes of a tangent and trying to find the intersections of fundamental mode with a curve which I named Y2.
I eliminated higher order modes and keep only fundamental modes in matrix Y1 and assumed the function value zero for higher order modes, for every w. There must be length(w) numbers of minimizing values between 3 and 5. I use fminsearch to find them however it doesn't work. I guess the use of fminsearch is correct but my logic is not. Where I am making mistake? Any help is appreciated.

Answers (0)

Categories

Find more on Optimization in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!