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 ビュー (過去 30 日間)
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

採用された回答

VBBV
VBBV 2022 年 4 月 22 日
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 件のコメント
VBBV
VBBV 2022 年 4 月 22 日
use clear at beginning of code and run it. Everytime you run, data for variables is created in workspace
clearvars
%or
clear
Supreme H
Supreme H 2022 年 4 月 22 日
thankyou sir it is working fine

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeText Data Preparation についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by