solve non-linear equations
조회 수: 1 (최근 30일)
이전 댓글 표시
Anyone have any ideas of how to solve non-linear equation in matrix form? I want to generate 100-paired, x1, x2, Y samples from model:
Y=sigmoid*(a1'X)+(a2'X)^2+0.30*(X')?
where
X=[x1,x2] is N x p matrix with x1, x2 normally distributed vectors
sigmoid=X/sqrt(1+X^2)
a1=(3,3) are coefficients for x1 and x2
a2=(3,-3) are coefficients for x1 and x2
*****************************
My unsuccess MatLab code:
N=100; % number of samples
a1=[3 3];
a2=[3 -3];
a1rep=repmat(a1,N,1); % N x p matrix of a1 constants for x1 and x2
a2rep=repmat(a2,N,1); % N x p matrix of a2 constants for x1 and x2
syms x1 x2 y
for n = 1:N % number of samples to solve for y, x1, x2
S = vpasolve([[x1,x2]/sqrt([x1,x2]^2)*(a1rep'*[x1,x2]) + (a2rep'*[x1,x2])^2 + 0.30*[x1,x2]' == y], [x1, x2, y])
[x1n(n),x2n(n)]=S; %create matrix of x1 and x2 values renamed as x1n, x2n for each of sample solution of y
end
yValues=[x1n,x2n]/sqrt([x1n,x2n]^2)*(a1rep'*[x1n,x2n]) + (a2rep'*[x1n,x2n])^2 + 0.30*[x1n,x2n]'; %vector of y values for each x1,x2 pair
댓글 수: 1
John D'Errico
2016년 4월 9일
What are you talking about? If X1 and X2 are normally distributed, then generate them as such, and then evaluate the sigmoid function to compute Y.
I have absolutely no idea what you mean by this:
a1=(3,3) are coefficients for x1 and x2
as that is not valid MATLAB syntax.
I have also no idea what you are trying to solve. What are the unknowns? What is known? I can't even decipher what your equation is, as it is only partially written, again, with invalid syntax, even in terms of mathematics what you wrote does not make sense.
So SLOW DOWN. Start over. Explain what you are trying to do. CLEARLY.
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Calculus에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!