Minimize difference between vectors by varying scalar

조회 수: 5 (최근 30일)
alberto tonizzo
alberto tonizzo 2022년 5월 18일
댓글: alberto tonizzo 2022년 5월 22일
Hello,
I'm trying to use fminsearch to find the scalar (a) that minimizes the difference between 2 vectors of dimension N, i.e. diff = abs(x - a*x_model).
The difference (diff) is a vector of dimensions 1xN and fminsearch outputs also a vector of dimensions 1xN, but I would like to just have a scalar value for a.
Also, should diff be normalized by the mean of x?
I hope my explanation is clear, thank you in advance.
  댓글 수: 1
Torsten
Torsten 2022년 5월 18일
You cannot minimize a vector (in your case diff = abs(x-a*x_model)). You can minimize the norm of a vector.
For diff = x-a*x_model, you must decide which norm to take.

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

채택된 답변

Torsten
Torsten 2022년 5월 18일
편집: Torsten 2022년 5월 18일
a = x_model\x
minimizes
norm(a*x_model - x)
If you want to minimize the difference in another norm (e.g. max(abs(a*x_model-x)) or sum(abs(a*x_model-x))), the solution will be different.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Mathematics에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by