-
May 10th, 2018, 07:12 AM
#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;
Readln;
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.
-
May 10th, 2018, 07:16 AM
#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
-
October 30th, 2018, 03:37 AM
#3
Re: MatLab help needed
Update:
Found the Euler Method Matlab Code thread on MathWorks. Solved.
-
October 30th, 2018, 03:39 AM
#4
-
April 21st, 2020, 04:13 AM
#5
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.
-
October 9th, 2020, 07:29 AM
#6
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|