Effacer les filtres
Effacer les filtres

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

2 vues (au cours des 30 derniers jours)
Chris
Chris le 3 Jan 2021
Commenté : Chris le 7 Jan 2021
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 commentaires
Adam Danz
Adam Danz le 3 Jan 2021
@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 le 7 Jan 2021
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:

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Develop Apps Using App Designer dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by