Archive

Archive for November, 2012

create_pwl.m

November 16, 2012 2 comments

% usage: create_pwl(data, fs, filename)
%
% I put this function together so that I could use LTSpice to filter
% signals that I create in matlab.
%
% LTSpice uses pwl (piecewise linear files)

function create_pwl(data, fs, filename)

file_id = fopen(filename,'w');
for k = 1: length(data)
   fprintf(file_id, '%6.6f %6.6f ' , (k-1)/fs, data(k)); 
end   
fclose(file_id);

Categories: matlab code, Uncategorized