why am i receiving error message array indices must be positive integers or logical values for the
Fantastic news! We've Found the answer you've been seeking!
Question:
why am i receiving error message "array indices must be positive integers or logical values" for the below code in MATLAB
Transcribed Image Text:
f=@ (t, x, y, z) 10* (y-x); g-@ (t, x, y, z) x* (28-z)-y; h-@ (t, x, y, z) x*y-((8/3) *z); function 3 function 1 function 2 Delta=0.0001; step size t=0: Delta: 50; n= (50-0) /Delta; number of points Initial conditons x (0)=0; y (0)=1; z (0)=0; Rk4 for system for i=1:n Kl Delta* f (t(i),x(i),y(i), z(i)); Ll=Delta*g (t(i),x(i),y(i),z (1));| Ml Delta *h (t(i),x(i),y(i), z (i)); K2 Delta f (t (1) +Delta/2,x(i) +K1/2, y(i) +L1/2, z (i) +M1/2); L2-Delta*g (t (i) +Delta/2,x(i) +K1/2, y(i) +L1/2, z (i) +M1/2); M2 Delta h (t (i) +Delta/2,x(i) +K1/2,y(i) +L1/2, z (1) +M1/2); K3 Delta* f (t (i) +Delta/2,x(i) +K2/2, y(i)+L2/2) ;z (1) +M2/2; L3 Delta*g (t (1) +Delta/2, x (1) +K2/2, y (1) +12/2, z (1) +M2/2); M3-Delta*h (t (1) +Delta/2,x(i) +K2/2,y (1)+L2/2, z (1) +M2/2): K4 Delta f (t (i) +Delta,x(i) +K3, y (1) +L3, z (1) +M3); L4-Delta g (t (1) +Delta,x (1) +K3, y (1)+L3, z (1) +M3) ; M4 Delta h (t (1) +Delta, x (1) +K3, y (1) +L3, z (1) +M3) ; x (1+1)=x (1) + (1/6) (K1+2 K2+2 K3+K4); y (1+1) -y (1) + (1/6)* (L1+2 12+2*13+14); z (1+1)=z (1) + (1/6) (M1-2 M2+2 M3+M4); end plot (x, y, z, '='); f=@ (t, x, y, z) 10* (y-x); g-@ (t, x, y, z) x* (28-z)-y; h-@ (t, x, y, z) x*y-((8/3) *z); function 3 function 1 function 2 Delta=0.0001; step size t=0: Delta: 50; n= (50-0) /Delta; number of points Initial conditons x (0)=0; y (0)=1; z (0)=0; Rk4 for system for i=1:n Kl Delta* f (t(i),x(i),y(i), z(i)); Ll=Delta*g (t(i),x(i),y(i),z (1));| Ml Delta *h (t(i),x(i),y(i), z (i)); K2 Delta f (t (1) +Delta/2,x(i) +K1/2, y(i) +L1/2, z (i) +M1/2); L2-Delta*g (t (i) +Delta/2,x(i) +K1/2, y(i) +L1/2, z (i) +M1/2); M2 Delta h (t (i) +Delta/2,x(i) +K1/2,y(i) +L1/2, z (1) +M1/2); K3 Delta* f (t (i) +Delta/2,x(i) +K2/2, y(i)+L2/2) ;z (1) +M2/2; L3 Delta*g (t (1) +Delta/2, x (1) +K2/2, y (1) +12/2, z (1) +M2/2); M3-Delta*h (t (1) +Delta/2,x(i) +K2/2,y (1)+L2/2, z (1) +M2/2): K4 Delta f (t (i) +Delta,x(i) +K3, y (1) +L3, z (1) +M3); L4-Delta g (t (1) +Delta,x (1) +K3, y (1)+L3, z (1) +M3) ; M4 Delta h (t (1) +Delta, x (1) +K3, y (1) +L3, z (1) +M3) ; x (1+1)=x (1) + (1/6) (K1+2 K2+2 K3+K4); y (1+1) -y (1) + (1/6)* (L1+2 12+2*13+14); z (1+1)=z (1) + (1/6) (M1-2 M2+2 M3+M4); end plot (x, y, z, '=');
Expert Answer:
Answer rating: 100% (QA)
The code you provided seems to contain several syntax errors and inconsistencies Heres the modified ... View the full answer
Related Book For
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill
Posted Date:
Students also viewed these programming questions
-
Why should a writer avoid the opening I am sending this e-mail because we have just hired a new manager, and I would like to introduce her?
-
For any positive integer n, the MATLAB command P = pascal(n) will generate an n à n matrix P whose entries are given by The name pascal refers to Pascal's triangle, a triangular array of...
-
In computing depreciation, three values must be known or estimated; identify and explain the nature of each.
-
Calculate the following limits at infinity. If necessary, use -inf and inf to denote -co and co. Use DNE if a limit does not exist. 1. lim e = 818 2. lim e = 8178 3. lim In(x) 24x In(x) =
-
Distinguish between adverse selection and moral hazard as they relate to the insurance industry.
-
Write the partial fraction decomposition of each rational expression. ( 1)( 2)
-
What the differences are between civil litigation and other types of litigation
-
Jennifer Ross, an employee of Hampton Company, worked 44 hours during the week of February 9 through 15. Her rate of pay is $ 30 per hour, and she receives time- and- a- half for work in excess of 40...
-
The following data were produced by a marketing team for BrewHub, a craft beer manufacturer owned by a large brewing firm. Is BrewHub doing well or poorly over time with its marketing efforts and...
-
A storeroom is used to organize items stored in it on N shelves. Shelves are numbered from 0 to N-1. The K-th shelf is dedicated to items of only one type, denoted by a positive integer A[K]....
-
Moon Corporation JULY 31, 2011 Balance sheet July 31, 2011 AssetsLiabilities & Owners Equity Cash . . . . . . . . . . . . . . . . $ 18,000Liabilities: Accounts Receivable . . . 26,000Notes...
-
Which tool can provide a single unified management experience in Azure for enterprises to govern, monitor, operate, and analyze backups at scale?
-
Which method do you prefer to deploy? A cloud hosted MS SQL server or using the Azure SQL service? Please explain your decision and provide supporting material in your decision ?
-
A user working from Chat wants to turn Jasper's responses into long form content. What would you recommend?
-
Which three parameters are mandatory when adding a device manually?
-
A hardware salesman measures the mass of a box containing 1000 washers. The mass is 1.5466 kg. What is the mass of a single washer in milligrams? Writ your answer as a decimal. 0 mg
-
3. Information: Unadjusted balance in Allowance for Doubtful Accounts Sales Sales Returns and Allowances Accounts Receivable, December 31 $ 165(credit) books. 400,000 6,000 80,000 Required: quired...
-
Prove the following D,(cos x) = - sin x (Hint: Apply the identity cos(A + B) = cos A cos B sin A sin B)
-
Carol Harris, Ph.D, CPA, is a single taxpayer and she lives at 674 Yankee Street, Durham, NC 27409. Her Social Security number is 793-52-4335. Carol is an Associate Professor of Accounting at a local...
-
Lisa Sizemore, a taxpayer in the 10-15 percent tax bracket, purchased stock as an investment on July 11, 2011. She sold the stock on July 9, 2012, 2 days before qualifying for the long-term holding...
-
Cedar Corporation has an S corporation election in effect. During the 2012 calendar tax year, the corporation had ordinary taxable income of $200,000, and on January 15, 2012, the corporation paid...
-
The equations of motion of a two-degree-of-freedom system are given by where \(F_{1}(t)\) denotes a rectangular pulse of magnitude 5 acting over \(0 \leq t \leq 2\). Find the solution of the...
-
Find the response of a simple pendulum numerically by solving the linearized equation: \[\ddot{\theta}+\frac{g}{l} \theta=0\] with \(\frac{g}{l}=0.01\) and plot the response, \(\theta(t)\), for \(0...
-
Find the response of a simple pendulum numerically by solving the exact equation: \[\ddot{\theta}+\frac{g}{l} \sin \theta=0\] with \(\frac{g}{l}=0.01\) and plot the response, \(\theta(t)\), for \(0...
Study smarter with the SolutionInn App