Why am I getting this error, "Subscript indices must either be real positive integers or logicals."
    6 ビュー (過去 30 日間)
  
       古いコメントを表示
    
% This code worked the last time I ran it but now I get an error message. Why is this?
      t = [-2: .001: 1.999];
      mt = sinc(5 .* t ./ pi);
      figure(1);
      plot(t, mt);
      xlabel('time');
      ylabel('amplitude');
      title('m(t)=sinc(5t/pi)');
      grid;
      PM = cos(50 .* pi + 20 .* mt);
      figure(2);
      plot(t, PM);
      xlabel('time');
      ylabel('amplitude');
      title('PM Signal');
      grid;
      % cumsum function is used to calculate integral
      integral_mt = cumsum(mt) .* 0.001;
      FM = cos(50 .* pi + 40 .* pi .* integral_mt);
      figure(3);
      plot(t, FM);
      xlabel('time');
      ylabel('amplitude');
      title('FM Signal');
      grid;
0 件のコメント
採用された回答
  Walter Roberson
      
      
 2018 年 4 月 15 日
        Works for me. You probably defined a variable named sinc or plot or cos
0 件のコメント
その他の回答 (1 件)
参考
カテゴリ
				Help Center および File Exchange で Logical についてさらに検索
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

