新聞中心

        EEPW首頁 > 測試測量 > 設計應用 > LabVIEW MathScript開發算法:第二部分——MathScript 交互式窗口

        LabVIEW MathScript開發算法:第二部分——MathScript 交互式窗口

        作者: 時間:2017-01-06 來源:網絡 收藏



      1. 點擊Script標簽并點擊Load按鈕。選擇Mitra P2_1.m(Mitra, Sanjit and Kaiser, James H.,數字信號處理手冊Handbook for Digital Signal Processing[New York: John Wiley and Sons, 1993], 21)。該腳本生成一個測試信號并在該信號上應用滑動平均濾波器。
      2. 點擊Run按鈕來運行該腳本,將出現Prompt User for Input對話框。在Desired length of the filter=文本框中輸入正值并點擊OK按鈕。MathScript腳本可以包含交互式對話框來提示用戶輸入。
      3. 下方顯示的Mitra P2_1.m腳本,通過子繪圖命令,指定繪圖窗口(Plot window)內4幅子圖(sub-plot)中的一幅。用戶指定子圖(sub-plot)后,后續命令隨即影響該子圖(sub-plot)。例如,當子繪圖命令結束后,繪圖命令可將其本身指定的繪圖裝入先前由子繪圖命令指定的子圖(sub-plot)。
      4. % Program P2_1
        % Simulation of an M-point Moving Average Filter
        % Generate the input signal
        n = 0:100;
        s1 = cos(2*pi*0.05*n); % A low-frequency sinusoid
        s2 = cos(2*pi*0.47*n); % A high frequency sinusoid
        x = s1+s2;
        % Implementation of the moving average filter
        M = input(Desired length of the filter = );
        num = ones(1,M);
        y = filter(num,1,x)/M;
        % Display the input and output signals
        clf;
        subplot(2,2,1);
        plot(n, s1);
        axis([0, 100, -2, 2]);
        xlabel(Time index n); ylabel(Amplitude);
        title(Signal #1);
        subplot(2,2,2);
        plot(n, s2);
        axis([0, 100, -2, 2]);
        xlabel(Time index n); ylabel(Amplitude);
        title(Signal #2);
        subplot(2,2,3);
        plot(n, x);
        axis([0, 100, -2, 2]);
        xlabel(Time index n); ylabel(Amplitude);
        title(Input Signal);
        subplot(2,2,4);
        plot(n, y);
        axis([0, 100, -2, 2]);
        xlabel(Time index n); ylabel(Amplitude);
        title(Output Signal);
        axis;

        本文引用地址:http://www.104case.com/article/201701/337021.htm

        您可以使用Command Window文本框來找出更多命令信息。利用在Command Window文本框中鍵入help subplot,該命令的描述以及語法信息、輸入、輸出和示例將會出現在Output Window中。



        上一頁 1 2 下一頁

        關鍵詞: LabVIEWMathScript開發算法交互式窗

        評論


        相關推薦

        技術專區

        關閉
        主站蜘蛛池模板: 大英县| 芦山县| 芦溪县| 额敏县| 临高县| 苏尼特左旗| 临安市| 潼南县| 寻甸| 临澧县| 伊通| 长武县| 永安市| 铜山县| 浙江省| 游戏| 张北县| 大城县| 伽师县| 清水县| 革吉县| 大关县| 陆川县| 安泽县| 关岭| 蕉岭县| 沿河| 英德市| 景东| 五大连池市| 伊金霍洛旗| 慈溪市| 井陉县| 定西市| 阿巴嘎旗| 剑河县| 綦江县| 资讯 | 吉林省| 安泽县| 虎林市|