필터 지우기
필터 지우기

Calling Functions Vectors Array

조회 수: 2 (최근 30일)
T
T 2013년 10월 6일
댓글: T 2013년 10월 6일
Suppose I have the following function:
function c = relation( n )
if n==0
c = 1;
elseif n==1
syms x
c = [x 0];
else
syms x
c = ((2*n-1)*x*[relation(n-1),0] - (n-1)*[0,0,relation(n-2)])/n;
sum(c)
end
Suppose I choose n = 8, c will output an array but that's not useful to me. I want to plot the polynomial, so I use sum(c) and copy and paste the output and plot it. Is there a way to call 'c' ?

채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2013년 10월 6일
syms x
c1 = ((2*n-1)*x*[relation(n-1),0] - (n-1)*[0,0,relation(n-2)])/n;
c=sum(c1)
  댓글 수: 1
T
T 2013년 10월 6일
I get errors with those commands:
??? Error using ==> mupadmex
Error in MuPAD command: Array sizes must match.
Error in ==> sym.minus at 14
X = mupadmex('mllib::zip',A.s,B.s,'_subtract');
Error in ==> relation at 9
c1 = ((2*n-1)*x*[relation(n-1),0] - (n-1)*[0,0,relation(n-2)])/n;

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

추가 답변 (0개)

태그

Community Treasure Hunt

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

Start Hunting!

Translated by