Transcendental equation solution solution, graph plot.

Hello All,

I am trying to solve transcendental equation and plot graph for left and right part of this equation (g.c(1+r)=n+(1/pi)*atan(-(A/B))). It suppose to look like the attached images constants are also mention there.

 n>2
 n=(3:1:8) and
 c>0
 c=(1:0.2:2).

Where A and B are

A=cos(g.*c.*pi.*r).*cos(g.*sqrt((c.^2)-1).*pi.*r)+sqrt(1-(1./(c.^2))).*sin(g.*c.*pi.*r).*sin(g.*sqrt(c.^2-1).*pi.*r);
B=sin(g.*c.*pi.*r).*cos(g.*sqrt((c.^2)-1).*pi.*r)-sqrt(1-(1./(c.^2))).*cos(g.*c.*pi.*r).*sin(g.*sqrt(c.^2-1).*pi.*r);

I tried this on Matlab:

close all
clc;
g = sqrt(8);
r = 0.20;
n = 3:1:8; 
c = 1:0.2:2;
A_S=cos(g.*c.*pi.*r).*cos(g.*sqrt((c.^2)-1).*pi.*r)+sqrt(1-(1./(c.^2))).*sin(g.*c.*pi.*r).*sin(g.*sqrt(c.^2-1).*pi.*r);
B_S=sin(g.*c.*pi.*r).*cos(g.*sqrt((c.^2)-1).*pi.*r)-sqrt(1-(1./(c.^2))).*cos(g.*c.*pi.*r).*sin(g.*sqrt(c.^2-1).*pi.*r);
A_A=cos(g.*c.*pi.*r).*sin(g.*sqrt((c.^2)-1).*pi.*r)-sqrt(1-(1./(c.^2))).*sin(g.*c.*pi.*r).*cos(g.*sqrt(c.^2-1).*pi.*r);
B_A=sin(g.*c.*pi.*r).*sin(g.*sqrt((c.^2)-1).*pi.*r)+sqrt(1-(1./(c.^2))).*cos(g.*c.*pi.*r).*cos(g.*sqrt(c.^2-1).*pi.*r);
F=g*c*(1+r);
T_S=atan(-(A_S./B_S));
w_S=(n+(1/pi)).*T_S;
T_A=atan(-(A_A./B_A));
w_A=(n+(1/pi)).*T_A;
figure;
plot(c,F,'b')
hold on;
plot(c, w_S ,'r')
plot(c, w_A, 'g') 
grid on
hold off;

Thank you!

回答(1 个)

If your implementation of the equations are right, then this might work
close all
clc;
g = sqrt(8);
r = 0.20;
%n = 3:1:8;
c = 1:0.2:2;
A_S=cos(g.*c.*pi.*r).*cos(g.*sqrt((c.^2)-1).*pi.*r)+sqrt(1-(1./(c.^2))).*sin(g.*c.*pi.*r).*sin(g.*sqrt(c.^2-1).*pi.*r);
B_S=sin(g.*c.*pi.*r).*cos(g.*sqrt((c.^2)-1).*pi.*r)-sqrt(1-(1./(c.^2))).*cos(g.*c.*pi.*r).*sin(g.*sqrt(c.^2-1).*pi.*r);
A_A=cos(g.*c.*pi.*r).*sin(g.*sqrt((c.^2)-1).*pi.*r)-sqrt(1-(1./(c.^2))).*sin(g.*c.*pi.*r).*cos(g.*sqrt(c.^2-1).*pi.*r);
B_A=sin(g.*c.*pi.*r).*sin(g.*sqrt((c.^2)-1).*pi.*r)+sqrt(1-(1./(c.^2))).*cos(g.*c.*pi.*r).*cos(g.*sqrt(c.^2-1).*pi.*r);
F=g*c*(1+r);
plot(c,F,'b')
for n=3:8
T_S=atan(-(A_S./B_S));
w_S=(n+(1/pi)).*T_S;
T_A=atan(-(A_A./B_A));
w_A=(n+(1/pi)).*T_A;
hold on;
plot(c, w_S ,'r')
plot(c, w_A, 'g')
end
grid on
hold off;
end

类别

帮助中心File Exchange 中查找有关 Interactive Control and Callbacks 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by