Trying to plot a simple linear function but returns constant
Show older comments
Hi! I'm working on a temperature sensor and I've found its equations on this link: PT-100. It's a device which electric resistance depends on temperature changes and it can be easily measure with a voltage output when it's apply on a bridge circuit.
But in general the code is the next:
clear all
close all
clc
T = 0: 0.01 : 200;
alpha = 0.00385;
R0 = 100;
RT = R0 * (1 + (alpha * T)); % ............(1)
V_cd = 5;
Voltage = ((RT/(RT + R0)) - 0.5)*5; % ..........(2)
subplot(2,1,1)
plot(T,RT)
ylabel('Resistance');
xlabel('Temperature °C');
grid on;
subplot(2,1,2)
plot(T,Voltage);
ylabel('Voltage');
xlabel('Temperature °C');
grid on;
(1) and (2) are the functions that I'm trying to plot, RT (1) is a function that depends on temperature changes T = 0:0.01:200 -> °C, and Voltage depends on RT output. When I plot RT vs T it returns a linear function on a graph, but when I plot Voltage vs T it returns a constant!!
I think I'm doing something stupid but I can't find the problem hahahah I always use matlab for modeling electronics but it's the first time I got a plotting problem with matlab :(
Accepted Answer
More Answers (0)
Categories
Find more on Numerical Integration and Differentiation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!