#### Error: Subscript indices must either be real positive integers or logicals.

```I keep getting the error "Subscript indices must either be real positive integers or logicals." at the line where I try to define sys...what gives?

% MEEG 4213 HW2.11     February 25, 2011     9:00 pm     R. Leonard
% This program calculates and plots the position of a car and its wheel
%  after the car hits a bump. After looking at graphs with different values
%  of b, it should be clear what a desirable damping coefficient would
%  be to give passengers a smooth ride.

b = input('b value: ');     % Allows user to designate damping coefficient
tf = input('end time: ');   % User-defined end-time of analysis (t0 = 0)
ti = input('time increment: ');     % User-defined time increment (sec)
t = 0:ti:tf;    % Definition of time array, t
m1 = 10;    % Mass 1 is 10 kg
m2 = 350;   % Mass 2 is 350 kg
kw = 500000;    % Spring constant of kw is 500000 N/m
ks = 10000;     % Spring constant of kw is 10000 N/m
num = (kw*b/(m1*m2))*[1 ks/b];    % Numerator of equation 2.12 in book
den = [1 (b/m1+b/m2) (ks/m1+ks/m2+kw/m1) (kw*b)/(m1*m2) kw*ks/(m1*m2)];
% Denominator of equation 2.12 in book...Note s^4 term, s^3 term, s^2 term,
%  s^1 term, and the constant. Spaces separate these terms.
sys = tf(num,den);  % MATLAB required internal definition of the 'system'
y = step(sys, t);   % Returns array data in y for each t value
plot(t, y)  % Plots the results
title('HW2.11 Position of Car and Wheel After Hitting Bump')
xvalue('time (s)')
yvalue('position (m)')
```
 0
Rebecca
2/27/2011 9:06:29 PM
comp.soft-sys.matlab 208209 articles. 6 followers. lunamoonmoon (258) is leader.

5 Replies
994 Views

Similar Articles

[PageSpeed] 53
```On 2/27/2011 3:06 PM, Rebecca wrote:
> I keep getting the error "Subscript indices must either be real positive
> integers or logicals." at the line where I try to define sys...what gives?
....
> b = input('b value: '); % Allows user to designate damping coefficient
> tf = input('end time: '); % User-defined end-time of analysis (t0 = 0)
....
> sys = tf(num,den); % MATLAB required internal definition of the 'system'
....

You've used tf as a ordinary variable, then either are trying to refer
to an (thereby aliased) function of the same name or a 2D array instead
(which is what Matlab thinks).

Not enough data to tell what you intend but clear what confused Matlab.

--
```
 0
dpb
2/27/2011 10:14:07 PM
```"Rebecca" wrote in message <ikeecl\$r5r\$1@fred.mathworks.com>...
> I keep getting the error "Subscript indices must either be real positive integers or logicals." at the line where I try to define sys...what gives?
>
> % MEEG 4213 HW2.11     February 25, 2011     9:00 pm     R. Leonard
> % This program calculates and plots the position of a car and its wheel
> %  after the car hits a bump. After looking at graphs with different values
> %  of b, it should be clear what a desirable damping coefficient would
> %  be to give passengers a smooth ride.
>
> b = input('b value: ');     % Allows user to designate damping coefficient
> tf = input('end time: ');   % User-defined end-time of analysis (t0 = 0)
> ti = input('time increment: ');     % User-defined time increment (sec)
> t = 0:ti:tf;    % Definition of time array, t
> m1 = 10;    % Mass 1 is 10 kg
> m2 = 350;   % Mass 2 is 350 kg
> kw = 500000;    % Spring constant of kw is 500000 N/m
> ks = 10000;     % Spring constant of kw is 10000 N/m
> num = (kw*b/(m1*m2))*[1 ks/b];    % Numerator of equation 2.12 in book
> den = [1 (b/m1+b/m2) (ks/m1+ks/m2+kw/m1) (kw*b)/(m1*m2) kw*ks/(m1*m2)];
> % Denominator of equation 2.12 in book...Note s^4 term, s^3 term, s^2 term,
> %  s^1 term, and the constant. Spaces separate these terms.
> sys = tf(num,den);  % MATLAB required internal definition of the 'system'
> y = step(sys, t);   % Returns array data in y for each t value
> plot(t, y)  % Plots the results
> title('HW2.11 Position of Car and Wheel After Hitting Bump')
> xvalue('time (s)')
> yvalue('position (m)')
```
 0
Wayne
2/27/2011 10:21:21 PM
```"Rebecca" wrote in message <ikeecl\$r5r\$1@fred.mathworks.com>...
> I keep getting the error "Subscript indices must either be real positive integers or logicals." at the line where I try to define sys...what gives?
>
> % MEEG 4213 HW2.11     February 25, 2011     9:00 pm     R. Leonard
> % This program calculates and plots the position of a car and its wheel
> %  after the car hits a bump. After looking at graphs with different values
> %  of b, it should be clear what a desirable damping coefficient would
> %  be to give passengers a smooth ride.
>
> b = input('b value: ');     % Allows user to designate damping coefficient
> tf = input('end time: ');   % User-defined end-time of analysis (t0 = 0)
> ti = input('time increment: ');     % User-defined time increment (sec)
> t = 0:ti:tf;    % Definition of time array, t
> m1 = 10;    % Mass 1 is 10 kg
> m2 = 350;   % Mass 2 is 350 kg
> kw = 500000;    % Spring constant of kw is 500000 N/m
> ks = 10000;     % Spring constant of kw is 10000 N/m
> num = (kw*b/(m1*m2))*[1 ks/b];    % Numerator of equation 2.12 in book
> den = [1 (b/m1+b/m2) (ks/m1+ks/m2+kw/m1) (kw*b)/(m1*m2) kw*ks/(m1*m2)];
> % Denominator of equation 2.12 in book...Note s^4 term, s^3 term, s^2 term,
> %  s^1 term, and the constant. Spaces separate these terms.
> sys = tf(num,den);  % MATLAB required internal definition of the 'system'
> y = step(sys, t);   % Returns array data in y for each t value
> plot(t, y)  % Plots the results
> title('HW2.11 Position of Car and Wheel After Hitting Bump')
> xvalue('time (s)')
> yvalue('position (m)')

You can't define a variable named tf and then try to call a function tf(). You've defined tf as a scalar.
You should avoid naming variables the same as a MATLAB function, method, object, etc.

Wayne
```
 0
Wayne
2/27/2011 10:23:05 PM
```sorry that book is this equation?

num = (kw * b) / (m1 * m2) * [1 ks / b];
den = [1, (b/m2 b/m1 +), (+ kw/m1 ks/m2 ks/m1 +), (kw * b) / (m1 * m2), (kw * ks) / (m1 * m2)];
```
 0
William
4/2/2014 3:50:14 PM
```sorry that book is this equation?
num = (kw * b) / (m1 * m2) * [1 ks / b];
den = [1, (b/m2 b/m1 +), (+ kw/m1 ks/m2 ks/m1 +), (kw * b) / (m1 * m2), (kw * ks) / (m1 * m2)];
```
 0
William
4/2/2014 3:55:11 PM
Similar artilces about - Error: Subscript indices must either be real positive integers or logicals.:

Neural network fitting error
Dear all, Is there any way to calculate the correctness of the neural network results? Or if I explain the situation: I create a neural network using fitting tool, using input-output vectors. When I simulate the created network with only one input vector, I get an output but I don&#8217;t know if the output is correct or not. How can I calculate kind of error or correctness degree for the output of the simulated network? I hope I could voice what my problem is. Thanks in advance. "John " <onsekizdegilim@yahoo.co.uk> wrote in message news:ic6524\$2i6\$1@fr...

ArcServe & UNRECOVERABLE DATA ERROR
I've installed BrightStore ArcServe v11 in a Windows 2000 Server's machine. The DDS4 tapes worked OK for a couple of weeks, and suddenly this error (UNRECOVERABLE DATA ERROR) started to appear and I can't even format the tapes. I've tried using the cleaning tapes (I've bought a new one too), and cleaning it manually with no luck. Does anyone have n idea of what can be happening? Thanks a lot! ...

Error bars in both axes of a XY plot
Hello, I have some data with some uncertainty, both in X and Y axes. I am supposed to plot the data including the uncertainties, as error bars. I was looking for a function in Matlab that includes the error bars in both axes but found nothing. It is possible to do it for Y, and I found a file in the file exchange page which allows to do the same for the X axis. However, how can I do both of them simultaneously? Any help is greatly acknowledged in advance. Regards, Jose ...

Error: RCPT TO: error (550 relay not permitted)
Copied the below code straight from a web source ( http://alma.ch/perl/Mail-Sendmail-FAQ.html#HTML ) on sending html emails w/ PERL. The ONLY change I made was to put GOOD email addresses in the TO / From I am getting the following errror and need help? ---------Error: RCPT TO: error (550 relay not permitted) ------------- ======================================= use MIME::QuotedPrint; use HTML::Entities; use Mail::Sendmail 0.75; # doesn't work with v. 0.74! \$boundary = "====" . time() . "===="; \$text = "HTML mail demo\n\n" . "This is the m...

US-TX+NJ CCIE positions
Need mutiple consultants with Frame/ATM/IP expertise with Heavy Cisco Certifications, ideally CCIE's. Multiple openings in TX in NJ. -- Carmen Cholette Technical Recruiter Compu-Source Staffing Inc. 2200 Yonge St., Suite 1004 Toronto ON carmen@staffingsuccess.com Tel 416-482-4009 ex 227 Fax416-482-4093 www.staffingsuccess.com ...

I have a problem. My VI is showing a error, but in the error list they say error = 0
The arrow is broken, but the error list is clear. I can't see the error and I can't run the VI. Someone have some suggest? Hello Luis i have seen this behaviour by myself after changing a StrictTypedef and save/closing it without "Apply Changes". Maybe a Masscompile helps. greetings chris Thank you Chris. How do you have the solution? ...

Fuzzy Logic TBX Error
Hallo. I try to identify a Sugeno type of model from input data, relatively high number of inputs, and the TBX crashes with the followign error: ??? Error using ==> unknown Maximum variable size allowed by the program is exceeded. Error in ==> genfis2 at 101 muMatrix = zeros(numData,numRule * (numInp + 1)); Error in ==> Generate_Outputs at 39 fismat1 = genfis2(Inputs, outputs(:,1), ClusterR); The memory consumption is MAX 600 MB, out of 1.5 G. Is there a suggestion? ---- code compilation into C I am not sure would not help. Levi ...

[tao-users] Runtime errors-vxworks
ACE VERSION: 5.4 TAO VERSION: 1.4 HOST MACHINE and OPERATING SYSTEM: Windows XP TARGET MACHINE and OPERATING SYSTEM, if different from HOST: COMPILER NAME AND VERSION (AND PATCHLEVEL): Pentium - VxWorks 5.5.1 Tornado 2.2.1 AREA/CLASS/EXAMPLE AFFECTED: Page fauls on vxworks target when running simple application. DOES THE PROBLEM AFFECT: Execution? Yes [Please indicate whether ACE, your application, or both are affected.] Application is affected at runtime. SYNOPSIS: I am building a s...

Math errors
(-3)**3 => -27 (-27)**(1/3.0) give NaN instead of -3 All odd roots (1/3,1/5,1/7 etc) of negative numbers should give negative root values, as above, but ruby (in irb) gives NaN (not a number), even when I require 'complex' . Is this considered an error in Ruby? 2009/12/18 jzakiya <jzakiya@mail.com>: > (-3)**3 => -27 > > (-27)**(1/3.0) give NaN instead of -3 Ruby 1.9 has Math.cbrt. % ruby -e 'p Math.cbrt(-27)' -3.0 -- Tanaka Akira [Note: parts of this message were removed to make it a legal post.] IN 1.9.2 I got: ~ \$>...

I'm running VMS 7.3-2 on a cluster of two ES40 servers. Since moving to this configuration I've noticed that occasionally ( but not reliably reproducibly ) when a program exits I get the following error: %SYSTEM-F-ILLEGAL_SHADOW, illegal formed trap shadow, Imask=0111510C, Fmask=0000001B, summary=0B, PC=000000000000005B, PS=0000001B Improperly handled condition, image exit forced. Signal arguments: Number = 0000000000000003 Name = 00000000000005B4 000000000111510C 000000000000001B ...

of errors
_XKB_RULES_NAMES_BACKUP(STRING) = "xorg", "pc104", "us", "", "" _XKB_RULES_NAMES(STRING) = "xorg", "pc104", "us", "", "" Hello, how are you? How are you doing? To whom it may concern, the Ubuntu version of LINUX is causing problems for me. Initially it worked really goodly, however, it seems to be turning into a MSDOS clone. If you do not mind, kindly resolve this issue. There are a lot of crimes done against devotees here in Brooklyn and New York City. Please be aware I am reporting the s...

What level of timesynch error is typical on Win XP?
I have a small network of Windows XP (64 bit) running simulations, with NTPv4 running on all the boxes and using a GPS-based timeserver on the company network. The ping time to the server is 2 milliseconds from my desk, but I'm seeing random time errors of order plus/minus 5 to 10 milliseconds, based on loopstats data. This level of timesynch error is OK for the simulation, but still that's a lot of error. I get far better on big UNIX boxes. The question is if this level of error is reasonable, given the setup. I know that timekeeping under Windows is not optimum, but cannot...

Comtool errors in image processing
Hi, I am trying to build a dll using the comtool for some application in Image processing. It's a simple code but when I try to build using comtool. I get the following errors( see th list of errors). Is there someway i can work around these errors. Any help will be very useful. --------- Errors----------------------- Building standalone executable... mcc -M -silentsetup -d 'C:/MATLAB6p5/work/OCR/ReadTCAM/src' -B 'csglcom:ReadTCAM,ReadTCAM,1.0' -g -i C:/MATLAB6p5/work/OCR/getTimeCodeAM1.m Warning: File: getline Line: 1 Column: 1 References to "GETLIN...

A QuerrVizier error?
Dear all, I'm having a problem loading data from vizier using the queryvizier.pro. I am thinking it must be new error perhaps due to a new update? I call the program by: OC1 = queryvizier('J/A+A/438/1163/','None',/allcolumns) IDL responds with %Type conversion error: Unable to convert given STRING to Long. % Detected at: QUERYVIZIER 339 C:\Users\MS\Desktop\IDL_functions\vizier\QueryVizier.pro % Conflicting or duplicate structure tag definition: RECNO_2. Line 339 is within the following loop, see arrow for precise mark. ; Find positions of tab...

sysbool.h error building on Tiger
Hi all, When building an Mach-O target under Tiger, I get the following error: stdbool.h line 2 #error "stdbool.h has moved to avoid accidental use with a non-GCC compiler. Only GCC should have used stdbool.h due to licensing restrictions." When I looked at stdbool.h, all it has is the above error pragma. I did a preprocess on my .pch++ to see where stdbool.h is included, but honestly cannot find it. Any ideas for a work around? Best regards, -- Allen Cronce In article <1105552845.007378.311480@f14g2000cwb.googlegroups.com>, "Allen Cronce" ...

tar error
On trying to tar the files in my directory ( tar -cvf a.tar * ) ,I get the following error : "Wrote only 8192 of 10240 bytes tar: Error is not recoverable: exiting now" Please suggest the cause of the error no space left i guess... charlotte wrote: > On trying to tar the files in my directory ( tar -cvf a.tar * ) ,I > get the following error : > "Wrote only 8192 of 10240 bytes > tar: Error is not recoverable: exiting now" > Please suggest the cause of the error > Was there an a.tar in the directory before you issued this command? -- ced -- Ch...

Error?
This integral below give 0 on Mathematica 5.0 Integrate[Sqrt[R^2 - x^2], {x, -R, -R + d}, Assumptions -> R > 0 && d > 0 && d < 2R] This is a mistake I think, isn't it? Thanks, Baris Altunkaynak Hello ! Very interesting question ! As Integrate[Sqrt[r^2 - x^2], x] = (1/2)*(x*Sqrt[r^2 - x^2] + r^2*ArcTan[x/Sqrt[r^2 - x^2]]) you will have to use complex numbers using Newton-Leibnitz's formula with R<d<2R ! As (I suppose) you want to compute a surface under a circle, it is not good ! so I would suggest that you should ...

An Odd timer error: Error while evaluating TimerFcn for timer 'timer-1'
Dear Matlab Experts: Very weired error message showed during the execution of timer object. ------------------------------------------------------------------------- Error while evaluating TimerFcn for timer 'timer-1' Could not open file. ------------------------------------------------------------------------- Everything was perfectly fine, for the first 20 times execution of the callback TimerFcn, then suddenly an error poped out as above. What i do not understand is that why there is a limited number of execution for the timer's callback function. My code structur...

oracle linux error "error 46 encountered ldm"
Hello I have Oracle 10G installed on linux red hat GNU i686 then started to get on the oracle alert.log a bunch of error messages "error 46 encountered when initializing ldm" Does anyone seem this before? or the fix Thanks Maria evoradba@yahoo.ca (Maria) wrote in message news:<351fd9d6.0410051730.7cdaf13b@posting.google.com>... > Hello > > I have Oracle 10G installed on linux red hat GNU i686 then started to > get on the oracle alert.log a bunch of error messages "error 46 > encountered when initializing ldm" > > Does anyone seem this before...

disk errors!?
Hi, I would like to know How do I detect any disk errors occured on Solaris 10 (x86) systemand on SPARC tecnology via commands and by a log file? Thanks a lot!!! On 2008-08-12, ABSOLUT <davidtuti@gmail.com> wrote: > Hi, > I would like to know How do I detect any disk errors occured on > Solaris 10 (x86) systemand on SPARC tecnology via commands and by a > log file? /usr/bin/iostat -E -- "Be thankful that you have a life, and forsake your vain and presumptuous desire for a second one." [email me at huge {at} huge (dot...

AI newbie: What is fuzzy logic?
Hi all, I'm new to AI and I would like to learn more about fuzzy logic, can someone send a short definition? and maybe some useful links that can help me start learning the fascinating world of AI? Thanks, Matti. ...

getting bash errors
Hello: I'm using the Net::SSH module. Its really a simple script. It supposed to ssh into a node and do a 'df -k', but I'm getting: bash: -c: line 1: syntax error near unexpected token `0x925c4c8' bash: -c: line 1: `CODE(0x925c4c8)' The above is a bash error, so I'm thinking PERL is not even invoked in the subroutine, any help will be greatly appreciated. ################################################ #!/usr/bin/perl -w use warnings; use strict; use Net::SSH qw(ssh issh sshopen2 sshopen3); my \$variable = \&TEST; ssh('control@10.150.130.1', \$variab...

error: invalid lvalue in increment #2
What is wrong? .... (l_text)d += 1; *d = GetKey(App) & 0xFF; .... thanks flo -- Florian Xaver <http://www.flox.at.tf> Dr-DOS Wiki <http://www.drdos.org> SWORD - a nice GUI library for DOS/DJGPP <http://www.flox.at.tf> the cast transforms a lvalue into a rvalue Florian Xaver wrote: > What is wrong? > > ... > (l_text)d += 1; > *d = GetKey(App) & 0xFF; > ... > > thanks > flo "Florian Xaver" <wosrediinanatour@aon.at> wrote in message news:44670d4b\$0\$3880\$91cee783@newsreader01.highway.telekom.at... > What is wr...

Custom error message for Runtime error 3022
I am trying trap Runtime error 3022 (duplicates) in the click event of a command button that closes the form. I have code in the Form_Error event that does a good job of providing a more meaningful error message than the default. It works in every situation except when the user clicks the close button. I am using Me.Dirty=False to force a save but if there are duplicates I just get the standard Runtime 3022 error message. I am wondering why the Form_Error event is not triggered. Here are the two relevant subs: First the Form_Error Sub... Private Sub Form_Error(DataErr As Integer, Response ...

Error Msg Reading Chinese Novel PDF
I am using English Windows 98 SE2 and Acrobat Reader 6/Adobe Asian Font Pack. I am able to read net based Chinese PDFs in both traditional and similified Chinese fonts. However, I have problems reading downloaded Chinese PDF Novels, e.g. http://hnbc.hpe.sh.cn/01/01B/20/M30a.pdf After opening the novel saved in my computer, few error messages would show: Msg upon the book is opened: "Found an unexpected operator in the display list." Moving into the text page: Cannot find or create the font "���^". Some characters may not display or print correctly ...