|
"Gerry Puckett" <egpuckett@ucdavis.edu> wrote in message <ge57lp$qai$1@fred.mathworks.com>...
> I'm using the symbolic toolbox to determine certain values; e.g.,
>
> Column_1 = int(3 / 2 + tanh(z), z, -3/2, -1/2)
> Column_2 = int(3 / 2 + tanh(z), z, -1/2, 1/2)
> Column_3 = int(3 / 2 + tanh(z), z, 1/2, 3/2)
>
> from which I want to create a function, say f(x), that I will then plot. Say f(x) is a line
>
> f(x) = a * x + b
>
> where the slope a is defined by
>
> a = (Column_3 - Column_1) / 2
>
> and b is say
>
> b = 1.5
>
> I've already made an array of values x as follows:
>
> xmin = -3/2;
> xmax = 3/2;
>
> dxx = 1 / 1000;
>
> x = xmin : dxx : xmax;
>
> and I am able to use this array to plot the function defined by
>
> g = (3 / 2 + tanh(x));
>
> However, whenever I try to define an array of values for the function f(x) say by
>
> m = vpa(a);
>
> f = m * x + b;
>
> plot(x, f);
>
> I get the following error message:
>
> ??? Error using ==> plot
> Conversion to double from sym is not possible
>
> I would have assumed that m was a numerical variable, not a symbolic one, since the output of vpa is a NUMBER.
>
> My questions are the following:
>
> 1) Is there a function in MATLAB that I can use to determine what type of variable m is, say
>
> whatis(m)
>
> 2) How do I convert the (presumably) symbolic result
>
> a = (Column_3 - Column_1) / 2
>
> into a form that I can use to define an array of numerical values that I can plot.
>
> Thanks!
>
> - EGP
>
isa(m,'sym') tests for symbolic
double(m) converts symbolic to real
dave y.
|