%mal for loading data from labview and plotting the data %se side 18 journal clear all close all clc set(0,'defaultLineLineWidth', 2) set(0,'DefaultAxesFontSize',14) %% load basis_3_3f.txt t=basis_3_3f(:,1); q_air=basis_3_3f(:,3); q_liq=basis_3_3f(:,4); P1=basis_3_3f(:,5); P2=basis_3_3f(:,6); P3=basis_3_3f(:,7); setpoint=basis_3_3f(:,11); valve=basis_3_3f(:,12); %plot figure(1) plot(t,q_air) hold on plot(t,q_liq,'--r') %fitting polynom k=1; y=0; poly= polyfit(t,q_liq,k); for i=1:k+1 y=y+poly(i).*t.^(k+1-i); end plot(t, y, ':g') xlabel('Time[s]') ylabel('Flow rate[l/min]') legend('Air flow rate', 'Liquid flow rate', 'Average liquid flow rate'); hold off %end fitting figure(3) plot(t,P1,'-b') hold on plot(t,P2,'--r') plot(t,P3,':g') hold off xlabel('Time[s]') ylabel('Gauge pressure[kPa]') legend('Pressure at the mixingpoint (P1)', 'Pressure at the top (P2)', 'Pressure in the buffertank (P3)'); figure(6) plot(t,valve) title('Valve position') xlabel('time[s]') ylabel('Valve position[%]') axis[0, 100, %saving figures for fig=[1,3]; dir = 'c:\users\knutage\desktop\Master oppgave\Master_source\bilder\matlabfig\basis_3_3\'; filename = ['figure', num2str(fig),'.jpg']; saveas(figure(fig), [dir filename]); filename = ['figure', num2str(fig),'.pdf']; save2pdf([dir, filename]); end