Index in Position 1

조회 수: 4 (최근 30일)
BoostedMan
BoostedMan 2020년 12월 1일
답변: VBBV 2020년 12월 1일
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
BoostedMan
BoostedMan 2020년 12월 1일
How would I change this in order to get zero's above the diagonal in the A matrix?
Walter Roberson
Walter Roberson 2020년 12월 1일
A = zeros(n-1, n);

댓글을 달려면 로그인하십시오.

채택된 답변

VBBV
VBBV 2020년 12월 1일
%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)
>>

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by