필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

function svd(A,'econ')

조회 수: 1 (최근 30일)
NOR AZIERA
NOR AZIERA 2022년 12월 14일
마감: Jan 2022년 12월 14일
My problem is cannot running this coding which is i want the output same with matrix A. Please help me.
function A1=qoutprod(S,V)
A=[-2 8 20;14 19 10;2 -2 1];
[U,S,V]=svd(A,'econ');
A1=zeros(3,3);
for i=1:3
A1=A1*U(:,1:i)*qoutprod(S(1:i,1:i),V(:,1:i));
end
end
below show error when run the coding:
>> qoutprod
Out of memory. The likely cause is an infinite recursion within the program.
Error in qoutprod (line 8)
A1=A1*U(:,1:i)*qoutprod(S(1:i,1:i),V(:,1:i));
  댓글 수: 2
Bora Eryilmaz
Bora Eryilmaz 2022년 12월 14일
It is not clear what you are trying to do. Your code is making recursive calls to the qoutprod functions that will never stop running.
Jan
Jan 2022년 12월 14일
편집: Jan 2022년 12월 14일
@NOR AZIERA: Please format your code properly. I've done this for you before, but you can do this by your own. Thanks.
This is a follow-up question to:
I've mentioned already, that "does not work" and "cannot run" is not useful to explain a problem. Post a copy of the error message instead.
The code suffers from the same problem: You call qoutprod recursive from inside the function and overwrite the input arguments. This causes an infinite recursion. You got solutions in another question already, therefore I close this question.

답변 (0개)

이 질문은 마감되었습니다.

태그

Community Treasure Hunt

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

Start Hunting!

Translated by