- #1

- 7

- 0

and I need 21 roots between [-1,1] equidistant (the points to be at same distance from one to another)

can i find the roots with some function in matlab? i found out just the polyval function for polynom

You are using an out of date browser. It may not display this or other websites correctly.

You should upgrade or use an alternative browser.

You should upgrade or use an alternative browser.

- Thread starter kappa
- Start date

- #1

- 7

- 0

and I need 21 roots between [-1,1] equidistant (the points to be at same distance from one to another)

can i find the roots with some function in matlab? i found out just the polyval function for polynom

- #2

gb7nash

Homework Helper

- 805

- 1

- #3

- 7

- 0

yes i was rong i need the value of f(x)=... when x is from [-1,1] (for 21 values) I do it with fsolve?

- #4

gb7nash

Homework Helper

- 805

- 1

yes i was rong i need the value of f(x)=... when x is from [-1,1] (for 21 values) I do it with fsolve?

Do you just want to plug in 21 equidistant values of x between [-1,1] and find what f(x) is for each value? If so, you could use:

x_values = linspace(-1,1,21)

y_values = subs(y,x) 'y is the function in terms of x

- #5

- 7

- 0

Do you just want to plug in 21 equidistant values of x between [-1,1] and find what f(x) is for each value? If so, you could use:

x_values = linspace(-1,1,21)

y_values = subs(y,x) 'y is the function in terms of x

yes so if I define my function so:

function y=f(x);

y=(1-6*x^2)^-1;

>> x_values = linspace(-1,1,21)

>> y_values= subs(? ?

- #6

gb7nash

Homework Helper

- 805

- 1

syms x;

x_values = linspace(-1,1,21)

y_values = subs((1 − 6x^2)^-1,x)

- #7

- 7

- 0

syms x;

x_values = linspace(-1,1,21)

y_values = subs((1 − 6x^2)^-1,x)

I tried but didn`t work I managed to make a functions

function test;

f=inline('(1-6*x^2)^-1');

x_values =linspace(-1,1,21);

for i= 1:21

y_values(1,i)=f(x_values(1,i))

end;

thanks for the linspace code it helped me :]

Share:

- Replies
- 2

- Views
- 1K