フィルターのクリア

App Designer Time-Steps and Velocity data from excel for motor control

2 ビュー (過去 30 日間)
Chris
Chris 2021 年 1 月 3 日
コメント済み: Chris 2021 年 1 月 7 日
Hello,
I read datas from a excel file: x-column is "time" and y-column is "velocity" and plot them. Everything is ok.
e.g. Start:
0s 0prm
20s 200rpm
40s 250rpm
80s 300prm
......
Now I would like to give my motor control the new velocity after the time is over depends on my table data. Maybe you know an advice how I can do it? Thanks a lot
t = readtable("Daten.xlsx","Sheet",2);
x = table2array(t(:,1));
y = table2array(t(:,3));
stairs(app.UIAxes,x,y,'-o');
  3 件のコメント
Adam Danz
Adam Danz 2021 年 1 月 3 日
@Chris are you asking how to add data to the table or how to extrapolate a velocity estimate given a future time?
If your goal is to do the latter, you'll need to provide more info about how you expect the velocity to change. For example, if you expect a simple logrithmic growth (for demo purposes only),
x = [0 20 40 80];
y = [0 200 250 300];
clf()
hold on
grid on
plot(x,y,'b-o','DisplayName','RawData')
z = lsqcurvefit(@(p,xdata)p(1)+p(2).*log(xdata),[0,1],x(2:end)',y(2:end)');
Local minimum found. Optimization completed because the size of the gradient is less than the value of the optimality tolerance.
newX = 5:100;
newY = z(1)+z(2).*log(newX);
plot(newX, newY, 'k--','DisplayName','Fit')
legend('Location','SouthEast')
Chris
Chris 2021 年 1 月 7 日
Hey Adam Danz, thanks for your interesting idea.
But the task is different. I will put the Link here, we already try to solve the problem:

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

回答 (0 件)

カテゴリ

Help Center および File ExchangeDevelop Apps Using App Designer についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by