橘子王
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Versions and GitHub Sync Note Insights Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       owned this note    owned this note      
    Published Linked with GitHub
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    # Matlab 教學(一) > 此篇內容為還沒有接觸matlab的初學者所寫,作者也是新手,資料來源於網路,有錯的話還請指正 > [Matlab入門教學(二)](https://hackmd.io/rJgLH9x6RQqACdkPzGvT5w) [Matlab入門教學(三)](https://hackmd.io/fr2bmUY9TcKub2LG9J6_7w?view) :::info Matlab全名為 Matrix Laboratory,因為其對於數學運算的強大功能,已經成為各所大學實驗室的標準軟體之一。 ::: ## 一、Matlab IDE 以下為進入matlab後的初始畫面 ![IDE_1](https://hackmd.io/_uploads/Bky8Vq5IA.png) 中間的大視窗為Command Window,可輸入數學式做運算,得到的數值會以變數名稱存在右邊的視窗中 ![IDE_3](https://hackmd.io/_uploads/BySJ8ccUR.png) 輸入 * ```ans+enter```可得到ans=9 * ```x+enter```可得到x=3 ![IDE_4](https://hackmd.io/_uploads/H1MtPqcI0.png) **常用指令** * ```>>clc``` 可清除視窗內殘留,但variable的值還在 * ```>>clearvars```移除variablse ![IDE_5](https://hackmd.io/_uploads/S1PKF5qUC.png) * ```>>x=10;```程式末端加入```;```不會印出數值 * ```>>whos``` 可看出到目前有哪些variables ![IDE_6](https://hackmd.io/_uploads/BJYyjq98C.png) 像C語言一樣,Matlab也提供了字元字串功能 * ```>>O='orange'``` 字元 * ```>>K="king"``` 字串 ![IDE_7](https://hackmd.io/_uploads/HyRf655IR.png) 點選右邊的variable,可叫出內容,矩陣時好用 ![IDE_8](https://hackmd.io/_uploads/BJRpVocIR.png) 按下方向鍵上可觀察指令的歷史紀錄 ![IDE_10](https://hackmd.io/_uploads/ryHQ8jqL0.png) ## 二、基本運算 :::info 可以將script想成固定的劇本,紀錄指令執行的先後順序,每個劇本都上演著不同的故事(模擬結果) ::: 左上角點選新增script即可,副檔名為.m 建立後選取上方的Run即可,會儲存並執行 ps.工具列中HOME->performence可調整外觀,顏色、字體大小等等 ![IDE_9](https://hackmd.io/_uploads/SJKuUjqIC.png) * ```x=1:10```代表從一數到十,x為1X10的矩陣 * ```%```後方的內容為註解內容,可敘述此行代碼用意 ![Script_1](https://hackmd.io/_uploads/rJvStj5IA.png) * ```x'```可想成矩陣的transpose ![Script_2](https://hackmd.io/_uploads/r1u7isqLC.png) * ```linspace(x,y,z)```表示在x~y中,隨機產生z個數字 ![Script_3](https://hackmd.io/_uploads/HkP_3sqUR.png) * ```A=[x,y;t,z]```可用來表示矩陣,分號為row的節點 * ```A+2```也可直接對矩陣做運算 ![Script_4](https://hackmd.io/_uploads/rkZ1Cs9IA.png) :::danger 對矩陣做運算時,務必遵守矩陣的線性規則 ::: ex.2X3無法跟2X3的矩陣相乘 ![Script_5](https://hackmd.io/_uploads/SJEr0j98C.png) * ```A.^2```加入一個.代表對矩陣內每個元素做運算 ![Script_6](https://hackmd.io/_uploads/SyAlkhcIA.png) * 特殊矩陣: ```ones(x,y)、zeros(2,8)、eye(x,y)``` ![Script_7](https://hackmd.io/_uploads/SkG9n76v0.png) * ```R=x:y:z```表示為從x開始加上y值,到z時停下(等差級數) ![Script_8](https://hackmd.io/_uploads/r1RJWzAw0.png) ## 三、Index Index的常用於抓取數列或矩陣中的元素 * ```A(x,y)```抓矩陣中row=x、column=y的元素 ![image](https://hackmd.io/_uploads/BJZKUGADA.png) * 若矩陣只有一個row(常見於數列),只需寫出一個即可 ![Index_2](https://hackmd.io/_uploads/S1vHvGRvR.png) * ```A(end)```表示取最後一位的值,可對其做簡單運算 ![Index_3](https://hackmd.io/_uploads/ryX4tfRPC.png) * 也可對原值做修改 ![Index_4](https://hackmd.io/_uploads/BJ3nYMCvC.png) * ```A(x,:)```可拉出x row中全部元素 ```A(x,1:3)```可拉出x row中1~3的元素值 ```A(x,2:end)```可拉出x row中2到結尾的數值 ![Index_5](https://hackmd.io/_uploads/H1zaqM0v0.png) ## 附錄:如何找尋需要的指令 :::info 程式語言的函式庫要全部背起來是不可能的,因此要善用查找的功能,只要記得基礎的數值即可 ::: 1. Command Window點選左下角的fx圖示 ![Attach_1](https://hackmd.io/_uploads/HkznJdAv0.png) 2. help+關鍵字 ```help min``` 3. doc+關鍵字 ```doc min``` --- 參考資料 >1.[MATLAB Crash Course for Beginners](https://youtu.be/7f50sQYjNRA?si=tSxig57n6B59pO08)

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully