From: Lucky on
clc,clear all,
% xin = [-5 -5 -3 -3 -1 -1 1 1 3 3 5 5 ];
n = input('enter n');
f = inline('(exp(x)-1)/(exp(x)+1)');
z = linspace(-5,5);
plot(z,(exp(z)-1)./(exp(z)+1))
syms x;
T = zeros(1,n);
T = [1, x];
for i = 3:n
T(i) = 2.*x.*T(i-1) - T(i-2);
end
hold on
p = T(n)
ps = simplify(p)
for i = 1:n
x(i) = cos(((2*i-1)*pi)/(2*n))
end
x
tempP4 = double(subs(p,x))
P4 = double(tempP4)
plot(x,P4)

In the above program I am getting the following error..

??? Error using ==> plot
Conversion to double from sym is not possible.

Error in ==> Ass1_Project_4_5 at 22
plot(x,P4)

Anybody has any idea whats wrong..
Thanks..
From: us on
Lucky:
<SNIP small oversight...

...
syms x;
...
plot(x,P4)

should read
plot(double(x),P4);

us
From: Lucky on
us wrote:
>
>
> Lucky:
> <SNIP small oversight...
>
> ...
> syms x;
> ...
> plot(x,P4)
>
> should read
> plot(double(x),P4);
>
> us
Thank you very much