필터 지우기
필터 지우기

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 CenterFile Exchange에서 Develop 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