help-octave
[Top][All Lists]
Advanced

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

Re: Auto-inflating series


From: Richard Mayo
Subject: Re: Auto-inflating series
Date: Tue, 8 Mar 2016 11:23:42 +0000
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0

Thank you Doug for your prompt reply. Now to get my head around it....

TTFN
    Richard.

On 08/03/2016 11:07, Doug Stewart wrote:


On Tue, Mar 8, 2016 at 3:25 AM, Richard Mayo <address@hidden> wrote:
I say chaps,
    I need to generate a series _expression_, like a Fourier series, but with a finite number of terms, that number being an integer variable. Coefficients within each term will also be variables, but that's not the problem.
It sounds like some string manipulation is called for, with a loop statement concatenating terms as required. Then I need to turn that string into an _expression_ to be evaluated. How do I do that? All help gratefully received.

TTFN
    Richard.

_

I am not sure what you are talking about, but here is what I did with strings and functions.

There are other ways also.


 # This prog. shows how to take a
# sring input and make it into an anonymous function
# this uses the symbolic pkg.
disp("Example input")
disp("x^2 + 3*x - 1 + 5*x*sin(x)")
str_fucn=input("please enter your function  ","s")
fucn_sym=sym(str_fucn)
f=function_handle(fucn_sym)
# now back to symbolic
syms x;
ff=formula(f(x));
etc.
-- 
HTH
DAS



reply via email to

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