Unable to convert the following expression into double array
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hello all, When I run my code, I keep getting this error: "Unable to convert expression containing remaining symbolic function calls into double array. Argument must be expression that evaluates to number."
clc;
clear all;
close all;
al = 0.5;
n = 5;
sig2_fsnrn = 1;
sig2_ksln = 1;
sig2_glnrn = 10;
sig2_e_fsnrn = 0;
sig2_e_ksln= 0;
sig2_e_glnrn =0;
L = 1;
Nr = 1;
gamma_th_dB = 3;
gamma_th = (10^(gamma_th_dB/10));
vel_r =0;
c = 3*10^8;
fc = 915*10^6;
Rs = 9.6*10^3;
Z1 = ((2*pi*fc*vel_r)/(Rs*c));
P_fsnrn = besselj(0,Z1);
P_ksln = besselj(0,Z1);
P_glnrn = besselj(0,Z1);
v_phi_fsnrn = (1-P_fsnrn^(2*(n-1)))*sig2_fsnrn;
v_phi_ksln = (1-P_ksln^(2*(n-1)))*sig2_ksln;
v_phi_glnrn = (1-P_glnrn ^(2*(n-1)))*sig2_glnrn ;
rho2_fsnrn = (P_fsnrn)^(2*(n-1));
rho2_ksln = (P_ksln)^(2*(n-1));
rho2_glnrn = (P_glnrn)^(2*(n-1));
OP_th = [];
for j1 = -5:5:45
jj1 = 10^(j1/10);
jj1
mu4_1 = (al^2)*v_phi_glnrn*(v_phi_ksln + (rho2_ksln*sig2_e_ksln));
mu4_2 = (al^2)*rho2_glnrn*sig2_e_glnrn*(v_phi_ksln + (rho2_ksln*sig2_e_ksln));
mu4_3 = v_phi_fsnrn+(rho2_fsnrn*sig2_e_fsnrn+(1/jj1));
mu4 = mu4_1+mu4_2+mu4_3;
zeta = (al^2)*rho2_glnrn*rho2_ksln;
mu1 = (al^2)*rho2_glnrn*(v_phi_ksln + (rho2_ksln*sig2_e_ksln));
mu2 = (al^2)*rho2_ksln*(v_phi_glnrn + (rho2_glnrn*sig2_e_glnrn));
mu3 = rho2_fsnrn;
syms x1;
part1 = exp((gamma_th*mu2*x1)/((zeta*x1-mu1)*sig2_glnrn));
part2 = exp((gamma_th*mu4)/((zeta*x1-mu1)*sig2_glnrn));
part3 = exp(-x1/sig2_ksln);
part4_1 = (-1/sig2_fsnrn);
part4_2 = (gamma_th*mu3)/((zeta*x1-mu1)*sig2_glnrn);
part4 = -1/(part4_1+part4_2);
pt_1 = part1*part2*part3*part4;
I1 = int(pt_1,0,10);
op_th1 = (1/(sig2_ksln*sig2_fsnrn))*I1;
op_th = 1-op_th1;
OP_th = [OP_th,op_th];
end
SNRdB = -5:5:45;
grid on;
semilogy(SNRdB,OP_th,'g-','LineWidth',1.1);
3 comentarios
KSSV
el 24 de Jun. de 2022
In a way yes.....try to find out the integration of the expression. Or read tips to see whether integration can be solved in matlab.
Respuestas (1)
Torsten
el 24 de Jun. de 2022
Editada: Torsten
el 24 de Jun. de 2022
clc;
clear all;
close all;
al = 0.5;
n = 5;
sig2_fsnrn = 1;
sig2_ksln = 1;
sig2_glnrn = 10;
sig2_e_fsnrn = 0;
sig2_e_ksln= 0;
sig2_e_glnrn =0;
L = 1;
Nr = 1;
gamma_th_dB = 3;
gamma_th = (10^(gamma_th_dB/10));
vel_r =0;
c = 3*10^8;
fc = 915*10^6;
Rs = 9.6*10^3;
Z1 = ((2*pi*fc*vel_r)/(Rs*c));
P_fsnrn = besselj(0,Z1);
P_ksln = besselj(0,Z1);
P_glnrn = besselj(0,Z1);
v_phi_fsnrn = (1-P_fsnrn^(2*(n-1)))*sig2_fsnrn;
v_phi_ksln = (1-P_ksln^(2*(n-1)))*sig2_ksln;
v_phi_glnrn = (1-P_glnrn ^(2*(n-1)))*sig2_glnrn ;
rho2_fsnrn = (P_fsnrn)^(2*(n-1));
rho2_ksln = (P_ksln)^(2*(n-1));
rho2_glnrn = (P_glnrn)^(2*(n-1));
OP_th = [];
for j1 = -5:5:45
jj1 = 10^(j1/10);
%jj1
mu4_1 = (al^2)*v_phi_glnrn*(v_phi_ksln + (rho2_ksln*sig2_e_ksln));
mu4_2 = (al^2)*rho2_glnrn*sig2_e_glnrn*(v_phi_ksln + (rho2_ksln*sig2_e_ksln));
mu4_3 = v_phi_fsnrn+(rho2_fsnrn*sig2_e_fsnrn+(1/jj1));
mu4 = mu4_1+mu4_2+mu4_3;
zeta = (al^2)*rho2_glnrn*rho2_ksln;
mu1 = (al^2)*rho2_glnrn*(v_phi_ksln + (rho2_ksln*sig2_e_ksln));
mu2 = (al^2)*rho2_ksln*(v_phi_glnrn + (rho2_glnrn*sig2_e_glnrn));
mu3 = rho2_fsnrn;
%syms x1;
part1 = @(x1)exp((gamma_th*mu2*x1)./((zeta*x1-mu1)*sig2_glnrn));
part2 = @(x1)exp((gamma_th*mu4)./((zeta*x1-mu1)*sig2_glnrn));
part3 = @(x1)exp(-x1/sig2_ksln);
part4_1 = (-1/sig2_fsnrn);
part4_2 = @(x1)(gamma_th*mu3)./((zeta*x1-mu1)*sig2_glnrn);
part4 =@(x1) -1./(part4_1+part4_2(x1));
pt_1 = @(x1)part1(x1).*part2(x1).*part3(x1).*part4(x1);
I1 = integral(pt_1,0,10)
op_th1 = (1/(sig2_ksln*sig2_fsnrn))*I1;
op_th = 1-op_th1;
OP_th = [OP_th,op_th];
end
SNRdB = -5:5:45;
grid on;
semilogy(SNRdB,OP_th,'g-','LineWidth',1.1);
Ver también
Categorías
Más información sobre Bessel functions en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!