新聞中心

EEPW首頁(yè) > 測(cè)試測(cè)量 > 設(shè)計(jì)應(yīng)用 > LabVIEW MathScript開(kāi)發(fā)算法:第二部分——MathScript 交互式窗口

LabVIEW MathScript開(kāi)發(fā)算法:第二部分——MathScript 交互式窗口

作者: 時(shí)間:2017-01-06 來(lái)源:網(wǎng)絡(luò) 收藏



  • 點(diǎn)擊Script標(biāo)簽并點(diǎn)擊Load按鈕。選擇Mitra P2_1.m(Mitra, Sanjit and Kaiser, James H.,數(shù)字信號(hào)處理手冊(cè)Handbook for Digital Signal Processing[New York: John Wiley and Sons, 1993], 21)。該腳本生成一個(gè)測(cè)試信號(hào)并在該信號(hào)上應(yīng)用滑動(dòng)平均濾波器。
  • 點(diǎn)擊Run按鈕來(lái)運(yùn)行該腳本,將出現(xiàn)Prompt User for Input對(duì)話框。在Desired length of the filter=文本框中輸入正值并點(diǎn)擊OK按鈕。MathScript腳本可以包含交互式對(duì)話框來(lái)提示用戶(hù)輸入。
  • 下方顯示的Mitra P2_1.m腳本,通過(guò)子繪圖命令,指定繪圖窗口(Plot window)內(nèi)4幅子圖(sub-plot)中的一幅。用戶(hù)指定子圖(sub-plot)后,后續(xù)命令隨即影響該子圖(sub-plot)。例如,當(dāng)子繪圖命令結(jié)束后,繪圖命令可將其本身指定的繪圖裝入先前由子繪圖命令指定的子圖(sub-plot)。
  • % 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://butianyuan.cn/article/201701/337021.htm

    您可以使用Command Window文本框來(lái)找出更多命令信息。利用在Command Window文本框中鍵入help subplot,該命令的描述以及語(yǔ)法信息、輸入、輸出和示例將會(huì)出現(xiàn)在Output Window中。



    上一頁(yè) 1 2 下一頁(yè)

    關(guān)鍵詞: LabVIEWMathScript開(kāi)發(fā)算法交互式窗

    評(píng)論


    相關(guān)推薦

    技術(shù)專(zhuān)區(qū)

    關(guān)閉