フィルターのクリア

Utilising matlab plots to find constants

2 ビュー (過去 30 日間)
Madlab
Madlab 2018 年 10 月 8 日
コメント済み: Jan 2018 年 10 月 8 日
Finding m and c for an equation y = mx + c, with the help of math and plots.
In this case, y is data_model_1, x is time
Avoid other matlab functions like fitlm as it defeats the purpose.
I am having trouble finding the constants m and c. I am trying to find both m and c by limiting them to a range (Based on smart guess) and I need to deduce the m and c values based on the mean error range. The point where mean error range is closest to 0 should be my m and c values.
load(file)
figure
plot(time,data_model_1,'bo')
hold on
for a = 0.11:0.01:0.13
c = -13:0.1:-10
data_a = a * time + c ;
plot(time,data_a,'r');
end
figure
hold on
for a = 0.11:0.01:0.13
c = -13:0.1:-10
data_a = a * time + c ;
mean_range = mean(abs(data_a - data_model_1));
plot(a,mean_range,'b.')
end
EDIT: I have attached an example with the file "fil"
  3 件のコメント
Madlab
Madlab 2018 年 10 月 8 日
編集済み: Madlab 2018 年 10 月 8 日
How to find the constants m and c with the help of plots?
I know there are other methods but I need to use mathematics and plots to solve for m and c, nothing else. There is no polyfit function anywhere in my code either.
Jan
Jan 2018 年 10 月 8 日
While there is no polyfit in your code, it is easy to determine the constants m and c using maths instead of plots.
Again: What is the problem with the code you have posted?

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

回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by