"real positive integers or logicals" error

조회 수: 5 (최근 30일)
sefa
sefa 2012년 2월 27일
A = 942;
f0 = 19;
w0_1 = 38*pi;
Q_1 = -0.9426;
Q_2 = -0.1678;
t = 0:0.1:5;
cosfn1 = A*cos(2*pi*f0*t + Q_1);
------------------------------
For a cod segment above, I get an error as "Subscript indices must either be real positive integers or logicals." And this points tthe cosfn1. Why do I get such an error? Thanks for your help

채택된 답변

Jonathan Sullivan
Jonathan Sullivan 2012년 2월 27일
do you have a variable named cos?
whos cos
If you do, you will want to clear it out.
clear cos
  댓글 수: 1
Sean de Wolski
Sean de Wolski 2012년 2월 27일
+1.
Sefa, copying and pasting your code above works with no variables named cos()

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

sefa
sefa 2012년 2월 27일
Thanks for your answer

카테고리

Help CenterFile Exchange에서 Sensor Models에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by