フィルターのクリア

To sum functions which have two unknowns and finding the min values of these unknowns

1 回表示 (過去 30 日間)
Serhat
Serhat 2014 年 5 月 23 日
編集済み: Romain 2014 年 5 月 23 日
What I am trying to do is to insert these equations into summation and to find the x and y values that minimize the function:
I know BS and r matrices. x and y are unknown.
I have this error message in Matlab. How can I fix it?

回答 (2 件)

George Papazafeiropoulos
George Papazafeiropoulos 2014 年 5 月 23 日
See if this works:
F=zeros(200,1);
xy=zeros(200,2);
BS=rand(4,2);
r=rand(200);
for ti=1:200
for m=1:4
F=@(xy) 2*r(ti,m)+hypot(xy(1)-BS(m,1), xy(2)-BS(m,2));
end
[xyout,fval]=fminsearch(F,[1 1]);
xy(ti,:)=xyout;
end
Hope this helps!

Romain
Romain 2014 年 5 月 23 日
編集済み: Romain 2014 年 5 月 23 日
I propose :
Create a function:
function F = myFunc(xy,t, BS, r)
F = 0;
for m=1:4
F = 2*r(ti,m)+hypot(xy(1)-BS(m,1), xy(2)-BS(m,2)) + F;
end
And then call :
for t = 1:200
[xy(t,:),fval] = fminsearch(@(xy) test(xy,t,BS,r),[1,1]);
end
Hope this helps !

カテゴリ

Help Center および File ExchangeMATLAB Coder についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by