-2

I keep getting following error:

Error using  / 
    Matrix dimensions must agree.
Error in GUI2>menu_mscheme_mpsk_2_Callback (line 579)
    d_xover_den = ((4*pi/lambda).^2*(1+alpha)*SNR_unc./uu)
Error in gui_mainfcn (line 96)
    feval(varargin{:});
Error in GUI2 (line 43)
    gui_mainfcn(gui_State, varargin{:});
Error in
    @(hObject,eventdata)GUI2('menu_mscheme_mpsk_2_Callback',hObject,eventdata,guidata(hObject))
Error while evaluating uimenu Callback

Using my code:

cla(handles.abc, 'reset')
decimal = handles.binary;

N = 110;
charact = {'b-o', 'b-+', 'b-v', 'b-^', 'b-*'}
j = 0;
for N = 50:20:130
    j = j+1;
    b = 2;                              % M-Ary    
    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./(b*B);                     % b is No of resolution bits and B is the channel %bandwidth.
    SNR_unc = 10;
    K = 24;                             % information bit before encodings
    N_o_K = 30/24;
    alpha = 1.9;  
    n = 6;                              % path loss component
    E_comp = 5;   
    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);
    uu = (2 * Gr * Gt) .* b * B * noise * NF .* Ton * (1 - 1/CG)
    d_xover_den = ((4 * pi / lambda).^2 * (1 + alpha) * SNR_unc ./ uu)
    d_xover = (d_xover_num ./ d_xover_den).^(1/n);
    axes(handles.abc)
    plot(freq, d_xover, charact{j})
    xlabel('Carrier Frequency'), ylabel('Cross-over distance (m)')
    grid on
    hold on
end
legend ('N=50', 'N=70', 'N=90', 'N=110', 'N=130')

Description: I'm selecting text and then converting it into binary using dec2bin. Then I access that binary in mfsk callback function using handle.binary. The binary values are stored in a decimal variable. In code L represents transmission of bit.

Here's my question: Is directly assigning binary value a correct way?

mkierc
  • 1,193
  • 2
  • 15
  • 28
faseeh
  • 1
  • 1
  • 3

1 Answers1

0
d_xover_den = ((4*pi/lambda).^2*(1+alpha)*SNR_unc./uu)

should be

d_xover_den = ((4*pi./lambda).^2*(1+alpha)*SNR_unc./uu)

lambda is a vector, so 1/lambda will not work.

>> freq=linspace(0.3,7,20)*1e+9;
>> lambda=1e+8./freq;
>> 1/lambda
Error using  / 
Matrix dimensions must agree.

You need to use 1./lambda instead.

Kavka
  • 4,191
  • 16
  • 33
  • sir d_xover_den = ((4*pi./lambda).^2*(1+alpha)*SNR_unc./uu) not work again same error – faseeh Mar 24 '14 at 00:32
  • You also need to make sure that the size of `uu` is compatible with the size of `lambda` and also use `.*` instead of `*` in front of `(1+alpha)...`. – Kavka Mar 24 '14 at 00:39