MATLAB에서 괄호를 n의 자연수로 확장하는 함수를 만들려고합니다. 여기서 n은 자연수입니다. 배열의 2 변수
??? The following error occurred converting from sym to double:
Error using ==> mupadmex
Error in MuPAD command: DOUBLE cannot convert the input expression into a double
array.
If the input expression contains a symbolic variable, use the VPA function instead.
Error in ==> expandb at 6
v(i)=z(i)*x.^(n-i+1)*y.^(i-1);
그래서 내가 어떻게 배열이 개 변수를 저장합니까 : 나는 그것을 실행할 때
function expandb = expandb(x,y,n)
z = my_bincoeff1(n);;
syms v x y
v=1:n+1
for i=1:n+1
v(i)=z(i)*x.^(n-i+1)*y.^(i-1);
end
a=0
for i=1+n+1
a=a+v(i)
end
expandb = a;
이 오류를 얻을 : 이것은 내가 지금까지 가지고 무엇인가?
은'수 expandb'해야하는 기능 :
이 솔루션은 아래 당신이 원하는 것을 달성해야합니까? – Jacob
두 변수의 함수 여야합니다. expandb (2x, 3y, 4)라고 쓰면 대답은 (2x)^4 + 형식이 될 것입니다. – Mobix
당신이하지 않는 이유가 있습니까? [EXPAND] (http://www.mathworks.com/help/toolbox/symbolic/expand.html) 함수를 사용하려면 expand ((2 * x + 3 * y)^4); – gnovice