CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com

1. ## MatLab help needed

Hi
Please, help me with this one:
Program Eyler;
Uses
Crt;
Const
H=0.1;
Var
X,y:array[0..100] of real;
I:integer;
Function f(x,y:real):real;
Begin
F:=0.218*(x*x+sin(1.6*x)+0.718*y);
End;
Begin
Clrscr;
For i:=0 to 9 do
Begin
X:=0.2; y:=1.2;
X[i+1]:=x[i]+h;
Y[i+1]:=y[i]+f(x[i],y[i])*h; {Eiler's formula}
Writeln (x[,I,]=, x[i]:3:2);
Writeln (y[,I,]=, y[i]:3:2);
End;
End.

Results
Х=0.20 y=1.20
Х=0.30 y=1.29
Х=0.40 y=1.40
Х=0.50 y=1.52
Х=0.60 y=1.65
Х=0.70 y=1.79
Х=0.80 y=1.95
Х=0.90 y=2.12
Х=1.00 y=2.31
Х=1.10 y=2.52
Х=1.20 y=2.75

Thanks.  Reply With Quote

2. ## Re: MatLab help needed

I've been looking for some instant MatLab sections on MathsNinja and MathsGurus, Perhaps, any ideas on the process. I know that it will take perhaps several pages to write down in detail.
Last edited by 2kaud; May 10th, 2018 at 08:32 AM. Reason: Removed advertising link  Reply With Quote

3. ## Re: MatLab help needed

Update:

Found the Euler Method Matlab Code thread on MathWorks. Solved.  Reply With Quote

4. ## Re: MatLab help needed  Reply With Quote

5. Junior Member Join Date
Apr 2020
Posts
0

## Re: MatLab help needed Originally Posted by terencemall Nice to know that you've found a timely solution to your matlab programming problem. I've followed the link, which you've provided by you and have found some interesting coding advice I'm about to use in my code.  Reply With Quote

6. Junior Member Join Date
Sep 2020
Posts
13

## Re: MatLab help needed

Common errors in matlab:-
1. Error using * Inner matrix dimensions must agree.

2. Index exceeds matrix dimensions.

3. Subscript indices must either be real positive integers or logicals.

4. The expression to the left of the equals sign is not a valid target for an assignment.

5. Subscripted assignment dimension mismatch.  Reply With Quote

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•