MATLAB GUI code the Active Receptor should increased when at TstartLigand but im plot its decreased . Secondly how to get rid of this matlab ui.control even

MATLAB GUI code the Active Receptor should increased when at TstartLigand but im plot its decreased . Secondly how to get rid of this matlab ui.control even(shared screenshot) involve in code.

3 Comments

It appears you've edited the original question. The accepted answer no longer matches the question. It is preferable that you do not do that, as it makes things confusing for other forum users. Please restore the original question.
i did not edited the question i just added the comment beacuse i did a spelling mistake. As i said kinldy help me out to trace the fault in the Sim.m file script.
There was a screenshot and question about how to remove edit field labels from the app propertes. That is the only question answered so far, and it no longer appears in your question.

Sign in to comment.

 Accepted Answer

The items you have circled are the Edit Field labels. An edit field component consists of an edit field and its label.
To remove the label, switch to the App Canvas, select the component, then position the cursor over the label and select it. You can then delete it using the delete or backspace key. Here I have deleted KBONEditFieldLabel.
As for the plotting, you'll need to tell us how to use your app in order to see what is going on.

6 Comments

Tell us what numbers to enter in the app. Consider sharing a screenshot to indicate what is incorrect.
Do you have code that works correctly in a script (e.g. not from the app) that you could share?
Thanks, that is helpful. The script you shared creates the exact same plot, with the same issue. Before digging into App Designer, I'd focus on getting the code correct in the script first.
% Define inputs
Kf1Max = 100;
L_Active = 0.5;
L_min = 0.05;
TauKFON = -1;
TauKFOFF = -1;
Kb1Max = 80;
Kb1Min = 10;
TauKBON = -0.01;
TauKBOFF = -0.01;
T_startLigand = 100;
T_endLigand = 1000;
timespan = [0 3000];
Non_Active_Receptor_concentration = 100;
Active_Receptor_concentration = 0;
% Call Sim function
[t, Non_Active_Receptor_concentration, Active_Receptor_concentration, peak_value, time_to_peak, ...
steady_state, time_to_50_percent, peak_to_steady_state_ratio, Delta, KF_LMaxA, KF_LMaxB, kf_L, kb_1] ...
= Sim (Kf1Max, L_Active, L_min, TauKFON, TauKFOFF, Kb1Max, Kb1Min, TauKBON, TauKBOFF, ...
T_startLigand, T_endLigand, timespan, Non_Active_Receptor_concentration, Active_Receptor_concentration);
% Create plot
plot(t, Non_Active_Receptor_concentration , 'r');
hold on
plot(t, Active_Receptor_concentration, 'b--');
hold off
legend('Non\_Active Receptor' , 'Active\_Receptor');
title('Activation of Receptor'); % Set a title for the first plot
Can you help me out to trace the error in the script.
After some reverse engineering, I believe the root cause is the difference between TauKFON and TauKFOFF (both -1) and TauKBON and TauKBOFF (both -0.01). The result is that kf_L is a step function while kb_1 is damped both turning on and off. Compare the blue and red curves below.
t = 0:3000;
T_startLigand = 100;
T_endLigand = 1000;
%% kf_L
Kf1Max = 100;
L_Active = 0.5;
L_min = 0.05;
TauKFON = -1;
TauKFOFF = -61;
KF_LMaxA = Kf1Max* (L_min / (L_min + 1));
KF_LMaxB = Kf1Max* (L_Active / (L_Active + 1));
kf_L = zeros(1,length(t));
kf_L(t < T_startLigand) = KF_LMaxA;
% Increasing phase: Exponential growth from KF_LMaxA to KF_LMaxB
kf_L(t >= T_startLigand & t < T_endLigand) = KF_LMaxB - (KF_LMaxB - KF_LMaxA) * exp(TauKFON * (0:((T_endLigand-1)-T_startLigand)));
% Decreasing phase: Exponential decay from KF_LMaxA to KF_LMaxB
kf_end = KF_LMaxB - (KF_LMaxB - KF_LMaxA) * exp(TauKFON * (T_endLigand - T_startLigand));
kf_L(t >= T_endLigand) = KF_LMaxA + (kf_end - KF_LMaxA) * exp(TauKFOFF * ((T_endLigand:t(end))-T_endLigand));
%% kb_1
Kb1Max = 80;
Kb1Min = 10;
TauKBON = -0.01;
TauKBOFF = -0.01;
kb_1 = zeros(1,length(t));
kb_1(t < T_startLigand) = Kb1Min;
% Increasing phase: Exponential growth from Kb1Min to Kb1Max
kb_1(t >= T_startLigand & t < T_endLigand) = Kb1Max - (Kb1Max - Kb1Min) * exp(TauKBON * (0:((T_endLigand-1)-T_startLigand)));
% Decreasing phase: Exponential decay from Kb1Max to Kb1Min
kb_end = Kb1Max - (Kb1Max - Kb1Min) * exp(TauKBON * (T_endLigand - T_startLigand));
kb_1(t >= T_endLigand) = Kb1Min + (kb_end - Kb1Min) * exp(TauKBOFF * ((T_endLigand:t(end))-T_endLigand));
yyaxis left
plot(t,kf_L)
yyaxis right
plot(t,kb_1)
legend("kf_L","kb_1",'interpreter','none')
title('Reaction Rates')
That difference in response time means that the forward rate is going 100% as soon as it is turned on while the backward rate takes some time to get there. Based on how you defined the reactions in ode_LR, kf_L is the rate non-active receptors turn into active receptors, and kb_1 is the reverse rate.
Non_Active_Receptor_concentration = 100;
Active_Receptor_concentration = 0;
y0 = [Non_Active_Receptor_concentration, Active_Receptor_concentration];
[t, y] = ode45(@(t,y) ode_LR(t,y,kf_L,kb_1), t, y0);
figure
plot(t,y)
legend('[Non-Active Receptors]','[Active Receptors]')
title('Rerceptor Concentration')
% I've modififed your code for demo purposes only. This is not 'better'
function dydt = ode_LR(t,y,kf_L,kb_1)
t0 = 0:length(kf_L)-1;
kf = interp1(t0,kf_L,t);
kb = interp1(t0,kb_1,t);
dydt = [-kf*y(1) + kb * y(2);
kf * y(1) - kb * y(2)];
end
The sharp change at t=100 is because you have receptors becoming active while none are becoming non-active. This causes a rapid depletion of your non-active concentration, and a rapid increase in your active concentration. After some time, kb_1 increases to a point where the two are more or less in equilibrium until they turn off.
I can't say if this is correct or not. The code is performing as written, and makes intuitive sense to me. I'd start by making sure the rates and other constants are correct, paying close attention to units.
I want that this sharp change should maintain till time TendLigand beacuse the kb_1 is slower reaction than the Kf_L .
There is no MATLAB problem in your code. I suspect you have either not implemented your model correctly, or you are using the wrong values. However, I have no way of knowing what to change without more information from you.
You can guess-and-check different values if that is all that remains to be done.

Sign in to comment.

More Answers (0)

Products

Release

R2023a

Tags

Community Treasure Hunt

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

Start Hunting!