[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Question about vector function integration
From: |
Corsair |
Subject: |
Question about vector function integration |
Date: |
Wed, 12 Nov 2008 21:05:40 +0800 |
User-agent: |
Mutt/1.5.18 (2008-05-17) |
Hi all. Anyone know how to use `quad' to integrate a vector function?
I have the following code:
global w = 2;
global C = 0.2;
global I = 1;
global r0 = [2;0;5];
function vr = r(t)
global w;
vr = [sin(w * t); cos(w*t); 0.8*t];
endfunction
function vt = tang(t)
global w;
vt = [w*cos(w*t); -1*w * sin(w*t); 0.8];
endfunction
function db = dB(t)
global C I r0;
db = C .* I .* cross(tang(t), r(t) - r0) ./ norm(r(t) - r0)^3;
endfunction
[v, ier, nfun, err] = quad("dB", 0, 12)
Running this script yield the following result:
v = -0.041123
ier = 0
nfun = 399
err = 1.5253e-09
With several screen of "warning: implicit conversion from real matrix
to real scalar".
What does this mean? Why is `v' not a vector?
--
There is no emotion; there is peace.
There is no ignorance; there is knowledge.
There is no passion; there is serenity.
There is no death; there is the Force.
pgpgSPn1TwWk5.pgp
Description: PGP signature
- Question about vector function integration,
Corsair <=