王浚驊
    • 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 New
    • Engagement control
    • Make a copy
    • 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 Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Make a copy 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
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # Matlab notes # 匯檔 ```matlab present01=importdata('practice_data_1.txt'); ``` # plot ```matlab %單一函數圖 t=0:0.1:2*pi; x=2*t; y=t.*sin(t).*sin(t); plot(x,y) %多個函數圖 x=linspace(0,2*pi,100); % x-scale為(0到2*pi拆出100等分) plot(x,sin(x),x,2*sin(x),x,3*sin(x)) %畫出不同線型與顏色 x=(0:pi/100:2*pi)'; % ':轉制成n*1 matrix class(x) % check variable type y1=2*exp(-0.5*x)*[1,-1]; y2=2*exp(-0.5*x).*sin(2*pi*x); % .* : 按元素乘法 x1=(0:12)/2; y3=2*exp(-0.5*x1).*sin(2*pi*x1); plot(x,y1,'k:',x,y2,'b--',x1,y3,'rp'); %圖形輔助 x=0:pi/50:2*pi; y1=sin(x); y2=cos(x); figure plot(x,y1,'k-',x,y2,'k-.'); %text標註 text(pi,0.05,'\leftarrow sin(\alpha)'); text(pi/4-0.05,0.05,'cos(\alpha) \rightarrow '); %title標註 title('sin(\alpha) and cos(\alpha)') %標座標 xlabel('\alpha') ylabel('sin(\alpha) and cos(\alpha)') %畫2*1的兩張圖 subplot(2,1,1) plot(x,y1,'k-',x,y2,'k-.'); title('sin(\alpha) and cos(\alpha)') subplot(2,1,2) plot(x,y2) axis([0.4 0.6 -1 1]) %圖軸上下界x=[0.4 0.6];y=[-1,1] title('複雜函數的局部透視') % pie chart x=[190 33 45 42 45]; explode=[1 1 0 0 0]; %分離顯示設置 figure() colormap hsv %條色調用的 pie(x,explode,{'生活費','資料費','電話費','購買衣服','其他費用'}) title('pie chart') % histogram % 隨機生5*3的data Y=round(rand(5,3)*10); %round:四捨五入 subplot(2,2,1) bar(Y,'group') title('Group') %堆型二維垂直條形圖 subplot(2,2,2) bar(Y,'stack') title('stack') %堆型二維水平條形圖 subplot(2,2,3) barh(Y,'stack') title('stack') %設定條形寬度1.5 subplot(2,2,4) bar(Y,1.5) title('width=1.5') %barplot y=[190 33 45 42 45]; x=1:5; figure bar(x,y) title('柱狀圖') set(gca,'xTicklabel',{'生活費','資料費','電話費','購買衣物', '其他'}) %讓字串放到x軸 %排列圖 (一個橫軸,兩個縱軸其中,横坐 标表示各因素, % 左纵坐标表示频数,右纵 坐标表示频率,折线表示累积的频率。) % 该图能较好地分析各因素的重要性,可用于寻找主要问题或主要原因。 y=[100 98 97 90 90]; names={'第一' '第二' '第三' '第四' '第五'}; pareto(y,names) % 3D plot t=0:pi/50:2*pi; x=8*cos(t); y=4*sqrt(2)*sin(t); z=-4*sqrt(2)*sin(t); plot3(x,y,z,'p'); title('Line in 3D space'); text(0,0,0,'origin'); xlabel('X');ylabel('Y');zlabel('Z');grid; %surface plot % surf(X, Y, Z):绘制三维表面图,X、Y、Z 分别表示三维网格图形在 x 轴、y 轴和 z 轴的坐标,图形的颜色由矩阵 Z 决定。 % surf(X, Y, Z, C):绘制三维表面图,输入参数 C 用于控制绘制的三维表面图的颜色。 % surf(..., 'PropertyName', PropertyValue):绘制三维表面图,设置相应属性的属性值。 % 函数 surfc()用于绘制带等值线的三维表面图,其调用格式同函数 surf()基本相同,函数 surfl()可用于绘制带光照模式的三维表面图,与函数 surf()和 surfc()不同的调用格式如下: % surfl(...,'light'):以光照对象 light 生成一个带颜色、带光照的曲面。surfl(...,'cdata'):输入参数 cdata 设置曲面颜色数据,使曲面成为可反光的曲面。 % surfl(...,s):输入参数 s 为一个二维向量[azimuth,elevation],或者三维向量[x,y,z],用于指定光源方向,默认情况下光源方位从当前视角开始,逆时针 45°。 xi=-10:0.5:10; yi=-10:0.5:10; [x,y]=meshgrid(xi,yi); z=sin(sqrt(x.^2+y.^2))./sqrt(x.^2+y.^2); surf(x,y,z) ``` # 常用資料處理 ```matlab A=rand(3,2) A=[1 2; 3 4;5 6] A(3,2) A(2,:) %call 第二列的列向量 A([1 3],:) %select the 1st and 3rd row save test.mat A A(:,2)=[10,11,12] A=[A,[101;102;103]]%append another column vector A(:)%put all elements of A into a single vector 也就是把矩陣拉直 %資料運算 B=[11,12;13,14;15,16] C=[A B] A=[1 2;3 4;5 6] C=[A;B] A.*B%對應位置的資料相乘,即element product A'%轉置 A<3 find(A<3) [r,c]=find(A>=6) %r:列 c:行 a=[1 15 2 0.5] sum(a) prod(a) %所有元素相乘 floor(a)%取下界 ceil(a)%取上界 rand(3)%建立3*3的random矩陣,每個值在[0,1]之間 max(rand(3),rand(3)) %在兩個random的3*3矩陣中找對應位置的max A=magic(3) %返回由 1 到 n^2 的整数构成并且总行数和总列数相等的 n×n 矩阵。 max(A,[],1) %找每行最大值,1表示第一維,即行(?) max(A,[],2) %找每列最大值,2表示第二維,即列(?) max(A) %defaultis column max max(max(2)) A(:) % max(A(:)) eye(9) % 9*9 的單位矩陣 A=magic(3); temp=pinv(A) %矩陣求逆 temp*A %Plotting Data t=[0:0.01:0.98]; y1=sin(2*pi*4*t); plot(t,y1) hold on; %plot new figure on the old ones y2=cos(2*pi*4*t); plot(t,y2,'r') xlabel('time') ylabel('value') legend('sin','cos') title('my plot') % for if while statements v=zeros(10,1) for i=1:10 v(i)=2^i; end v ```

    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