[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Global variables in function
From: |
Corsair |
Subject: |
Global variables in function |
Date: |
Wed, 12 Nov 2008 13:42:22 +0800 |
User-agent: |
Mutt/1.5.18 (2008-05-17) |
Hi all. I have the follow code:
global w = 2;
global C = 1;
global I = 1;
function vr = r(t)
vr = [sin(w * t), cos(w*t), t];
endfunction
function vt = tang(t)
vt = [w*cos(w*t), -w * sin(w*t), 1];
endfunction
function db = dB(t, r)
db = I * cross(tang(t), f(t) - r) / norm(f(t) - r)^3;
endfunction
dB(1, [1,2,3])
When I run this script, Octave told me that
error: `w' undefined near line 12 column 9
error: evaluating binary operator `*' near line 12, column 10
error: evaluating assignment expression near line 12, column 6
error: called from `tang'
error: evaluating argument list element number 1
error: evaluating binary operator `*' near line 16, column 10
error: evaluating binary operator `/' near line 16, column 37
error: evaluating assignment expression near line 16, column 6
error: called from `dB'
error: near line 19 of file `test.oct'
Anyone know the problem?
--
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.
pgprlmZv2tAaH.pgp
Description: PGP signature
- Global variables in function,
Corsair <=