curve generation plot for given pdf

2 views (last 30 days)
Kundan Prasad
Kundan Prasad on 14 Dec 2021
Answered: Simran on 27 Mar 2025
I am not able to generate the curve of FIg.5 as per attached pdf or given link below
I am trying to replicate the same but having some problem. Please solve the same
Thank you
clear all
clc
for i=1:2
alpha(i)= (pi*22)/180;
beta(i)= atan(cos(alpha(i))*sin(gamma(i))./(1+sin(alpha(i))*sin(gamma(i))));
end
R=0.4;
t(1)= R*cos(alpha(1))./cot(alpha(1)+beta(1));
t(2)= R*cos(alpha(2))./cot(alpha(2)+beta(2));
n_1=1.49;
theta_1= asin(n_1.*sin(alpha(1)))-alpha(1);
T=0.2;
H_1=0.1;
t(3)= (H_1-t(1)*(tan(alpha(1))-cot(theta_1)))./(cot(theta_1)-tan(alpha(2)));
t(4)= (t(2)*(tan(alpha(2))-cot(theta_1))+.....
T*(tan(alpha(1))-tan(alpha(2)))-H_1)./(tan(alpha(1))-cot(theta_1));
h_1=(T-t(1)-t(4))*tan(alpha(1));
h_2=(T-t(3)-t(2))*tan(alpha(2));
n_2=1.49;
lamda_min=0.004;
lamda_max=0.007;
phase= h_1*(n_1 -1)./(lamda_min)+ h_2*(n_2-1)./(lamda_min);
e1= (sin(pi*((1-(phase/2*pi))))/(pi*((1-(phase/2*pi)))))^2;
e2= (sin(pi*(t(1)/T))/(pi*(t(1)/T)))^2;
e3= (sin(pi*(t(2)/T))/(pi*(t(2)/T)))^2;
e4= (sin(pi*(t(3)/T))/(pi*(t(3)/T)))^2;
e5= (sin(pi*(t(4)/T))/(pi*(t(4)/T)))^2;
x=0.001;
f=0.025;
syms x
b= int(R-sqrt(R.^2-x.^2),0, f);
c=sqrt((1/f)*b);
e6= exp(((-4*pi*c)/lamda_min).^8);
effic= e1*e2*e3*e4*e5*e6;
syms lamda
pide=int(e1*e2*e3*e4*e5, lamda_min,lamda_max);
fpide= (1/(lamda_max-lamda_min))*pide;
  1 Comment
Kundan Prasad
Kundan Prasad on 15 Dec 2021
please have a look into matlab code once.
I have attached the image of plot which is need to be obtained
Thank you

Sign in to comment.

Answers (1)

Simran
Simran on 27 Mar 2025
To generate the given curve, you can try these changes in the original code :
  1. The variable “gamma” is used but not defined in the original code. This is causing an error when trying to calculate “beta(i)”.
  2. The symbolic integration of “e1*e2*e3*e4*e5” with respect to “lamda” is not required, because these are constants with respect to “lamda”.
  3. The variable “effic” is calculated but not used further in the code.
  4. For plotting, instead of relying on symbolic integration, try using sample data points to simulate the plot, which is more straightforward and aligns with the intended visualization.
  5. I have added additional plot customization to better reflect the intended graph.
This is the curve that I got implementing these changes:
You can refer to the following documentation for more understanding:

Community Treasure Hunt

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

Start Hunting!