MATLAB example not working.

5 visualizaciones (últimos 30 días)
Qasim Sultan
Qasim Sultan el 7 de Jul. de 2020
Editada: Stephen23 el 8 de Jul. de 2020
Hi,
I am running code for plotting beam pattern by following webpage of MATLAB: https://in.mathworks.com/help/phased/examples/introduction-to-hybrid-beamforming.html
But MATLAB throws error:
"Undefined function 'scatteringchanmtx' for input arguments of type 'double'."
This code is provided by MATLAB team and still is not working. Your help will be highly appreciated. Code is provided below:
clc, clear all
Nt = 64;
NtRF = 4;
Nr = 16;
NrRF = 4;
rng(4096);
c = 3e8;
fc = 28e9;
lambda = c/fc;
txarray = phased.PartitionedArray(...
'Array',phased.URA([sqrt(Nt) sqrt(Nt)],lambda/2),...
'SubarraySelection',ones(NtRF,Nt),'SubarraySteering','None');
rxarray = phased.PartitionedArray(...
'Array',phased.URA([sqrt(Nr) sqrt(Nr)],lambda/2),...
'SubarraySelection',ones(NrRF,Nr),'SubarraySteering','None');
Ncl = 6;
Nray = 8;
Nscatter = Nray*Ncl;
angspread = 5;
% compute randomly placed scatterer clusters
txclang = [rand(1,Ncl)*120-60;rand(1,Ncl)*60-30];
rxclang = [rand(1,Ncl)*120-60;rand(1,Ncl)*60-30];
txang = zeros(2,Nscatter);
rxang = zeros(2,Nscatter);
% compute the rays within each cluster
for m = 1:Ncl
txang(:,(m-1)*Nray+(1:Nray)) = randn(2,Nray)*sqrt(angspread)+txclang(:,m);
rxang(:,(m-1)*Nray+(1:Nray)) = randn(2,Nray)*sqrt(angspread)+rxclang(:,m);
end
g = (randn(1,Nscatter)+1i*randn(1,Nscatter))/sqrt(Nscatter);
txpos = getElementPosition(txarray)/lambda;
rxpos = getElementPosition(rxarray)/lambda;
H = scatteringchanmtx(txpos,rxpos,txang,rxang,g);
F = diagbfweights(H);
F = F(1:NtRF,:);
pattern(txarray,fc,-90:90,-90:90,'Type','efield',...
'ElementWeights',F','PropagationSpeed',c);
  2 comentarios
Voss
Voss el 7 de Jul. de 2020
Do you have the Phased Array System Toolbox installed?
Qasim Sultan
Qasim Sultan el 8 de Jul. de 2020
yes !

Iniciar sesión para comentar.

Respuesta aceptada

Stephen23
Stephen23 el 8 de Jul. de 2020
Editada: Stephen23 el 8 de Jul. de 2020
Typical reasons why that function might not work:
  • scatteringchanmtx was introduced in R2017b. It will not work with earlier MATLAB versions. You did not tag the question with the MATLAB version you are using, but it helps us when you do.
  • the toolbox is not installed (check using ver).
  • the toolbox is not licensed (check https://www.mathworks.com/licensecenter).
  • the Search path has been changed so the function cannot be found.

Más respuestas (0)

Categorías

Más información sobre Introduction to Installation and Licensing en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by