help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Getting started with functions


From: Andrew Barnes
Subject: Getting started with functions
Date: Wed, 31 May 2006 14:44:24 -0300

I'm trying the model a solonoid and the first thing I want to do is get
Octave to calculate the field due to a single loop.

I have the following code in a function but it does not work.  Any help
would be appreciated.


## I is the current
## R is the radius
## a is the radus at which we want to know the field strength
## z is the height relative to the loop.
function Hz = hz_single_loop(I,R,a,z)
        F = @(phi) (1-a./R*cos(phi))./(a./R^2+z./R^2+1-2*a./R*cos(phi)).^1.5;
        Hz = I./(4*pi*R).*quad(F,0,6.28);
endfunction

I'm having trouble setting started in Octave.  I'm finding the learing curve
steep.

====================================
Andrew Barnes P.Eng
AMIRIX Systems Inc.
77 Chain Lake Drive
Halifax, Nova Scotia  B3S 1E1
Tel: 902-450-1700, ext. 298
Fax: 902-450-1704

Important:  This e-mail and any files transmitted with it are private and
confidential and are solely for the use of the addressee.  It may contain
material which is legally privileged.  If you are not the addressee or the
person responsible for delivering to the addressee, be advised that you have
received this e-mail in error and that any use of it is strictly prohibited.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]