help-octave
[Top][All Lists]
Advanced

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

Re: Help Plotting Symbolic Vector Fields with Substitutions


From: Colin Macdonald
Subject: Re: Help Plotting Symbolic Vector Fields with Substitutions
Date: Fri, 21 Apr 2017 08:14:15 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.0

On 21/04/17 12:38 AM, WARDEVIL_UFO wrote:
I have had trouble posting on Nabble's Octave Forum the past 2 days.  I had
this response written Wednesday, but haven't had any luck until now.


Colin Macdonald-2 wrote
I filed a bug to do that: https://github.com/cbm755/octsympy/issues/779.
   Since this is fresh on your mind, perhaps you could suggest a short
paragraph for "help subs" perhaps with a simple example?

Another option: we could overload @sym/quiver3.

thanks,
Colin

I am new to Matlab/Octave.  I don't know what overloading is.  Also, to date
I have never successfully called subs in Octave.  The code you guys saw was
my first attempt to do just that.  I know next to nothing about the approved
applications for subs.  In the above case I attempted copying code I saw
from a MatLab help example.  As far as a simple example, I would be honored
to help!!!!

Cool, maybe we can take that discussion to https://github.com/cbm755/octsympy/issues/779

re, your example below, my first thought was a scalar or 1D example---but I'm not sure. It is nice to show at least partial output (our examples are also part of our test suite).

You could try editing `/some/path/to/octave_packages/@sym/subs.m` directly and see how it looks/reads?

The following code will produce the same vector field plot as Figure 1.14
from Example 1.6 (pg. 39) from A Student's Guide to Maxwell's Equations by
Dr. Daniel Fleisch.  Beware that this code is somewhat custom tailored to
this particular example.
________________________________________________________________________________________________
pkg load symbolic;

syms x y

vector = [sin(pi*y ./ 2); -sin(pi*x ./ 2)];

iComponent = function_handle(vector(1,1));
jComponent = function_handle(vector(2,1));

[X,Y] = meshgrid([-.5:.05:.5]);

figure

quiver(X,Y,iComponent(Y),jComponent(X))
________________________________________________________________________________________________

This example (with fixes per my previous email) would be very good for the wiki.

http://wiki.octave.org/Symbolic_package

Could you post it there? Maybe after the first example in "I'm trying to substitute a double value into an expression, how can I avoid the rats warning?".

Colin



reply via email to

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