Exporting data from figure

clear all;
x = chebfun('x',[-3.5 3.5]);
w =(x.*x);
N = 2;
P = OrthPoly(w,N);
format long
figure
plot(P)
title('Orthogonal polynomials on [-3.5,3.5] wrt w = (x.*x)');
I am not able to get the values of P(:,1) and P(:,2). I am able to plot it. Any suggestions?

4 Commenti

Please do share chebfun?
KSSV
KSSV il 17 Lug 2019
Function orthPoly also...
function P = OrthPoly(w,N)
if isnumeric(w),
%w=x*x;
w = chebfun(w,[-1 1]);
end
d = w.ends; % The domain
x = chebfun('x',d); % Linear chebfun
P(:,1) = chebfun(1./sqrt(sum(w)),d); % The constant (normalised)
for k = 1:N;
% xk = x.^k;
xk = x.*P(:,k);
P(:,k+1) = xk;
for j = 1:k % Subtract out the components
C = sum(w.*xk.*P(:,j));
P(:,k+1) = P(:,k+1) - C*P(:,j);
end
P(:,k+1) = P(:,k+1)./sqrt(sum(w.*P(:,k+1).^2)); % normalise
end
end

Accedi per commentare.

Risposte (0)

Categorie

Scopri di più su Mathematics in Centro assistenza e File Exchange

Tag

Richiesto:

il 17 Lug 2019

Commentato:

il 17 Lug 2019

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by