I want to take the graph of x and y points with plot function, pointx is okay, but there is a error with pointy1, and i think because it is a function respect to x.
When i delete @(x), it says "x is a undefined function or variable."
Can you help me?
clc;clear all;pointx = [-2 -1 0 1 2];pointy1 =@(x) (2 - atan(x));x = linspace(-5,5);n = size(pointx, 2);L = ones(n, size(x,2));for i=1:n for j=1:n if (i~=j) L(i,:).*(x-pointx(j))/(pointx(i)-pointx(j)); end endendy = 0;for i=1:n y = y + pointy1(i)*L(i,:);endy1 = y;plot(pointx, pointy1, 'r', x, y1, 'c--o');hold on;
Best Answer