[問題] Simulink從workspace讀取值問題

看板MATLAB作者 (百鬼月夜)時間13年前 (2012/12/30 10:50), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/1
各位板上大大好 我現在想要解決得情況是~ 我想要用一個 plus generator 以離散的時間讀取 workspace 中的變數做運算 當出現上升緣的時候 從 wrokspace 讀取資料 將讀取出來的資料用加法器加 1 delay 一個 clock 後存回 workspace 中 再下一個上升緣 再讀取同一個變數的資料出來做一次加法 一直重複直到模擬時間結束 所以在讀存變數方面 我選擇用 Trigger signal from workspace 方塊來讀取存在workspace中的變數 以 Triggered to workspace 將資料回存到 workspace 中的變數 可是實際模擬跑完後用 scop 拉出來看訊號感覺只加了一次 我 workspace 中變數的初始值為 0 輸出訊號卻永遠都為 1 因此不確定到底是只讀了一次 還是指輸出一次 而在 Trigger signal from workspace 的設定中 我已經把 from output after final data value by 的欄位 改成 cyclic reptition 可是還是不行 試了好多次都不行,也嘗試了其他方式也都無法 所以懇請大家協助幫忙 我試著把方塊圖畫上來 畫的不好請見諒 詳細參數也盡量列上~ 但還是隨後附上 *.mdl 檔 懇請各位大神幫忙~ ---------------------- 電路方塊圖 -------------------------- ___________ ____ | pluse | | -1| | Generator |----------------| Z |------------- |___________| | |____| | | Delays | | | __↓___ __↓___ | _ | ___ | _ | | _↑ |---------->|+ | | _↑ | | a | | |---->| a | |_______| ---->|+ | | |_______| Trigger signal | |___| | from workspace | Add | ___ | | | 1 |_____| | ____ |___| --->| __ | Constant ||__|| | | |____| Scope ----------------------------------------------------------- Pluse Generator 參數設定: Pluse type - Time based Time(t) - Use simulation time Ampitude - 1 Period (secs) - 2 Pulse Width (% of period) - 50 Phase delay (secs) - 2 Interpuet vector parameters as 1-D 有勾選 Delay 參數設定 Inital comdition - 0.0 Sample time - -1 Number of delays - 1 order output vector starting with - 選擇 Oldest Include current input in output vector 未勾選 Triggered Signal From Workspace 參數設定 Signal - a Trigger type - 選擇 Rising edge Inital output - 0 Samles per frame - 1 Form output after final data value by - 選擇 Cyclic repetition Triggered to workspace 參數設定 Trigger type - Rising edge Variable name - a Maximum number of rows - 1 Decimation - 1 Log fixed-point data as a fi object - 未勾選 其他加法器、常數、Scope我就不列上參數設定了 因為比較沒甚麼重要參數需設定 model 檔案連結下載網址 http://www49.zippyshare.com/v/10968113/file.html 感謝 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 114.38.236.127 ※ 編輯: vulmoon 來自: 114.38.236.127 (12/31 09:20)
文章代碼(AID): #1GtwllVO (MATLAB)