error in subcript must real integers or logicals
    8 visualizaciones (últimos 30 días)
  
       Mostrar comentarios más antiguos
    
    ABDUL
 el 23 de Jun. de 2019
  
    
    
    
    
    Comentada: Image Analyst
      
      
 el 29 de Jun. de 2019
            hello......
this is my fragment of the code for which i have an error messgae as 
Subscript indices must either be real positive integers or logicals.
Rx_sig=-0.00228139830236440 - 3.55229542679345i	25.9079649559839 - 4.20278180329686i	-0.199534667502929 + 2.57382299847887i	4.75095187634165 + 7.55137391633775i	-3.16676236501467 - 4.16318702443547i	8.88233749597074 + 8.50331436803596i	-8.44007209509126 + 38.8184170107550i	-11.4367861738498 - 9.42621011633355i	14.7090411800385 + 0.0227327931631207i	-24.8330087195633 - 2.07903781629382i	29.5921247879974 - 6.53874487938683i	-9.34931812683748 - 9.97817067745157i	7.81343605017482 - 0.229834266942120i	-12.6640577989272 - 12.5660353126035i	-6.10778416385070 + 22.8747235353472i	-20.7424361396821 - 22.5945289243796i	-0.105876142424078 + 9.69286173976423i	-3.17119456407441 - 11.3902063909043i	-23.4223870418216 + 5.98412799045698i	8.40925273243037 + 2.83091733007915i	-13.2263120616125 - 24.3091068593669i	2.47606182417655 - 7.79234143953524i	8.76738779718620 - 28.1837566262481i	-8.91034488044120 + 16.5179195812190i	22.1157911290424 - 8.26385165016895i	9.46604993237279 - 2.91967521464794i	11.6273529847497 + 8.45913452158713i	62.3151131731619 - 2.01629833954580i	-15.0550517665030 + 3.60428849678560i	-2.29754053265699 + 7.40133191739613i	-12.8718901071839 - 1.12228470106013i	3.17583026828346 + 7.29559746374285i	-6.41656857053528 - 3.22658171292974i	-29.3019192751764 + 13.2451691301273i	-14.3481321239987 - 2.50898021747154i	10.5936439530430 - 6.71629604112105i	-22.5165406101810 - 15.2695994440529i	8.25153534988980 - 7.04700364399823i	26.5837629588114 - 22.4507015009453i	13.7381649223951 + 8.65227685690808i	-44.9303437265791 + 0.528436771987468i	12.6351464020109 - 19.3894438438106i	16.9400561254265 + 3.62507160954078i	31.6458940174178 + 14.7685554399962i	-8.00710869910911 + 18.2481403951358i	8.73346423864035 + 8.31006731344944i	-17.0396882565722 + 8.13119796163572i	-20.2574170324577 + 8.78483488324931i	-9.80387993813558 - 11.9303975590527i	11.9397361639549 - 13.3889826293174i	11.8517323574438 - 9.84751371317046i	44.7411232507581 - 2.21100482381204i	4.62776525152870 + 20.4527874899970i	7.86798344173214 - 19.9924193159475i	-21.5870623387253 - 0.273847697828579i	15.3208101962614 - 5.32785736717789i	-4.90972272542029 + 12.7545155692018i	-5.70374985432976 + 12.3111914676459i	5.92199472930630 - 17.3509486340542i	32.7046823822483 + 8.80796453633738i	-16.7369544561212 - 5.58299670290960i	-11.7906418579563 + 3.70858261573058i	13.8356731823399 + 7.09664209818845i	-5.92621048428635 + 27.1619691275503i
7.81250000000000e-09	1.56250000000000e-08	2.34375000000000e-08	3.12500000000000e-08	3.90625000000000e-08	4.68750000000000e-08	5.46875000000000e-08	6.25000000000000e-08	7.03125000000000e-08	7.81250000000000e-08	8.59375000000000e-08	9.37500000000000e-08	1.01562500000000e-07	1.09375000000000e-07	1.17187500000000e-07	1.25000000000000e-07
x1=[1 ,	1,	0,	1,	1,	1,	0,	1,	0,	0,	0,	1,	1,	0,	0,	1,	0,	1,	0,	0,	0,	0,	0,	0,	1,	0,	1,	1,	0,	1,	0,	0,	0,	0,	0,	1,	0,	0,	1,	1,	1,	1,	0,	1,	1,	0,	1,	0,	0,	0,	0,	0,	0,	1,	1,	0,	1,	1,	0,	1,	1,	0,	0,	0];
fc=8000000;
tmod=[7.81250000000000e-09,	1.56250000000000e-08,	2.34375000000000e-08,	3.12500000000000e-08,	3.90625000000000e-08,	4.68750000000000e-08,	5.46875000000000e-08,	6.25000000000000e-08,	7.03125000000000e-08,	7.81250000000000e-08,	8.59375000000000e-08,	9.37500000000000e-08,	1.01562500000000e-07,	1.09375000000000e-07,	1.17187500000000e-07,	1.25000000000000e-07]
Rx_sig_real=sign(real(Rx_sig));
Rx_sig_imag=sign(imag(Rx_sig));
for idemod=1:1:length(x1)/16
    %%XXXXXX inphase coherent dector XXXXXXX
         Z_in=Rx_sig_real(((idemod-1)*length(tmod)+1:idemod*length(tmod)).*cos(2*pi*fc*tmod));
%         Z_in=Rx_sig_real((idemod-1)*length(tmod)+1:}.2demod*length(tmod)).*cos(2*pi*fc*tmod); 
    % above line indicat multiplication of received & inphase carred signal
    Z_in_intg=(trapz(tmod,Z_in))*(2/Tc);% integration using trapizodial rull
    if(Z_in_intg>0) % Decession Maker
       Rx_in_data=1;
    else
       Rx_in_data=0; 
    end
    %%XXXXXX Quadrature coherent dector XXXXXX
    Z_qd=Rx_sig_imag(((idemod-1)*length(tmod))+1:idemod*length(tmod)).*sin(2*pi*fc*tmod);
    %above line indicat multiplication ofreceived & Quadphase carred signal
    Z_qd_intg=(trapz(tmod,Z_qd))*(2/Tc);%integration using trapizodial rull
        if (Z_qd_intg>0)% Decession Maker
        Rx_qd_data=1;
        else
        Rx_qd_data=0; 
        end
       Rx_data=[Rx_data  Rx_in_data  Rx_qd_data] % Received Data vector
end
4 comentarios
Respuesta aceptada
  Aquatris
      
 el 24 de Jun. de 2019
        If you run this portion
((idemod-1)*length(tmod)+1:idemod*length(tmod)).*cos(2*pi*fc*tmod)
which you use as index, you will see negative values. You made an error in coding the index. Since we do not know what you are trying to do, you need to figure out yourself. 
3 comentarios
  Image Analyst
      
      
 el 29 de Jun. de 2019
				Can you then please then "Accept this answer" to give Aquatris credit for it?  Thanks in advance.
Más respuestas (0)
Ver también
Categorías
				Más información sobre Simulation, Tuning, and Visualization 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!



