-
Matlab to VB6
Hello,
Need Help to translate short code from Matlab to VB6,
the code contain numerical computing, Gradient and Hessian Matrix.
Regards,
Maritime
-
What is the code that needs translating?
I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
Please use [Code]your code goes in here[/Code] tags when posting code.
Before posting your question, did you look here?
Got a question on Linux? Visit our Linux sister site.
Modifications Required For VB6 Apps To Work On Vista
-
Matlab to VB6
Hello,
ML(1, 1) = 3.27419030768864
ML(1, 2) = 1.67217103086368
ML(1, 3) = 0.77642827451032
ML(2, 1) = 1.67217103086368
ML(2, 2) = 1.56451953051059
ML(2, 3) = 1.22506096105216
ML(3, 1) = 0.77642827451032
ML(3, 2) = 1.22506096105216
ML(3, 3) = 3.48985429950068
VL(1) = 2.84044604335216
VL(2) = 2.09345971197122
VL(3) = 3.15558646083793
I need to translate this pat of code:
Code:
while (norm(dF,2)>=1e-12)&(m<1000)
S=dot(Vi,Vi)-1;
dF=2*(ML+2*b*S*eye(3,3))*Vi-2*VL
ddF=2*(ML+2*b*S*eye(3,3))+8*b*(Vi*Vi')
m=m+1
dV=-inv(ddF)*dF
Vi=Vi+dV
end
This is result from matlab:
donc ta matrice ML c'est celle la
ML =
3.274190307688642 1.672171030863679 0.776428274510320
1.672171030863679 1.564519530510586 1.225060961052163
0.776428274510320 1.225060961052163 3.489854299500683
>> VL
VL =
2.840446043352157
2.093459711971220
3.155586460837926
V0
Vi =
1
1
1
le b
b=
4.328564137699911
In this loop we do S, dF, ddF
S=dot(Vi,Vi)-1;
dF=2*(ML+2*b*S*eye(3,3))*Vi-2*VL
ddF=2*(ML+2*b*S*eye(3,3))+8*b*(Vi*Vi')
at the first itération:
S =
2
dF =
40.393200241020260
39.365096722509705
39.300027250049766
ddF =
75.805406818575861 37.972855163326649 36.181369650619928
37.972855163326649 72.386065264219752 37.078635023703612
36.181369650619928 37.078635023703612 76.236734802199948
donc le Vi que tu retrouves c'est
Vi =
0.722525144159246
0.731431659439092
0.746808943305029
et le dV
>> dV
dV =
-0.277474855840754
-0.268568340560908
-0.253191056694971
le Vi final vaut
Vi =
0.670836406672209
0.041286954641636
0.740460615214353
done after 12 iterations proximately,
I am sorry for the comments in French !
Regards,
Maritime
Similar Threads
-
By pfaisalbe in forum .NET
Replies: 1
Last Post: 05-05-2009, 11:26 AM
-
Replies: 1
Last Post: 03-25-2006, 02:40 AM
-
Replies: 0
Last Post: 02-08-2006, 07:16 PM
-
Replies: 1
Last Post: 01-16-2006, 11:20 AM
-
Replies: 0
Last Post: 11-10-2001, 05:06 PM
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
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks