Unable to convert the following expression into double array

조회 수: 4 (최근 30일)
chaaru datta
chaaru datta 2022년 6월 24일
댓글: chaaru datta 2022년 6월 25일
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
chaaru datta
chaaru datta 2022년 6월 24일
Thanks for your answer sir. It means MATLAB is unable to solve the integration. So does it mean that we cannot plot this expression in MATLAB.
KSSV
KSSV 2022년 6월 24일
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.

댓글을 달려면 로그인하십시오.

답변 (1개)

Torsten
Torsten 2022년 6월 24일
편집: Torsten 2022년 6월 24일
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
Warning: Inf or NaN value encountered.
I1 = -Inf
Warning: Inf or NaN value encountered.
I1 = -Inf
Warning: Inf or NaN value encountered.
I1 = -Inf
Warning: Inf or NaN value encountered.
I1 = -Inf
Warning: Inf or NaN value encountered.
I1 = -Inf
Warning: Inf or NaN value encountered.
I1 = -Inf
Warning: Inf or NaN value encountered.
I1 = -Inf
Warning: Inf or NaN value encountered.
I1 = -Inf
Warning: Inf or NaN value encountered.
I1 = -Inf
Warning: Inf or NaN value encountered.
I1 = -Inf
Warning: Inf or NaN value encountered.
I1 = -Inf
SNRdB = -5:5:45;
grid on;
semilogy(SNRdB,OP_th,'g-','LineWidth',1.1);
  댓글 수: 1
chaaru datta
chaaru datta 2022년 6월 25일
Ok sir....it means Inf value is creating the problem. Will once again try it. Thank you for your support.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Bessel functions에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by