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

# Thread: MatLab help needed

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]:=0.2; y[0]:=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]=0.20 y[0]=1.20
Х[1]=0.30 y[1]=1.29
Х[2]=0.40 y[2]=1.40
Х[3]=0.50 y[3]=1.52
Х[4]=0.60 y[4]=1.65
Х[5]=0.70 y[5]=1.79
Х[6]=0.80 y[6]=1.95
Х[7]=0.90 y[7]=2.12
Х[8]=1.00 y[8]=2.31
Х[9]=1.10 y[9]=2.52
Х[10]=1.20 y[10]=2.75

Thanks.

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

3. ## Re: MatLab help needed

Update:

Found the Euler Method Matlab Code thread on MathWorks. Solved.

4. ## Re: MatLab help needed

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.

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.

#### Posting Permissions

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

Click Here to Expand Forum to Full Width