3
Assignment: 1. Take a thermocouple of any type and write a MATLAB code to plot its output from 0 to 100 degree Celsius. 2. Add random noise to the output and plot the data. 3. Find mean, standard deviation and varience. Plot probability density function and histogram. Type of thermocouple : Copper/Constantan. Sensitivity = 0.05 mV/ 0 C Reference junction temperature = 0 0 C MATLAB code clc; close all; clear all; k=0.05; %millivolt T = 0:0.1:100; v1 = k*T; plot(T,v1); title('Ideal output of the Thermocouple'); xlabel('Temperature (Degree Celcius)'); ylabel('Output(mV)'); obj = gmdistribution(0,0.001); %Mean=0, Variance = 0.001 mv noise = random(obj,length(T)); v2 = k*T + noise'; figure(2); plot(T,v2); title('Output of the Thermocouple with added gaussian noise'); xlabel('Temperature (Degree Celcius)'); ylabel('Output(mV)'); axis([0 100 -0.1 5.1]); cal_noise = v1 - v2; noise_mean = mean(cal_noise) SD = std(cal_noise) variance = SD^2 figure(3) bins = 30; hist(cal_noise,bins); f = hist(cal_noise,bins); title('Histogram'); xlabel('Noise voltage(mV)'); ylabel('Frequency of occurrence'); figure(4); min_noise =min(cal_noise); max_noise = max(cal_noise); step = (max_noise - min_noise)/bins; v = min_noise:step:max_noise-step; probab = f/length(T); plot(v,smooth(probab)); title('Probability distribution'); axis([-0.2 0.2 0 0.1]); xlabel('Noise voltage(mV)'); ylabel('Probability');

Instru Assignment

Embed Size (px)

DESCRIPTION

Statistical characteristics of transducer

Citation preview

  • Assignment:

    1. Take a thermocouple of any type and write a MATLAB code to plot its output from 0 to 100 degree

    Celsius.

    2. Add random noise to the output and plot the data.

    3. Find mean, standard deviation and varience. Plot probability density function and histogram.

    Type of thermocouple : Copper/Constantan.

    Sensitivity = 0.05 mV/0C

    Reference junction temperature = 0 0C

    MATLAB code

    clc; close all; clear all;

    k=0.05; %millivolt T = 0:0.1:100; v1 = k*T; plot(T,v1); title('Ideal output of the Thermocouple'); xlabel('Temperature (Degree Celcius)'); ylabel('Output(mV)'); obj = gmdistribution(0,0.001); %Mean=0, Variance = 0.001 mv noise = random(obj,length(T)); v2 = k*T + noise'; figure(2); plot(T,v2); title('Output of the Thermocouple with added gaussian noise'); xlabel('Temperature (Degree Celcius)'); ylabel('Output(mV)'); axis([0 100 -0.1 5.1]); cal_noise = v1 - v2; noise_mean = mean(cal_noise) SD = std(cal_noise) variance = SD^2 figure(3) bins = 30; hist(cal_noise,bins); f = hist(cal_noise,bins); title('Histogram'); xlabel('Noise voltage(mV)'); ylabel('Frequency of occurrence'); figure(4); min_noise =min(cal_noise); max_noise = max(cal_noise); step = (max_noise - min_noise)/bins; v = min_noise:step:max_noise-step; probab = f/length(T); plot(v,smooth(probab)); title('Probability distribution'); axis([-0.2 0.2 0 0.1]); xlabel('Noise voltage(mV)'); ylabel('Probability');

  • Results :

    Noise mean = 8.9347 x 10-5

    mV

    Standard deviation = 0.0301 mV

    Variance = 9.0769 x 10-4

    mV

    Plots:

    Fig: Ideal output of

    Fig: Output of the TC after adding Gaussian noise with mean 0 and standard deviation 0.003 mv

    Fig: Ideal output of the thermocouple

    Fig: Output of the TC after adding Gaussian noise with mean 0 and standard deviation 0.003 mv

    Fig: Output of the TC after adding Gaussian noise with mean 0 and standard deviation 0.003 mv

  • Fig: Noise histogram

    Fig: Probability density plot