help-octave
[Top][All Lists]
Advanced

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

Re: Getting started with functions


From: David Bateman
Subject: Re: Getting started with functions
Date: Thu, 01 Jun 2006 07:28:21 +0200
User-agent: Mozilla Thunderbird 1.0.6-7.6.20060mdk (X11/20050322)

Andrew Barnes wrote:
> 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.
> 

This should work with both 2.1.7x and 2.9.x. What version of octave are
you using?

D.


reply via email to

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