function [f,g,h]=dloudA_com(values)
% Generates loudA_com
%
% [F,G,H]=DLOUDA_COM(VALUES) generates the file loudA_com.m used in simulations of 
% the device defined by dloudA_lit and parameters in strucuture VALUES
%
% [F,G,H]=DLOUDA_COM uses the default parameter values defined by dloudA_lit


%   CBVK Toolbox
%   JHMG, PMSB 2016


if nargin==0
    [f,g,h,names,values]=dloudA_lit;
else
    [f,g,h,names]=dloudA_lit;
end

% Substitute numerical parameters
for i=1:length(names)
    eval([names{i} '= values.' names{i} ';']);
end

f=subs(f);
g=subs(g);
h=subs(h);

filef = fopen('loudA_com.m','w');

fprintf(filef,'%sDiff equation of loudspeaker \n','%');
fprintf(filef,'%sf(x) \n','%');
fprintf(filef,'mydx(1)= %s ;\n',char(f(1)));
fprintf(filef,'mydx(2)= %s ;\n',char(f(2)));
fprintf(filef,'mydx(3)= %s ;\n',char(f(3)));
fprintf(filef,'%sg(x) \n','%');
fprintf(filef,'mydx(3)= mydx(3)+uf*(%s);\n',char(g(3)));

fclose(filef);





