Linking uicontrol edit to a variable
2 ビュー (過去 30 日間)
古いコメントを表示
How do I make the link between the uicontrol edit box to the variables, as explained in the following picture?

clear all; close all;
%Start - predefinite
grey1 = [0.8 , 0.8 , 0.8];
grey2 = [0.7 , 0.7 , 0.7];
grey3 = [0.6 , 0.6 , 0.6];
%R=(get(Be1,'Value'));
R = 5;
L = 2;
C = 0.2;
V = 10; %amplitudinea 10V
%End - predefinite
%Start - Fereastra principala Fig=figure('Name','Circuit RLC Serie',... 'Units','normalized',... 'Position',[0.25 0.25 0.5 0.5],... 'NumberTitle','off','color',grey1);
%Start - Imagine PSpice
axes('position',[0.513 0.16 0.50 0.28])
x = imread('circuit.jpg');
image(x)
axis off
axis image
%End - Imagine PSpice
%Start - Butoane RLC + Text
edit_r=uicontrol('Style','edit',...
'Units','normalized',...
'Position',[0.6 0.88 0.16 0.05],...
'foregroundcolor','b',...
'Value',5,...
'Callback','');
edit_h=uicontrol('Style','edit',...
'Units','normalized',...
'Position',[0.6 0.78 0.16 0.05],...
'foregroundcolor','b',...
'Value',5,...
'Callback','');
edit_c=uicontrol('Style','edit',...
'Units','normalized',...
'Position',[0.6 0.68 0.16 0.05],...
'foregroundcolor','b',...
'Value',5,...
'Callback','');
Bt1=uicontrol('Style','text',...
'Units','normalized',...
'Position',[0.76 0.889 0.05 0.03],...
'backgroundcolor',grey1,...
'foregroundcolor','black',...
'String','R (Ohm)');
Bt2=uicontrol('Style','text',...
'Units','normalized',...
'Position',[0.765 0.789 0.05 0.03],...
'backgroundcolor',grey1,...
'foregroundcolor','black',...
'String','L (Henry)');
Bt3=uicontrol('Style','text',...
'Units','normalized',...
'Position',[0.764 0.689 0.05 0.03],...
'backgroundcolor',grey1,...
'foregroundcolor','black',...
'String','C (Farad)');
Bt_diagrama=uicontrol('Style','text',...
'Units','normalized',...
'Position',[0.664 0.089 0.2 0.05],...
'backgroundcolor',grey1,...
'foregroundcolor','black',...
'String','Diagrama circuit RLC serie');
Bp=uicontrol('Style','pushbutton',...
'Units','normalized',...
'Position',[0.6315 0.6 0.1 0.05],...
'String','Apply',...
'Callback','close');
%End - Butoane RLC + Text
%Start - Diagrame
axes('position',[0.07 0.66 0.45 0.3])
x=0.1:0.1:10000; % Scara axei X
p=1i*x; % Laplace
FT=V./(L*C*p.*p + R*C*p + 1); % Functia de transfer
MFT=20*log10(abs(FT)); % Modulul functiei de transfer
semilogx(x,MFT,'LineWidth',2,'Color','red'); % Modulul functiei de transfer intr-un grafic semilog
xlabel('Frecventa [ Hz ]');
ylabel('Castig [ dB ]');
legend('Castig [ dB ]'); % Legenda
grid on % Grid
axes('position',[0.07 0.15 0.45 0.3])
phase=angle(FT)*(180/pi); % Faza
semilogx(x,phase,'LineWidth',2,'Color','red'); % Faza intr-un grafic semilog
xlabel('Frecventa [ Hz ]');
ylabel('Faza [ ° ]');
legend('Faza [ ° ]'); % Legenda
grid on % Grid
%End - Diagrame
%End - Fereastra principal
0 件のコメント
回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!