嗨,我是matlabgui的新手,我有一个文本文件,我将其转换为二进制,然后将这些二进制传递给mfsk函数,但它给了我以下错误,请帮助我尽快发布我的完整代码,我可以做什么。。。。。。
Error using .*
Integers can only be combined with integers of the same class, or scalar doubles.
Error in GUI2>menu_mscheme_mfsk_2_Callback (line 217)
d_xover_den =((4*pi./lambda).^2*(1+alpha)*SNR_unc./(2*Gr*Gt).*b*B*noise*NF.*Ton*(1- 1/CG));
Error in gui_mainfcn (line 96)
feval(varargin{:});
Error in GUI2 (line 43)
gui_mainfcn(gui_State, varargin{:});
我的文本代码是
filename= uigetfile('*.txt','File select text');
txt = fopen(filename);
txtbits = fread(txt, inf, '*ubit1', 'b');
openvar('txtbits');
fclose(txt);
fileID = fopen(filename);
C = textscan(fileID,'%s');
i = C{1}{1};
dec2bin(i);
fclose(fileID);
celldisp(C);
set(handles.text3,'string',filename);
set(handles.text4,'string',txtbits);
handles.binary=txtbits;
guidata(hObject, handles);
我的mfsk代码是
decimal=handles.binary
N=decimal;
charact = {'b-+','b-o','b-v','b-^','b-*'};
j=0;
for N=50:20:150
j=j+1;
b=2;
L = decimal
freq=linspace(0.3,7,20)*1e+9;
lambda=1e+8./freq;
B = 1e+6; % Bandwidth
n = 5; % Path loss
noise = 4e-21;
P_ckt=0.02; % watt
% Ton=0.1; % sec
Ton=L*2^b./(b*B);
SNR_unc = 10;
K=24;
N_o_K = 30/24;
alpha = 1.9;
n=6; % path loss component
E_comp = 5; % To CONFORM the value
Gt = 1;
Gr = 1;
CG = 10; % Code Gain
NF = 1; % noise-factor
d_xover_num = (P_ckt*Ton*(N/K-1)+L*E_comp*N/K);
d_xover_den = ((4*pi./lambda).^2*(1+alpha)*SNR_unc./(2*Gr*Gt).*b*B*noise*NF.*Ton*(1- 1/CG));
d_xover = (d_xover_num./d_xover_den).^(1/n);
% d_xover = abs(d_xover);
axes(handles.abc)
plot(freq,d_xover,charact{j});
hold on
xlabel('Carrier Frequency'), ylabel('Cross-over distance (m)')
grid on
hold on
end
legend ('N=50','N=70','N=90','N=110','N=130')