Skocz do zawartości

Recommended Posts

Napisano

Witam, mój problem polega na tym, że wykres nie zgadza się z punktami. Do końca też nie jestem pewien czy mój algorytm jest dobry. Proszę o pomoc.

clc
clear all
close all
x = input('Podaj wspolczynniki: ')
y = input('Podaj wspolczynniki: ')
dl = length(x)
n = ones(dl)

for i=1:dl
    for j=2:dl
        n(i,j) = x(i).^y(j-1)
    end
end

A = y*inv(n)
plot(x, y, 'Or')
hold on;
hx = max(x)
lx = min(x)
x2 = lx:0.2:hx
dl2 = length(A)
dl3 = length(x2)
s=A(:,1)
p=1;
for i=2:dl2
    z=A(:,i);
    s=s+z.*x2.^p
    p=p+1
end

plot(x2, s)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Gość
Odpowiedz...

×   Wkleiłeś zawartość bez formatowania.   Usuń formatowanie

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Utwórz nowe...