필터 지우기
필터 지우기

simplifying an algebraic expression in 6 variables

조회 수: 6 (최근 30일)
Az.Sa
Az.Sa 2022년 6월 7일
편집: Torsten 2022년 6월 8일
hello,
can you please help me with the following , I am trying to write matlab code to simplyfy this expression :
0.95 x1 -0.85 x2-0.14 x3+0.13 x4 -0.88 x5 -1.52 x6 - 1.64 * sqrt{ ( 0.100 x1 + 0.06 x2 + 1.03 x3 + 0.88 x4+0.02 x5 +0.19x6) ^2 + (0.04 x1 -0.05 x2+0.057 x3+0.15 x4-0.01 x5 -0.08 x6) ^2 }
I want to combine all x1 together and x2 as well ..etc
Thank you in advance
  댓글 수: 6
Torsten
Torsten 2022년 6월 7일
편집: Torsten 2022년 6월 7일
I'm surprised that the expression under curly brackets is not squared.
Just use lsqnonlin or lsqcurvefit and set up the model function as is (with the square root). No simplification is possible (and needed).
Az.Sa
Az.Sa 2022년 6월 7일
편집: Az.Sa 2022년 6월 7일
I am sorry can you give me a clue how to setup my optimization problem correctly. I am not sure how to construct the code corresponding to the above equation. Also, You are right the expression suppose to be squared if I am applying least square. However, If I want to use least absolute deviation insted of least square how can I deal with that ?

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

채택된 답변

Torsten
Torsten 2022년 6월 7일
편집: Torsten 2022년 6월 8일
fun = @(x) sum( (y - A.'*x - K*sqrt((B.'*x).^2 + (C.'*x).^2) ).^2 );
Aeq = ones(1,6);
beq = 1;
lb = zeros(1,6);
ub = ones(1,6);
x0 = ones(1,6)/6;
x = fmincon(fun,x0,[],[],Aeq,beq,lb,ub)
  댓글 수: 3
Torsten
Torsten 2022년 6월 8일
[x,fval] = fmincon(fun,x0,[],[],Aeq,beq,lb,ub)
Az.Sa
Az.Sa 2022년 6월 8일
편집: Torsten 2022년 6월 8일
Thank you very much

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Linear Programming and Mixed-Integer Linear Programming에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by