|
yes that's what I mean,
thanks for your help Travis,
Eddy
"Travis " <traviib.nospam.@yahoo.com> wrote in message
<fcmq56$i9h$1@fred.mathworks.com>...
> Is this what you mean?
>
> x=[1:1:10];
> funct = input('function to evaluate = ','s');
> to_evaluate = [funct '(x)'];
> y = eval(to_evaluate)
>
> (should work if you input the correct built in matlab
> function names... ie sin, cos, tan, etc...)
>
> Might be a better way to do it, but I think that might work.
>
> --Travis
>
> "Eddy " <grotehaas@mathworks.com> wrote in message
> <fcmp9t$3vj$1@fred.mathworks.com>...
> > x=[1:1:10]
> > fprintf('please enter a function like sin cos exp etc,\n')
> > fprintf('the calculation performed will be like
> > pfun(funct(x)),\n')
> > fprintf('where funct is your function and x= 0 to 10
> > increment with 1,\n')
> > funct=input('function funct=','s')
> > pfun=funct'(x)'
> >
> > In the technical course we are starting to learn Matlab for
> > signal processing.
> > So now we have to do all kinds of exercises, and I do
like it.
> > But one thing does not fall in to place.
> > In the above script I prompt for a input from the user and
> > store this in a variable 'funct' the input is as a string.
> > now I want to use what is in the string to doe some
> > computing but this last step will not succeed.
> > So if the input would be sin the computation should be
sin(x)
> >
> > Can somebody help me with this probably syntax problem??
> >
> > thanks
> >
> > Eddy
>
|