This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
clc; | |
clear all; | |
close all; | |
%loading input and output data of the plant here | |
d1=load(''); | |
%any dataset can be loaded here | |
%extracting the inputs and outputs from the loaded file | |
%select the appropriate columns from the loaded file to extract the input |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
float kp,ki,t,wf,K,K1,kdrive,kpc,kant,kpp,kip,zc,pc; | |
float m,m1,m2,m3,m4,m5,m6,m7,m8,m9; | |
float A1,B1,A2,B2,A3,B3,A4,B4,as,eb; | |
int i; | |
float pi(float kp,float ki,float t,float x,float y,float r) | |
{ | |
float op1,op2,a,b; | |
int d; | |
a=(2*kp)+(ki*t); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Encoder.h> | |
#define ENCODER_USE_INTERRUPTS | |
int driverEN = 11; //Enable input to the driver | |
int motorPWM1 = 8; //PWM signal to the motor pin of the driver | |
int motorPWM2 = 9; | |
Encoder myenc(3,7); | |
void setup(){ | |
Serial.begin(9600); |