Index in Position 1

1 Ansicht (letzte 30 Tage)
BoostedMan
BoostedMan am 1 Dez. 2020
Beantwortet: VBBV am 1 Dez. 2020
It keeps saying Index in position 1 exceeds array bounds (Must not exceed 1)
I am fairly new to matlab but I think its saying some value is 0, I am looking for a 4x4 matrix, I have gotten 4x3, but now it only gives me that error and im not sure where I am going wrong.
  3 Kommentare
BoostedMan
BoostedMan am 1 Dez. 2020
How would I change this in order to get zero's above the diagonal in the A matrix?
Walter Roberson
Walter Roberson am 1 Dez. 2020
A = zeros(n-1, n);

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

VBBV
VBBV am 1 Dez. 2020
%Lab 8
%Jack Philibotte
%--------------------
%Polynomial Interpolation
x= [15, 20, 25, 30];
y= [1476.77, 1482.19, 1496.69, 1509.28];
%------------
n=length(x);
A = ones(4,4);
for k= 1:n-1
for kk=2:n
A(k,kk)= (x(k)-x(1))*A(k,kk-1);
end
end
disp(A)
>>

Weitere Antworten (0)

Kategorien

Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by