⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 questio1.cpp

📁 matlab 专业设计 源于课本的原文件 适合于编程人员
💻 CPP
字号:
// Embedded Control Systems in C/C++
// by Jim Ledin
//
// Chapter 9 - Answers to Self-Test question 2

#include "pend_dsys_fixpt.cpp"

void main()
{
    // Determine initial states
    short x0[4] = {0, 0, 0, 0};

    // Call the controller's Initialize function
    dsys_fixpt controller;
    controller.Initialize(x0);

    int n = 0; // Update counter
    double h = 0.01; // Sampling interval, seconds

    // Start the real time clock counting from zero

    for (;;)
    {
        // Read the controller inputs U
        short u[3];

        // Call the controller's Update function
        controller.Update(u);

        // Write the controller outputs Y

        ++n;
        // Delay until time = n * h
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -