function [output_resistance] = chemiresistor(technology, material_type, analyte, concentration) %Format of composite polymer files %technology = comp_polymer %filename contains two cell arrays %info contains material, Ro and K1 in a (3,1) cell array %analyte_info contains, analyte and K2 in a (2,N) cell array %where N is the number of analytes for which data is available %*****Governing equation: R = Ro*(1+K1*K2*[C])***************** %Ro = baseline resistance in ohms %K1 = constant based on material (ohms/ppm) %K2 = selectivity constant based on analyte (maximum value of 1) (unitless) %analyte = analyte given in function call (chemiresistor) %need a case statement for technology type here switch technology case ('comp_polymer') load (material_type) Ro=material_info{2,1}; K1=material_info{3,1}; N=material_info{4,1}; for i = 1:N %search for analyte temp1 = (analyte_info{1,i}); temp2 = (analyte); temp3= strcmp(temp1, temp2); if temp3==1 K2 = analyte_info{2,i}; end end output_resistance = Ro*(1+K1*K2*concentration); case ('metal_oxide') load (material_type) Ro=material_info{2,1}; N=material_info{3,1}; for i = 1:N %search for analyte temp1 = (analyte_info{1,i}); temp2 = (analyte); temp3= strcmp(temp1, temp2); if temp3==1 A = analyte_info{2,i}; m = analyte_info{3,i}; end end output_resistance = A*(concentration.^m); end