幅值为5、频率为10Hz的正弦信号,并写入数据文件MySin.txt,并读取文本文件MySin.txt 中的数据文件,进行绘图.
% Applying the Mysin function to generate a sine waveform
...with amplitude and frequency are 5 and 10 respectively,and then
...writing the sine wave data to the text file-Mysin.txt
clear;clc;
A = 5; % The amplitude of sinusoid.
fre = 10; % The frequency of sinusoid.
N = 1024; % The number of sampling points.
Fs = 1024; % Sampling frequency.
dt = 1/Fs; % Time interval.
t = (0:(N-1))*dt; % Time vector.
Xt = A*sin(2*pi*f*t + 3*pi/4); % Generating a sine function.
file_type = fopen('D:\MySin.txt','w'); % open text file-MySin.txt.
...(Creat a text file unless this text file is exist) fprintf(file_type,'%12f\n',Xt); % Formatting the input data,and the to the text file. fclose(file_type); % close th