I need to plot a graph of P, Rdia and Vo, please help me how to get graph. (for every 10 increment of pressure, there is 1 ohm increment of Rdia , and display the output vo)

5 Ansichten (letzte 30 Tage)
Rdia = 3673; % dia resistance value in ohm ;
Rtemp = 3618; % Temperature resistance value in ohm;
R1 = 3600; % fixed resistance in ohm;
R2 = 3600; % fixed resistance in ohm;
Rof1 = 150; % offset compensation resistance in ohm;
Rof2 = 200; % offset compensation resistance in ohm;
Vexc = 0.748; % excitation voltage;
for P = 0:10:300 % pressure increment to 10 mmHg
P
for m =1
if (P == 0)
Rdia_new = Rdia
x = Rdia_new/(Rdia_new+R1);
y = (Rtemp+Rof1)/((Rtemp+Rof1) + (R2+Rof2));
vo = ((x - y)*Vexc)*1000; % output voltage in volts
disp(vo)
else
Rdia_new = Rdia+m
Rdia =Rdia+1;
x = Rdia_new/(Rdia_new+R1);
y = (Rtemp+Rof1)/((Rtemp+Rof1) + (R2+Rof2));
vo = ((x - y)*Vexc)*1000;
disp(vo);
end
end
end

Akzeptierte Antwort

VBBV
VBBV am 22 Apr. 2022
Rdia = 3673; % dia resistance value in ohm ;
Rtemp = 3618; % Temperature resistance value in ohm;
R1 = 3600; % fixed resistance in ohm;
R2 = 3600; % fixed resistance in ohm;
Rof1 = 150; % offset compensation resistance in ohm;
Rof2 = 200; % offset compensation resistance in ohm;
Vexc = 0.748; % excitation voltage;
I = 1;
m = 1;
for P = 0:10:300 % pressure increment to 10 mmHg
P;
if (P == 0)
Rdia_new(I) = Rdia;
x = Rdia_new/(Rdia_new+R1);
y = (Rtemp+Rof1)/((Rtemp+Rof1) + (R2+Rof2));
vo(I) = ((x - y)*Vexc)*1000; % output voltage in volts
% disp(vo);
else
Rdia_new(I) = Rdia+m;
Rdia =Rdia+1;
x = Rdia_new/(Rdia_new+R1);
y = (Rtemp+Rof1)/((Rtemp+Rof1) + (R2+Rof2));
vo(I) = ((x - y)*Vexc)*1000;
%disp(vo);
end
I = I+1;
end
P = 0:10:300 ;
subplot(211)
plot(P,vo);
subplot(212)
plot(P,Rdia_new)
  3 Kommentare
VBBV
VBBV am 22 Apr. 2022
use clear at beginning of code and run it. Everytime you run, data for variables is created in workspace
clearvars
%or
clear

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by