フィルターのクリア

plot the final value of optimization

1 回表示 (過去 30 日間)
Soumili Sen
Soumili Sen 2020 年 12 月 24 日
コメント済み: Soumili Sen 2020 年 12 月 24 日
Hello all,
I am facing a logical problem like,
N =10;
syms a,b
for i = 1:N
y(i)=2*a+3;
x(i)=4*b+9;
fun(i) = mean((y(i)-x(i))^2);
end
data=sum(fun);
after optimization we get values of a,b and value of data properly ,but now I want to plot data. But here data is a single value. How i can proceed it?

採用された回答

Alan Weiss
Alan Weiss 2020 年 12 月 24 日
It seems that your data is x(i) and y(i), and the associated 2*a+3 and 4*b+9. Yeah, they are all constants, nothing much to plot other than a single point, because your x and y values do not depend on i.
In addition, you probably should not thnik in terms of symbolic variables. If you want to optimize something numerically, use regular numerics, or else the Optimization Toolbox problem-based approach.
Alan Weiss
MATLAB mathematical toolbox documentation
  1 件のコメント
Soumili Sen
Soumili Sen 2020 年 12 月 24 日
ok. thanks for your advice.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSolver Outputs and Iterative Display についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by