Undefined function 'mtimes' for input arguments of type 'cell'.?

조회 수: 22 (최근 30일)
sharif shikder
sharif shikder 2016년 1월 23일
답변: eslam saad 2018년 10월 16일
%clear all;
%close all;
L_0=10; %Average outer scale of turbulance in m.
c_n=5*10^-12; %Structure constant of refractive index in m^-2/3.
c=3*10^8; % Speed of light in m/s.
f=30*10^9; % Frequency in HZ.
lamda=c/f;
L=4000;
del_ky=0.01;
[EbN0_dB]=[10 15 20 25 30 35 40 45 50 55];
sigma=[{0.307*(c_n)^2}*{(2*3.1416/lamda)^1.17}*{L^(1.833)}]-[{0.742*(c_n)^2}*{(2*23.1416/lamda)^0.17}*{(L^2.833)*(L_0^2)}]
for i= 1:10
snr=10.^(EbN0_dB(i)/10);
ky=0:del_ky:10;
pe=1/2.*erfc(ky.*sqrt(snr/2));
pdf_ky=(1/(sqrt(2*3.1416)*sigma))*exp((-ky.^2)/2*sigma^2);
prod=pe.*pdf_ky;
ber(i)=trapz(prod)*del_ky;
end
CDF_ky=trapz(pdf_ky)*del_ky
ber=ber./CDF_ky;
semilogy(EbN0_dB,ber)
ylabel('Bit Error Rate(BER)')
xlabel('Signal to Noise Ratio(SNR)');

채택된 답변

jgg
jgg 2016년 1월 23일
편집: jgg 2016년 1월 23일
This expression:
sigma=[{0.307*(c_n)^2}*{(2*3.1416/lamda)^1.17}*{L^(1.833)}]-[{0.742*(c_n)^2}*{(2*23.1416/lamda)^0.17}*{(L^2.833)*(L_0^2)}]
is not proper Matlab syntax. The {} brackers denote cells. You cannot use them as delimiters for order of operations. The same is true of [] which have particular meaning. You probably want this instead:
sigma=((0.307*(c_n)^2)*((2*3.1416/lamda)^1.17)*(L^(1.833)))-((0.742*(c_n)^2)*((2*23.1416/lamda)^0.17)*((L^2.833)*(L_0^2)))
However, I strongly advise you to read up on the basic syntax of the language you're using. This is a really fundamental mistake, and if you don't understand this you'll run into error after error. You wouldn't try and program in Java or C++ by guessing at what the different commands mean, so why would you code in Matlab without looking up how to write expressions?
Try this getting started link before coding any further.
  댓글 수: 1
Walter Roberson
Walter Roberson 2016년 1월 23일
Oh, you would be astonished how many people program C++ by guessing at what the different commands mean. 15 years ago, the documentation for the C++ Standard Library was already effectively too big to read, so people mostly don't read it.

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

추가 답변 (1개)

eslam saad
eslam saad 2018년 10월 16일
i need power this matrix [0.3] [0.3] [0.2] [0.2] [0.2] [0.5] [0.2] [0.1] [0.1] [0.2] [0.6] [0.1]

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by