filename='2315on5july.dat'; data=importdata(filename); %temperature data outside the enclosure on channel 2 data1=data(:,2); %temperature data inside the enclosure on channel 3 data2=data(:,3); %sampling frequency in Hz fs=100; [Txy,f] = tfestimate(data1,data2,[],[],[],fs); % finds a transfer function estimate when given an input signal and an output signal. newTxy=abs(Txy); %mag2db---20log10() newTxy1=mag2db(newTxy); figure plot(f, newTxy, 'b','LineWidth', 2); grid on; title('Transfer Function'); xlabel('Frequency in Hz'); ylabel('Magnitude'); figure plot(f, newTxy1, 'r','LineWidth', 2); grid on; title('Transfer Function'); xlabel('Frequency in Hz'); ylabel('Magnitude in dB'); [Cxy,F] = mscohere(data1,data2,[],[],[],fs); %finds the magnitude-squared coherence estimate of the input signals using Welch's averaged modified periodogram method figure plot(F, Cxy, 'b','LineWidth', 2); grid on; title('Magnitude Squared Coherence'); xlabel('Frequency in Hz'); ylabel('Coherence');