|
From: | James Sherman Jr. |
Subject: | Re: vectorize inline function |
Date: | Sat, 2 Aug 2014 15:00:50 -0400 |
here's the error:
octave-3.6.4.exe:15> secant
Enter Function:x^2*cos(x)-1
error: isinf: not defined for inline function
error: evaluating argument list element number 1
error: evaluating argument list element number 1
error: called from:
error:
D:\Software\Octave-3.6.4\share\octave\3.6.4\m\plot\private\__plt__.m at
line 219, column 3
error:
D:\Software\Octave-3.6.4\share\octave\3.6.4\m\plot\private\__plt__.m at
line 99, column 17
error: D:\Software\Octave-3.6.4\share\octave\3.6.4\m\plot\plot.m at line
196,
column 9
error: D:\Software\Octave-3.6.4\numericals\secant.m at line 11, column 2
octave-3.6.4.exe:15>
here's my code:
function ret = secant()
a = input('Enter Function:','s');t=-5:0.0001:3;
f = inline(a);
#x = t.^2.*cos(t)-1; #<--- this works. just commented it out to try between
the two.
x = vectorize(f); #<---- this code does not
plot(t,x);
axis([-6 4 -15 15])
title('Plot of f(x)=x^2*cos(x)-1')
xlabel('time(t)')
ylabel('f(x)')
grid on
endfunction
I maybe missing something here. I don't know what isinf error either and
according to the manual...
isinf (x) [Mapping Function]
Return a logical array which is true where the elements of x are are
infinite and false
where they are not. For example:
isinf ([13, Inf, NA, NaN])
Also, is there a comment block for octave. It seems %{ %} or #{ #} doesn't
work. I'm using Octave 3.6.4 by the way. Thanks for taking your time in
helping me.
--
View this message in context: http://octave.1599824.n4.nabble.com/vectorize-inline-function-tp4665884p4665891.html
Sent from the Octave - General mailing list archive at Nabble.com.
_______________________________________________
Help-octave mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/help-octave
[Prev in Thread] | Current Thread | [Next in Thread] |