Category: News
Evolving Delivery Optimization beyond classic VPNs
Delivery Optimization settings allows to ‘tag’ a connection as VPN using the policies VPNKeywords and DODisallowCacheServerDownloadsOnVPN.
However the era of classical VPN’s is ending with solutions like ZScaler Private Access where these policies become useless.
In my opinion Delivery Optimization lacks alternative mechanisms to control use of (avoid access to) MCC Cache Host servers.
How can we avoid use of the MCC Cache Host servers over solutions like ZScaler Private Access?
Delivery Optimization settings allows to ‘tag’ a connection as VPN using the policies VPNKeywords and DODisallowCacheServerDownloadsOnVPN. However the era of classical VPN’s is ending with solutions like ZScaler Private Access where these policies become useless. In my opinion Delivery Optimization lacks alternative mechanisms to control use of (avoid access to) MCC Cache Host servers. How can we avoid use of the MCC Cache Host servers over solutions like ZScaler Private Access? Read More
Example of a Device Driver integrated in Simulink using a Custom block
Hi,
Can someone point to any example/sample code demonstrating integration of a board specific device driver code ( for example read data from a serial bus like CAN/SPI, or even simpler read data from ADC etc.. ) into SIMULINK with a custom block.
Which is a better choice for such a requirement , S-Function block or a C Function block?
I want to possibly simulate and also generate the glue code to integrate with the low level driver with the embedded coder.
Thanks in advance
AAAHi,
Can someone point to any example/sample code demonstrating integration of a board specific device driver code ( for example read data from a serial bus like CAN/SPI, or even simpler read data from ADC etc.. ) into SIMULINK with a custom block.
Which is a better choice for such a requirement , S-Function block or a C Function block?
I want to possibly simulate and also generate the glue code to integrate with the low level driver with the embedded coder.
Thanks in advance
AAA Hi,
Can someone point to any example/sample code demonstrating integration of a board specific device driver code ( for example read data from a serial bus like CAN/SPI, or even simpler read data from ADC etc.. ) into SIMULINK with a custom block.
Which is a better choice for such a requirement , S-Function block or a C Function block?
I want to possibly simulate and also generate the glue code to integrate with the low level driver with the embedded coder.
Thanks in advance
AAA custom blocks MATLAB Answers — New Questions
Missing flagged emails they are not showing up on ToDo app
The whole point of flagging an email is so that you don’t miss it. I set due dates on when I need to follow up on an email but now I’m noticing that there are some emails that are flagged but they don’t show up on my ToDo.
The image below shows one email that is flagged for August 16,2024 but on the Todo app it’s not showing. Most of the flagged emails do show up but there are some that don’t and it defeats the purpose of the app.
The whole point of flagging an email is so that you don’t miss it. I set due dates on when I need to follow up on an email but now I’m noticing that there are some emails that are flagged but they don’t show up on my ToDo. The image below shows one email that is flagged for August 16,2024 but on the Todo app it’s not showing. Most of the flagged emails do show up but there are some that don’t and it defeats the purpose of the app. Read More
PIN is not asking in App protection Policy.
Hi Team,
I am using Intune App Protection Policy more than 2000 user and its’ working fine but last one week when user configure app protection policy than open outlook/Team and it is not asking PIN to open app
This issue is started last one week before one week whenever user open company apps like teams/Outlook than it’s prompt PIN or face lock.
Please suggest any update from Microsoft team.
Hi Team, I am using Intune App Protection Policy more than 2000 user and its’ working fine but last one week when user configure app protection policy than open outlook/Team and it is not asking PIN to open app This issue is started last one week before one week whenever user open company apps like teams/Outlook than it’s prompt PIN or face lock. Please suggest any update from Microsoft team. Read More
Integrating a Confirmation Dialog when Duplicating Files in a SharePoint Document Library
Hello everyone,
I’m currently working on a SharePoint solution that provides a customizable collaboration platform for teams within our organization. I’ve created a “Duplicate” button in a document library using an SP ListView CommandSet Extension.
I want to ensure that after duplicating a file or folder, a confirmation dialog appears, similar to the one shown in the attached screenshot. Could you please advise on how I can access this dialog and ensure it is displayed every time a file or folder is duplicated?
Thank you in advance for your support!
Hello everyone, I’m currently working on a SharePoint solution that provides a customizable collaboration platform for teams within our organization. I’ve created a “Duplicate” button in a document library using an SP ListView CommandSet Extension.I want to ensure that after duplicating a file or folder, a confirmation dialog appears, similar to the one shown in the attached screenshot. Could you please advise on how I can access this dialog and ensure it is displayed every time a file or folder is duplicated? Thank you in advance for your support! Read More
Is plotting 2 columns of data on one line possible?
I am trying to reproduce a visual that I created before, however, the formatting of my data has been requested to be streamlined and easier for automatic updates. My original data and visual looked like this:
Now my data must look somewhat like this where an initial and final value are together on one row instead of separate rows. Will it even be possible to reproduce the visual? The only way I can imagine it working is if Excel reads in a zigzag way down C and D.
I am trying to reproduce a visual that I created before, however, the formatting of my data has been requested to be streamlined and easier for automatic updates. My original data and visual looked like this:Now my data must look somewhat like this where an initial and final value are together on one row instead of separate rows. Will it even be possible to reproduce the visual? The only way I can imagine it working is if Excel reads in a zigzag way down C and D. Read More
Shared Forms and Power Automate
Hi, I have a form that has been shared with me, and i want to be able to create a flow that sends the responses to a sql database. I have created the flow but it only gets the responses that I give. Is there anyway that responses from other users can be included in the flow.
I am not sure if its possible from what i have seen online
thanks
Hi, I have a form that has been shared with me, and i want to be able to create a flow that sends the responses to a sql database. I have created the flow but it only gets the responses that I give. Is there anyway that responses from other users can be included in the flow. I am not sure if its possible from what i have seen online thanks Read More
Host Microsoft Defender data locally in India
We are pleased to announce that Microsoft Defender for Endpoint and Microsoft Defender for Identity now support local data residency in India.
This announcement demonstrates our commitment to providing customers with the highest level of security and compliance by offering services that are aligned to local data sovereignty requirements. Customers can now confidently onboard to Defender for Endpoint and Defender for Identity in India, knowing that this Defender data will remain at rest within the Indian boundary. This will help customers meet their regulatory obligations and maintain more control over their data. For more details on the Defender data storage and privacy policies, refer to Microsoft Defender for Endpoint data storage and privacy and Microsoft Defender for Identity data security and privacy.
In addition to India, Defender data residency capabilities are available in the United States, the European Union, the United Kingdom, Australia, and Switzerland. (See our recent announcement for local data hosting in Switzerland.)
Note: Defender for Endpoint and Defender for Identity may potentially use other Microsoft services (i.e. Microsoft Intune for security settings management). Each Microsoft service is governed by its own data storage and privacy policies and may have varying regional availability. For more information, refer to our Online Product Terms.
New Defender for Endpoint and Defender for Identity Customers
All new Defender for Endpoint and Defender for Identity deployments are automatically created in the Azure region closest to your Entra ID location. Because of this, new customers in the region do not need to adjust any settings to take advantage of this new GoLocal geo. See Set up Microsoft Defender for Endpoint deployment and Microsoft Defender for Identity frequently asked questions for more information.
Customers with Existing deployments for Defender for Endpoint and/or Defender for Identity
Existing customers can check their deployment geo within the portal by going to Settings -> Microsoft Defender XDR-> Account; and see where the service is storing your data at rest. For example, in the image below, the service location for the Defender XDR tenant is India.
Image 1: Defender XDR Geolocation information
If you would like to update your service location, please reach out to Customer Service and Support for a tenant reset. Support can be accessed by clicking on the “?” icon in the top right corner of the portal when signed in as an Admin (see image below). If you are a Microsoft Unified support customer, please reach out to your Customer Success Account Manager for assistance with the migration process.
Image 2: Defender portal dashboard
More information:
Ready to go local? Read our documentation for more information on how to get started.
Microsoft Defender XDR data center location
Not yet a customer? Take Defender XDR for a spin via a 90-day trial for Office 365 E5 or Defender for Endpoint via a 90-day trial for Defender for Endpoint
Check out the Defender for Endpoint website to learn more about our industry leading Endpoint protection platform
Check out the Defender for Identity website to learn how to keep your organization safe against rising identity threats
Microsoft Tech Community – Latest Blogs –Read More
Control Signal Editor with Simulink Real Time
Hello MathWorks community,
I’m currently working on my Speedgoat RealTime target, and I would like to perform Data Replay, using the block Signal Editor.
My scenario is well configured, and the simulation works pretty well, but currently the data are generated by the Signal Editor as soon the simulation Start. However I need before to wake-up the DUT and let him correctly initialize …
We can imagine to use a Switch bloc with 2 differents bus with the data comming from the Signal Editor, and from the plant model to allow the DUT to correctly init. Unfortunalty, because the Signal Editor is already sending the data, I cannot perform the replay testing as expected.
Is there an option for controlling the Signal Editor (such as start/stop/loop) with Simulink RealTime during the Simulation ?
Thank you for your advice !
RegardsHello MathWorks community,
I’m currently working on my Speedgoat RealTime target, and I would like to perform Data Replay, using the block Signal Editor.
My scenario is well configured, and the simulation works pretty well, but currently the data are generated by the Signal Editor as soon the simulation Start. However I need before to wake-up the DUT and let him correctly initialize …
We can imagine to use a Switch bloc with 2 differents bus with the data comming from the Signal Editor, and from the plant model to allow the DUT to correctly init. Unfortunalty, because the Signal Editor is already sending the data, I cannot perform the replay testing as expected.
Is there an option for controlling the Signal Editor (such as start/stop/loop) with Simulink RealTime during the Simulation ?
Thank you for your advice !
Regards Hello MathWorks community,
I’m currently working on my Speedgoat RealTime target, and I would like to perform Data Replay, using the block Signal Editor.
My scenario is well configured, and the simulation works pretty well, but currently the data are generated by the Signal Editor as soon the simulation Start. However I need before to wake-up the DUT and let him correctly initialize …
We can imagine to use a Switch bloc with 2 differents bus with the data comming from the Signal Editor, and from the plant model to allow the DUT to correctly init. Unfortunalty, because the Signal Editor is already sending the data, I cannot perform the replay testing as expected.
Is there an option for controlling the Signal Editor (such as start/stop/loop) with Simulink RealTime during the Simulation ?
Thank you for your advice !
Regards signal editor, simulink realtime, speedgoat MATLAB Answers — New Questions
Find the combination that maximize the objective function values from the data set.
Hello,
I have a written a small piece of code to find the unique combinations from the excel file which has data from my objective optimzation problem.
The file has six columns other hidden columns are not important. The first column in the green shows the objective value, the second and third column with blue indicates the constraint outputs, and fourth, fifth and sixth column with the yellow represents the combinations that are maximizing my objective function.
I have to choose the maximum (green) value from first column each time in the iteration, which will then select the constraint values (blue) from second and third column, whatever they may be. Additionally, each time, it should select a unique combination (yellow) from fourth fifth and sixth column different from the previous combination that maximized the value. No combination value in column should be repeated like if in first iteration it selected [1 8 1] then in next it should [2 6 2] or [3 7 1] or [4 6 5] but every time based on the maximum value it should have unique combination which is maximizing the objective.
My code snippet is here as I am not able to figure out how to choose unique value in every column.
filename = ‘Objective Optimization MATLAB.xlsx’;
data = readtable(filename);
% Initialize variables
previous_combination = [0 0 0];
% Number of iterations (adjust as needed)
num_iterations = 10;
for i = 1:num_iterations
% Find the maximum objective value
[max_value, max_index] = max(data{:, 1});
% Get the corresponding constraint values and combination
constraint_value1 = data{max_index, 2};
constraint_value2 = data{max_index, 3};
combination = data{max_index, 4:6};
% Check if the combination is unique in each column
while ~isempty(previous_combination) && any(combination == previous_combination)
% Remove the current maximum value to find the next one
data{max_index, 1} = -inf;
[max_value, max_index] = max(data{:, 1});
constraint_value1 = data{max_index, 2};
constraint_value2 = data{max_index, 3};
combination = data{max_index, 4:6};
end
% Ensure no two column values are identical
while length(unique(combination)) < length(combination)
% Remove the current maximum value to find the next one
data{max_index, 1} = -inf;
[max_value, max_index] = max(data{:, 1});
constraint_value1 = data{max_index, 2};
constraint_value2 = data{max_index, 3};
combination = data{max_index, 4:6};
end
% Store the combination to avoid repetition
previous_combination = combination;
% Display the results
fprintf(‘Iteration %d:n’, i);
fprintf(‘Max Objective Value: %fn’, max_value);
fprintf(‘Constraint Value 1: %fn’, constraint_value1);
fprintf(‘Constraint Value 2: %fn’, constraint_value2);
fprintf(‘Combination: %snn’, mat2str(combination));
uniquecombinations(i,:) = combination;
% Remove the current maximum value to find the next one in the next iteration
data{max_index, 1} = -inf;
end
% Getting these combinations
1 8 2
3 7 1
1 3 2
3 6 1
1 2 3
3 5 1
7 8 1
3 2 4
3 1 2
4 8 1
% Since in first column 3 and 1 are repeated
% In 2nd column 8 is repeated
% In 3rd column 2 and 1 are repeated.Hello,
I have a written a small piece of code to find the unique combinations from the excel file which has data from my objective optimzation problem.
The file has six columns other hidden columns are not important. The first column in the green shows the objective value, the second and third column with blue indicates the constraint outputs, and fourth, fifth and sixth column with the yellow represents the combinations that are maximizing my objective function.
I have to choose the maximum (green) value from first column each time in the iteration, which will then select the constraint values (blue) from second and third column, whatever they may be. Additionally, each time, it should select a unique combination (yellow) from fourth fifth and sixth column different from the previous combination that maximized the value. No combination value in column should be repeated like if in first iteration it selected [1 8 1] then in next it should [2 6 2] or [3 7 1] or [4 6 5] but every time based on the maximum value it should have unique combination which is maximizing the objective.
My code snippet is here as I am not able to figure out how to choose unique value in every column.
filename = ‘Objective Optimization MATLAB.xlsx’;
data = readtable(filename);
% Initialize variables
previous_combination = [0 0 0];
% Number of iterations (adjust as needed)
num_iterations = 10;
for i = 1:num_iterations
% Find the maximum objective value
[max_value, max_index] = max(data{:, 1});
% Get the corresponding constraint values and combination
constraint_value1 = data{max_index, 2};
constraint_value2 = data{max_index, 3};
combination = data{max_index, 4:6};
% Check if the combination is unique in each column
while ~isempty(previous_combination) && any(combination == previous_combination)
% Remove the current maximum value to find the next one
data{max_index, 1} = -inf;
[max_value, max_index] = max(data{:, 1});
constraint_value1 = data{max_index, 2};
constraint_value2 = data{max_index, 3};
combination = data{max_index, 4:6};
end
% Ensure no two column values are identical
while length(unique(combination)) < length(combination)
% Remove the current maximum value to find the next one
data{max_index, 1} = -inf;
[max_value, max_index] = max(data{:, 1});
constraint_value1 = data{max_index, 2};
constraint_value2 = data{max_index, 3};
combination = data{max_index, 4:6};
end
% Store the combination to avoid repetition
previous_combination = combination;
% Display the results
fprintf(‘Iteration %d:n’, i);
fprintf(‘Max Objective Value: %fn’, max_value);
fprintf(‘Constraint Value 1: %fn’, constraint_value1);
fprintf(‘Constraint Value 2: %fn’, constraint_value2);
fprintf(‘Combination: %snn’, mat2str(combination));
uniquecombinations(i,:) = combination;
% Remove the current maximum value to find the next one in the next iteration
data{max_index, 1} = -inf;
end
% Getting these combinations
1 8 2
3 7 1
1 3 2
3 6 1
1 2 3
3 5 1
7 8 1
3 2 4
3 1 2
4 8 1
% Since in first column 3 and 1 are repeated
% In 2nd column 8 is repeated
% In 3rd column 2 and 1 are repeated. Hello,
I have a written a small piece of code to find the unique combinations from the excel file which has data from my objective optimzation problem.
The file has six columns other hidden columns are not important. The first column in the green shows the objective value, the second and third column with blue indicates the constraint outputs, and fourth, fifth and sixth column with the yellow represents the combinations that are maximizing my objective function.
I have to choose the maximum (green) value from first column each time in the iteration, which will then select the constraint values (blue) from second and third column, whatever they may be. Additionally, each time, it should select a unique combination (yellow) from fourth fifth and sixth column different from the previous combination that maximized the value. No combination value in column should be repeated like if in first iteration it selected [1 8 1] then in next it should [2 6 2] or [3 7 1] or [4 6 5] but every time based on the maximum value it should have unique combination which is maximizing the objective.
My code snippet is here as I am not able to figure out how to choose unique value in every column.
filename = ‘Objective Optimization MATLAB.xlsx’;
data = readtable(filename);
% Initialize variables
previous_combination = [0 0 0];
% Number of iterations (adjust as needed)
num_iterations = 10;
for i = 1:num_iterations
% Find the maximum objective value
[max_value, max_index] = max(data{:, 1});
% Get the corresponding constraint values and combination
constraint_value1 = data{max_index, 2};
constraint_value2 = data{max_index, 3};
combination = data{max_index, 4:6};
% Check if the combination is unique in each column
while ~isempty(previous_combination) && any(combination == previous_combination)
% Remove the current maximum value to find the next one
data{max_index, 1} = -inf;
[max_value, max_index] = max(data{:, 1});
constraint_value1 = data{max_index, 2};
constraint_value2 = data{max_index, 3};
combination = data{max_index, 4:6};
end
% Ensure no two column values are identical
while length(unique(combination)) < length(combination)
% Remove the current maximum value to find the next one
data{max_index, 1} = -inf;
[max_value, max_index] = max(data{:, 1});
constraint_value1 = data{max_index, 2};
constraint_value2 = data{max_index, 3};
combination = data{max_index, 4:6};
end
% Store the combination to avoid repetition
previous_combination = combination;
% Display the results
fprintf(‘Iteration %d:n’, i);
fprintf(‘Max Objective Value: %fn’, max_value);
fprintf(‘Constraint Value 1: %fn’, constraint_value1);
fprintf(‘Constraint Value 2: %fn’, constraint_value2);
fprintf(‘Combination: %snn’, mat2str(combination));
uniquecombinations(i,:) = combination;
% Remove the current maximum value to find the next one in the next iteration
data{max_index, 1} = -inf;
end
% Getting these combinations
1 8 2
3 7 1
1 3 2
3 6 1
1 2 3
3 5 1
7 8 1
3 2 4
3 1 2
4 8 1
% Since in first column 3 and 1 are repeated
% In 2nd column 8 is repeated
% In 3rd column 2 and 1 are repeated. combination, maximizing the objective MATLAB Answers — New Questions
What the phase C values are not coming Rpeak = 90% and Rss = 58% while other phase values are correct. Kindly explain is their any logical error in the code
What the phase C values are not coming Rpeak = 90% and Rss = 58% while other phase values are correct. Kindly explain is their any logical error in the code. Thanks
% Define parameters
Kf_Max = 100; % maximum forward rate
RLC = [0.01, 1, 10,0.01]; % RLC values
TauKf_ON = -0.01; % TauKf_ON
TauKf_OFF = -0.01; % TauKf_OFF
Kb_Max = 80; % maximum backward rate
Kb_Min = 10; % minimum backward rate
TauKb_ON = -0.01; % TauKb_ON
TauKb_OFF = -0.01; % TauKb_OFF
PhaseTimes = [0, 10, 500, 1000, 2000];% phase times (each row defines a phase)
timespan = [0, 2000]; % timespan for the simulation
% Example initial conditions for non-active and active receptor concentrations
Non_Active_Receptor_concentration = 100; % Initial non-active receptor concentration (as a vector)
Active_Receptor_concentration =0; % Initial active receptor concentration (as a vector)
[t, Non_Active_Receptor_concentration, Active_Receptor_concentration, PhaseResults, Kf_LMax, Kb] =TestCode1(Kf_Max, RLC, TauKf_ON, …
Kb_Max, Kb_Min, TauKb_ON, PhaseTimes, timespan, Non_Active_Receptor_concentration, Active_Receptor_concentration);
function [t, Non_Active_Receptor_concentration, Active_Receptor_concentration, PhaseResults, Kf_LMax, Kb] =TestCode1(Kf_Max, RLC, TauKf_ON, …
Kb_Max, Kb_Min, TauKb_ON, PhaseTimes, timespan, Non_Active_Receptor_concentration, Active_Receptor_concentration)
% Define functions for forward and backward reaction rates
Kf_L = @(t) calculate_kf(t, PhaseTimes, Kf_Max, RLC, TauKf_ON);
Kb = @(t) calculate_kb(t, PhaseTimes, Kb_Max, Kb_Min, TauKb_ON, RLC);
% Ensure that Non_Active_Receptor_concentration and Active_Receptor_concentration are column vectors
Non_Active_Receptor_concentration = Non_Active_Receptor_concentration(:);
Active_Receptor_concentration = Active_Receptor_concentration(:);
% Set initial conditions
initial_conditions = [Non_Active_Receptor_concentration(1); Active_Receptor_concentration(1)];
% Set ODE options for step size
options = odeset(‘MaxStep’, 0.05, ‘RelTol’, 1e-6, ‘AbsTol’, 1e-8);
% Solve the ODE system
[t, y] = ode45(@(t, y) ode_LR(t, y, Kf_L, Kb), timespan, initial_conditions, options);
% Extract the concentrations
Non_Active_Receptor_concentration = y(:, 1);
Active_Receptor_concentration = y(:, 2);
% Calculate forward and backward reaction rates over time
Kf_values = arrayfun(Kf_L, t);
Kb_values = arrayfun(Kb, t);
% Plot active and non-active receptor concentrations
figure;
plot(t, Non_Active_Receptor_concentration, ‘r’, ‘DisplayName’, ‘Non-Active Receptor Concentration’);
hold on;
plot(t, Active_Receptor_concentration, ‘b’, ‘DisplayName’, ‘Active Receptor Concentration’);
legend;
xlabel(‘Time’);
ylabel(‘Concentration’);
title(‘Receptor Concentrations’);
hold off;
% Plot forward and backward reaction rates
figure;
plot(t, Kf_values, ‘k’, ‘DisplayName’, ‘Forward Reaction Rate’);
hold on;
plot(t, Kb_values, ‘c’, ‘DisplayName’, ‘Backward Reaction Rate’);
legend;
xlabel(‘Time’);
ylabel(‘Reaction Rate’);
title(‘Reaction Rates’);
hold off;
% Calculate phase results
PhaseResults = arrayfun(@(i) …
calculate_phase(t, Active_Receptor_concentration, PhaseTimes(:,i:i+1), RLC(i)) …
, 1:(size(PhaseTimes, 2)-1), ‘UniformOutput’, false);
PhaseResults = vertcat(PhaseResults{:}); % Concatenate results
% Calculate maximum forward reaction rate
Kf_LMax = Kf_Max * (RLC ./ (RLC + 1));
% Write Phase results to CSV
for i = 1:size(PhaseResults, 1)
PhaseTable = struct2table(PhaseResults(i))
writetable(PhaseTable, [‘Phase’, num2str(i), ‘.csv’]);
end
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function Kf_L = calculate_kf(t, PhaseTimes, Kf_Max, RLC, TauKf_ON)
Kf_LMax = Kf_Max * (RLC ./ (RLC + 1));
Kf_L = Kf_LMax(1); % Default to the first phase value
num_phases = numel(RLC);
for j = 1:num_phases
T_start = PhaseTimes(j);
T_end = PhaseTimes(j + 1);
if t >= T_start && t < T_end
if j == 1
Kf_L = Kf_LMax(j);
else
prev_end = PhaseTimes(j);
if j < num_phases
if RLC(j-1) < RLC(j) && RLC(j) > RLC(j+1)
Kf_L = Kf_LMax(j);
elseif RLC(j-1) < RLC(j) && RLC(j) <= RLC(j+1)
Kf_end = Kf_LMax(j) – (Kf_LMax(j) – Kf_LMax(j-1)) * exp(TauKf_ON * (T_end – T_start));
Kf_L = Kf_LMax(j) + (Kf_end – Kf_LMax(j-1)) * exp(TauKf_ON * (t – prev_end));
elseif RLC(j-1) > RLC(j) && RLC(j) < RLC(j+1)
Kf_end = Kf_LMax(j) – (Kf_LMax(j) – Kf_LMax(j-1)) * exp(TauKf_ON * (T_end – T_start));
Kf_L = Kf_LMax(j) + (Kf_end – Kf_LMax(j-1)) * exp(TauKf_ON * (t – prev_end));
elseif RLC(j-1) > RLC(j) && RLC(j) >= RLC(j+1)
Kf_end = Kf_LMax(j) – (Kf_LMax(j) – Kf_LMax(j-1)) * exp(TauKf_ON * (T_end – T_start));
Kf_L = Kf_LMax(j) + (Kf_end – Kf_LMax(j-1)) * exp(TauKf_ON * (t – prev_end));
end
end
end
return;
end
end
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function Kb = calculate_kb(t, PhaseTimes, Kb_Max, Kb_Min, ~, RLC)
Kb = Kb_Max; % Default to the minimum value
if all(RLC == RLC(1))
Kb = Kb_Min; % Set Kb to Kb_Min if all RLC values are equal
return;
end
for j = 1:numel(RLC)
T_start = PhaseTimes(j);
T_end = PhaseTimes(j + 1);
if t >= T_start && t < T_end
if j == 1
Kb = Kb_Max;
else
% prev_end = PhaseTimes(j);
if j < numel(RLC)
if RLC(j-1) < RLC(j) && RLC(j) > RLC(j+1)
Kb = Kb_Max ;
elseif RLC(j-1) < RLC(j) && RLC(j) <= RLC(j+1)
Kb = Kb_Max ;
elseif RLC(j-1) > RLC(j) && RLC(j) < RLC(j+1)
Kb = Kb_Max;
elseif RLC(j-1) > RLC(j) && RLC(j) >= RLC(j+1)
Kb = Kb_Max ;
end
else
if RLC(j-1) < RLC(j)
Kb = Kb_Max;
elseif RLC(j-1) > RLC(j)
Kb = Kb_Max;
end
end
end
return;
end
end
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function dydt = ode_LR(t, y, Kf_L, Kb)
Non_Active_Receptor_concentration = y(1);
Active_Receptor_concentration = y(2);
dNonActiveReceptor_dt = -Kf_L(t) * Non_Active_Receptor_concentration + Kb(t) * Active_Receptor_concentration;
dActiveReceptor_dt = Kf_L(t) * Non_Active_Receptor_concentration – Kb(t) * Active_Receptor_concentration;
dydt = [dNonActiveReceptor_dt; dActiveReceptor_dt];
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function result = calculate_phase(t, Active_Receptor_concentration, PhaseTimes, RLC)
T_start = PhaseTimes(:,1);
T_end = PhaseTimes(:,2);
Phase_indices = (t >= T_start & t <= T_end);
Phase_concentration = Active_Receptor_concentration(Phase_indices);
Phase_time = t(Phase_indices);
% Calculate peak and steady-state values
[Rpeak, Tpeak, peak_type] = findpeak(Phase_time, Phase_concentration);
Rss = mean(Active_Receptor_concentration(t >= (T_end – 10) & t <= T_end));
% Calculate the T50 (time to reach half of peak value)
half_peak_value = (Rss + Rpeak) / 2;
[~, idx_50_percent] = min(abs(Phase_concentration – half_peak_value));
T50 = Phase_time(idx_50_percent) – Tpeak;
% Calculate other metrics
ratio_Rpeak_Rss = Rpeak / Rss;
Delta = Rpeak – Rss;
L = RLC;
% Package results in a struct
result.Rpeak = Rpeak;
result.Rss = Rss;
result.Tpeak = Tpeak;
result.T50 = T50;
result.ratio_Rpeak_Rss = ratio_Rpeak_Rss;
result.Delta = Delta;
result.L = L;
result.peak_type = peak_type;
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [Rpeak, Tpeak, peak_type] = findpeak(time, concentration)
% Compute the derivative
dt = diff(time);
dy = diff(concentration);
derivative = dy ./ dt;
% Find zero-crossings of the derivative
zero_crossings = find(diff(sign(derivative)) ~= 0);
% Initialize output variables
Rpeak = NaN;
Tpeak = NaN;
peak_type = ‘None’;
% Check if there are zero crossings
if ~isempty(zero_crossings)
% Identify peaks and troughs by examining the sign changes
max_indices = zero_crossings(derivative(zero_crossings) > 0 & derivative(zero_crossings + 1) < 0);
min_indices = zero_crossings(derivative(zero_crossings) < 0 & derivative(zero_crossings + 1) > 0);
% Check if there are maxima or minima
if ~isempty(max_indices) || ~isempty(min_indices)
if ~isempty(max_indices) && ~isempty(min_indices)
% Find the highest maximum
[Rpeak_max, maxIdx] = max(concentration(max_indices));
% Find the lowest minimum
[Rpeak_min, minIdx] = min(concentration(min_indices));
% Determine whether the highest maximum is greater or the lowest minimum is smaller
if Rpeak_max >= abs(Rpeak_min)
Rpeak = Rpeak_max;
Tpeak = time(max_indices(maxIdx));
peak_type = ‘High’;
else
Rpeak = Rpeak_min;
Tpeak = time(min_indices(minIdx));
peak_type = ‘Low’;
end
% If only maxima exist
elseif ~isempty(max_indices)
[Rpeak, maxIdx] = max(concentration(max_indices));
Tpeak = time(max_indices(maxIdx));
peak_type = ‘High’;
% If only minima exist
elseif ~isempty(min_indices)
[Rpeak, minIdx] = min(concentration(min_indices));
Tpeak = time(min_indices(minIdx));
peak_type = ‘Low’;
end
end
end
endWhat the phase C values are not coming Rpeak = 90% and Rss = 58% while other phase values are correct. Kindly explain is their any logical error in the code. Thanks
% Define parameters
Kf_Max = 100; % maximum forward rate
RLC = [0.01, 1, 10,0.01]; % RLC values
TauKf_ON = -0.01; % TauKf_ON
TauKf_OFF = -0.01; % TauKf_OFF
Kb_Max = 80; % maximum backward rate
Kb_Min = 10; % minimum backward rate
TauKb_ON = -0.01; % TauKb_ON
TauKb_OFF = -0.01; % TauKb_OFF
PhaseTimes = [0, 10, 500, 1000, 2000];% phase times (each row defines a phase)
timespan = [0, 2000]; % timespan for the simulation
% Example initial conditions for non-active and active receptor concentrations
Non_Active_Receptor_concentration = 100; % Initial non-active receptor concentration (as a vector)
Active_Receptor_concentration =0; % Initial active receptor concentration (as a vector)
[t, Non_Active_Receptor_concentration, Active_Receptor_concentration, PhaseResults, Kf_LMax, Kb] =TestCode1(Kf_Max, RLC, TauKf_ON, …
Kb_Max, Kb_Min, TauKb_ON, PhaseTimes, timespan, Non_Active_Receptor_concentration, Active_Receptor_concentration);
function [t, Non_Active_Receptor_concentration, Active_Receptor_concentration, PhaseResults, Kf_LMax, Kb] =TestCode1(Kf_Max, RLC, TauKf_ON, …
Kb_Max, Kb_Min, TauKb_ON, PhaseTimes, timespan, Non_Active_Receptor_concentration, Active_Receptor_concentration)
% Define functions for forward and backward reaction rates
Kf_L = @(t) calculate_kf(t, PhaseTimes, Kf_Max, RLC, TauKf_ON);
Kb = @(t) calculate_kb(t, PhaseTimes, Kb_Max, Kb_Min, TauKb_ON, RLC);
% Ensure that Non_Active_Receptor_concentration and Active_Receptor_concentration are column vectors
Non_Active_Receptor_concentration = Non_Active_Receptor_concentration(:);
Active_Receptor_concentration = Active_Receptor_concentration(:);
% Set initial conditions
initial_conditions = [Non_Active_Receptor_concentration(1); Active_Receptor_concentration(1)];
% Set ODE options for step size
options = odeset(‘MaxStep’, 0.05, ‘RelTol’, 1e-6, ‘AbsTol’, 1e-8);
% Solve the ODE system
[t, y] = ode45(@(t, y) ode_LR(t, y, Kf_L, Kb), timespan, initial_conditions, options);
% Extract the concentrations
Non_Active_Receptor_concentration = y(:, 1);
Active_Receptor_concentration = y(:, 2);
% Calculate forward and backward reaction rates over time
Kf_values = arrayfun(Kf_L, t);
Kb_values = arrayfun(Kb, t);
% Plot active and non-active receptor concentrations
figure;
plot(t, Non_Active_Receptor_concentration, ‘r’, ‘DisplayName’, ‘Non-Active Receptor Concentration’);
hold on;
plot(t, Active_Receptor_concentration, ‘b’, ‘DisplayName’, ‘Active Receptor Concentration’);
legend;
xlabel(‘Time’);
ylabel(‘Concentration’);
title(‘Receptor Concentrations’);
hold off;
% Plot forward and backward reaction rates
figure;
plot(t, Kf_values, ‘k’, ‘DisplayName’, ‘Forward Reaction Rate’);
hold on;
plot(t, Kb_values, ‘c’, ‘DisplayName’, ‘Backward Reaction Rate’);
legend;
xlabel(‘Time’);
ylabel(‘Reaction Rate’);
title(‘Reaction Rates’);
hold off;
% Calculate phase results
PhaseResults = arrayfun(@(i) …
calculate_phase(t, Active_Receptor_concentration, PhaseTimes(:,i:i+1), RLC(i)) …
, 1:(size(PhaseTimes, 2)-1), ‘UniformOutput’, false);
PhaseResults = vertcat(PhaseResults{:}); % Concatenate results
% Calculate maximum forward reaction rate
Kf_LMax = Kf_Max * (RLC ./ (RLC + 1));
% Write Phase results to CSV
for i = 1:size(PhaseResults, 1)
PhaseTable = struct2table(PhaseResults(i))
writetable(PhaseTable, [‘Phase’, num2str(i), ‘.csv’]);
end
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function Kf_L = calculate_kf(t, PhaseTimes, Kf_Max, RLC, TauKf_ON)
Kf_LMax = Kf_Max * (RLC ./ (RLC + 1));
Kf_L = Kf_LMax(1); % Default to the first phase value
num_phases = numel(RLC);
for j = 1:num_phases
T_start = PhaseTimes(j);
T_end = PhaseTimes(j + 1);
if t >= T_start && t < T_end
if j == 1
Kf_L = Kf_LMax(j);
else
prev_end = PhaseTimes(j);
if j < num_phases
if RLC(j-1) < RLC(j) && RLC(j) > RLC(j+1)
Kf_L = Kf_LMax(j);
elseif RLC(j-1) < RLC(j) && RLC(j) <= RLC(j+1)
Kf_end = Kf_LMax(j) – (Kf_LMax(j) – Kf_LMax(j-1)) * exp(TauKf_ON * (T_end – T_start));
Kf_L = Kf_LMax(j) + (Kf_end – Kf_LMax(j-1)) * exp(TauKf_ON * (t – prev_end));
elseif RLC(j-1) > RLC(j) && RLC(j) < RLC(j+1)
Kf_end = Kf_LMax(j) – (Kf_LMax(j) – Kf_LMax(j-1)) * exp(TauKf_ON * (T_end – T_start));
Kf_L = Kf_LMax(j) + (Kf_end – Kf_LMax(j-1)) * exp(TauKf_ON * (t – prev_end));
elseif RLC(j-1) > RLC(j) && RLC(j) >= RLC(j+1)
Kf_end = Kf_LMax(j) – (Kf_LMax(j) – Kf_LMax(j-1)) * exp(TauKf_ON * (T_end – T_start));
Kf_L = Kf_LMax(j) + (Kf_end – Kf_LMax(j-1)) * exp(TauKf_ON * (t – prev_end));
end
end
end
return;
end
end
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function Kb = calculate_kb(t, PhaseTimes, Kb_Max, Kb_Min, ~, RLC)
Kb = Kb_Max; % Default to the minimum value
if all(RLC == RLC(1))
Kb = Kb_Min; % Set Kb to Kb_Min if all RLC values are equal
return;
end
for j = 1:numel(RLC)
T_start = PhaseTimes(j);
T_end = PhaseTimes(j + 1);
if t >= T_start && t < T_end
if j == 1
Kb = Kb_Max;
else
% prev_end = PhaseTimes(j);
if j < numel(RLC)
if RLC(j-1) < RLC(j) && RLC(j) > RLC(j+1)
Kb = Kb_Max ;
elseif RLC(j-1) < RLC(j) && RLC(j) <= RLC(j+1)
Kb = Kb_Max ;
elseif RLC(j-1) > RLC(j) && RLC(j) < RLC(j+1)
Kb = Kb_Max;
elseif RLC(j-1) > RLC(j) && RLC(j) >= RLC(j+1)
Kb = Kb_Max ;
end
else
if RLC(j-1) < RLC(j)
Kb = Kb_Max;
elseif RLC(j-1) > RLC(j)
Kb = Kb_Max;
end
end
end
return;
end
end
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function dydt = ode_LR(t, y, Kf_L, Kb)
Non_Active_Receptor_concentration = y(1);
Active_Receptor_concentration = y(2);
dNonActiveReceptor_dt = -Kf_L(t) * Non_Active_Receptor_concentration + Kb(t) * Active_Receptor_concentration;
dActiveReceptor_dt = Kf_L(t) * Non_Active_Receptor_concentration – Kb(t) * Active_Receptor_concentration;
dydt = [dNonActiveReceptor_dt; dActiveReceptor_dt];
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function result = calculate_phase(t, Active_Receptor_concentration, PhaseTimes, RLC)
T_start = PhaseTimes(:,1);
T_end = PhaseTimes(:,2);
Phase_indices = (t >= T_start & t <= T_end);
Phase_concentration = Active_Receptor_concentration(Phase_indices);
Phase_time = t(Phase_indices);
% Calculate peak and steady-state values
[Rpeak, Tpeak, peak_type] = findpeak(Phase_time, Phase_concentration);
Rss = mean(Active_Receptor_concentration(t >= (T_end – 10) & t <= T_end));
% Calculate the T50 (time to reach half of peak value)
half_peak_value = (Rss + Rpeak) / 2;
[~, idx_50_percent] = min(abs(Phase_concentration – half_peak_value));
T50 = Phase_time(idx_50_percent) – Tpeak;
% Calculate other metrics
ratio_Rpeak_Rss = Rpeak / Rss;
Delta = Rpeak – Rss;
L = RLC;
% Package results in a struct
result.Rpeak = Rpeak;
result.Rss = Rss;
result.Tpeak = Tpeak;
result.T50 = T50;
result.ratio_Rpeak_Rss = ratio_Rpeak_Rss;
result.Delta = Delta;
result.L = L;
result.peak_type = peak_type;
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [Rpeak, Tpeak, peak_type] = findpeak(time, concentration)
% Compute the derivative
dt = diff(time);
dy = diff(concentration);
derivative = dy ./ dt;
% Find zero-crossings of the derivative
zero_crossings = find(diff(sign(derivative)) ~= 0);
% Initialize output variables
Rpeak = NaN;
Tpeak = NaN;
peak_type = ‘None’;
% Check if there are zero crossings
if ~isempty(zero_crossings)
% Identify peaks and troughs by examining the sign changes
max_indices = zero_crossings(derivative(zero_crossings) > 0 & derivative(zero_crossings + 1) < 0);
min_indices = zero_crossings(derivative(zero_crossings) < 0 & derivative(zero_crossings + 1) > 0);
% Check if there are maxima or minima
if ~isempty(max_indices) || ~isempty(min_indices)
if ~isempty(max_indices) && ~isempty(min_indices)
% Find the highest maximum
[Rpeak_max, maxIdx] = max(concentration(max_indices));
% Find the lowest minimum
[Rpeak_min, minIdx] = min(concentration(min_indices));
% Determine whether the highest maximum is greater or the lowest minimum is smaller
if Rpeak_max >= abs(Rpeak_min)
Rpeak = Rpeak_max;
Tpeak = time(max_indices(maxIdx));
peak_type = ‘High’;
else
Rpeak = Rpeak_min;
Tpeak = time(min_indices(minIdx));
peak_type = ‘Low’;
end
% If only maxima exist
elseif ~isempty(max_indices)
[Rpeak, maxIdx] = max(concentration(max_indices));
Tpeak = time(max_indices(maxIdx));
peak_type = ‘High’;
% If only minima exist
elseif ~isempty(min_indices)
[Rpeak, minIdx] = min(concentration(min_indices));
Tpeak = time(min_indices(minIdx));
peak_type = ‘Low’;
end
end
end
end What the phase C values are not coming Rpeak = 90% and Rss = 58% while other phase values are correct. Kindly explain is their any logical error in the code. Thanks
% Define parameters
Kf_Max = 100; % maximum forward rate
RLC = [0.01, 1, 10,0.01]; % RLC values
TauKf_ON = -0.01; % TauKf_ON
TauKf_OFF = -0.01; % TauKf_OFF
Kb_Max = 80; % maximum backward rate
Kb_Min = 10; % minimum backward rate
TauKb_ON = -0.01; % TauKb_ON
TauKb_OFF = -0.01; % TauKb_OFF
PhaseTimes = [0, 10, 500, 1000, 2000];% phase times (each row defines a phase)
timespan = [0, 2000]; % timespan for the simulation
% Example initial conditions for non-active and active receptor concentrations
Non_Active_Receptor_concentration = 100; % Initial non-active receptor concentration (as a vector)
Active_Receptor_concentration =0; % Initial active receptor concentration (as a vector)
[t, Non_Active_Receptor_concentration, Active_Receptor_concentration, PhaseResults, Kf_LMax, Kb] =TestCode1(Kf_Max, RLC, TauKf_ON, …
Kb_Max, Kb_Min, TauKb_ON, PhaseTimes, timespan, Non_Active_Receptor_concentration, Active_Receptor_concentration);
function [t, Non_Active_Receptor_concentration, Active_Receptor_concentration, PhaseResults, Kf_LMax, Kb] =TestCode1(Kf_Max, RLC, TauKf_ON, …
Kb_Max, Kb_Min, TauKb_ON, PhaseTimes, timespan, Non_Active_Receptor_concentration, Active_Receptor_concentration)
% Define functions for forward and backward reaction rates
Kf_L = @(t) calculate_kf(t, PhaseTimes, Kf_Max, RLC, TauKf_ON);
Kb = @(t) calculate_kb(t, PhaseTimes, Kb_Max, Kb_Min, TauKb_ON, RLC);
% Ensure that Non_Active_Receptor_concentration and Active_Receptor_concentration are column vectors
Non_Active_Receptor_concentration = Non_Active_Receptor_concentration(:);
Active_Receptor_concentration = Active_Receptor_concentration(:);
% Set initial conditions
initial_conditions = [Non_Active_Receptor_concentration(1); Active_Receptor_concentration(1)];
% Set ODE options for step size
options = odeset(‘MaxStep’, 0.05, ‘RelTol’, 1e-6, ‘AbsTol’, 1e-8);
% Solve the ODE system
[t, y] = ode45(@(t, y) ode_LR(t, y, Kf_L, Kb), timespan, initial_conditions, options);
% Extract the concentrations
Non_Active_Receptor_concentration = y(:, 1);
Active_Receptor_concentration = y(:, 2);
% Calculate forward and backward reaction rates over time
Kf_values = arrayfun(Kf_L, t);
Kb_values = arrayfun(Kb, t);
% Plot active and non-active receptor concentrations
figure;
plot(t, Non_Active_Receptor_concentration, ‘r’, ‘DisplayName’, ‘Non-Active Receptor Concentration’);
hold on;
plot(t, Active_Receptor_concentration, ‘b’, ‘DisplayName’, ‘Active Receptor Concentration’);
legend;
xlabel(‘Time’);
ylabel(‘Concentration’);
title(‘Receptor Concentrations’);
hold off;
% Plot forward and backward reaction rates
figure;
plot(t, Kf_values, ‘k’, ‘DisplayName’, ‘Forward Reaction Rate’);
hold on;
plot(t, Kb_values, ‘c’, ‘DisplayName’, ‘Backward Reaction Rate’);
legend;
xlabel(‘Time’);
ylabel(‘Reaction Rate’);
title(‘Reaction Rates’);
hold off;
% Calculate phase results
PhaseResults = arrayfun(@(i) …
calculate_phase(t, Active_Receptor_concentration, PhaseTimes(:,i:i+1), RLC(i)) …
, 1:(size(PhaseTimes, 2)-1), ‘UniformOutput’, false);
PhaseResults = vertcat(PhaseResults{:}); % Concatenate results
% Calculate maximum forward reaction rate
Kf_LMax = Kf_Max * (RLC ./ (RLC + 1));
% Write Phase results to CSV
for i = 1:size(PhaseResults, 1)
PhaseTable = struct2table(PhaseResults(i))
writetable(PhaseTable, [‘Phase’, num2str(i), ‘.csv’]);
end
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function Kf_L = calculate_kf(t, PhaseTimes, Kf_Max, RLC, TauKf_ON)
Kf_LMax = Kf_Max * (RLC ./ (RLC + 1));
Kf_L = Kf_LMax(1); % Default to the first phase value
num_phases = numel(RLC);
for j = 1:num_phases
T_start = PhaseTimes(j);
T_end = PhaseTimes(j + 1);
if t >= T_start && t < T_end
if j == 1
Kf_L = Kf_LMax(j);
else
prev_end = PhaseTimes(j);
if j < num_phases
if RLC(j-1) < RLC(j) && RLC(j) > RLC(j+1)
Kf_L = Kf_LMax(j);
elseif RLC(j-1) < RLC(j) && RLC(j) <= RLC(j+1)
Kf_end = Kf_LMax(j) – (Kf_LMax(j) – Kf_LMax(j-1)) * exp(TauKf_ON * (T_end – T_start));
Kf_L = Kf_LMax(j) + (Kf_end – Kf_LMax(j-1)) * exp(TauKf_ON * (t – prev_end));
elseif RLC(j-1) > RLC(j) && RLC(j) < RLC(j+1)
Kf_end = Kf_LMax(j) – (Kf_LMax(j) – Kf_LMax(j-1)) * exp(TauKf_ON * (T_end – T_start));
Kf_L = Kf_LMax(j) + (Kf_end – Kf_LMax(j-1)) * exp(TauKf_ON * (t – prev_end));
elseif RLC(j-1) > RLC(j) && RLC(j) >= RLC(j+1)
Kf_end = Kf_LMax(j) – (Kf_LMax(j) – Kf_LMax(j-1)) * exp(TauKf_ON * (T_end – T_start));
Kf_L = Kf_LMax(j) + (Kf_end – Kf_LMax(j-1)) * exp(TauKf_ON * (t – prev_end));
end
end
end
return;
end
end
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function Kb = calculate_kb(t, PhaseTimes, Kb_Max, Kb_Min, ~, RLC)
Kb = Kb_Max; % Default to the minimum value
if all(RLC == RLC(1))
Kb = Kb_Min; % Set Kb to Kb_Min if all RLC values are equal
return;
end
for j = 1:numel(RLC)
T_start = PhaseTimes(j);
T_end = PhaseTimes(j + 1);
if t >= T_start && t < T_end
if j == 1
Kb = Kb_Max;
else
% prev_end = PhaseTimes(j);
if j < numel(RLC)
if RLC(j-1) < RLC(j) && RLC(j) > RLC(j+1)
Kb = Kb_Max ;
elseif RLC(j-1) < RLC(j) && RLC(j) <= RLC(j+1)
Kb = Kb_Max ;
elseif RLC(j-1) > RLC(j) && RLC(j) < RLC(j+1)
Kb = Kb_Max;
elseif RLC(j-1) > RLC(j) && RLC(j) >= RLC(j+1)
Kb = Kb_Max ;
end
else
if RLC(j-1) < RLC(j)
Kb = Kb_Max;
elseif RLC(j-1) > RLC(j)
Kb = Kb_Max;
end
end
end
return;
end
end
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function dydt = ode_LR(t, y, Kf_L, Kb)
Non_Active_Receptor_concentration = y(1);
Active_Receptor_concentration = y(2);
dNonActiveReceptor_dt = -Kf_L(t) * Non_Active_Receptor_concentration + Kb(t) * Active_Receptor_concentration;
dActiveReceptor_dt = Kf_L(t) * Non_Active_Receptor_concentration – Kb(t) * Active_Receptor_concentration;
dydt = [dNonActiveReceptor_dt; dActiveReceptor_dt];
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function result = calculate_phase(t, Active_Receptor_concentration, PhaseTimes, RLC)
T_start = PhaseTimes(:,1);
T_end = PhaseTimes(:,2);
Phase_indices = (t >= T_start & t <= T_end);
Phase_concentration = Active_Receptor_concentration(Phase_indices);
Phase_time = t(Phase_indices);
% Calculate peak and steady-state values
[Rpeak, Tpeak, peak_type] = findpeak(Phase_time, Phase_concentration);
Rss = mean(Active_Receptor_concentration(t >= (T_end – 10) & t <= T_end));
% Calculate the T50 (time to reach half of peak value)
half_peak_value = (Rss + Rpeak) / 2;
[~, idx_50_percent] = min(abs(Phase_concentration – half_peak_value));
T50 = Phase_time(idx_50_percent) – Tpeak;
% Calculate other metrics
ratio_Rpeak_Rss = Rpeak / Rss;
Delta = Rpeak – Rss;
L = RLC;
% Package results in a struct
result.Rpeak = Rpeak;
result.Rss = Rss;
result.Tpeak = Tpeak;
result.T50 = T50;
result.ratio_Rpeak_Rss = ratio_Rpeak_Rss;
result.Delta = Delta;
result.L = L;
result.peak_type = peak_type;
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [Rpeak, Tpeak, peak_type] = findpeak(time, concentration)
% Compute the derivative
dt = diff(time);
dy = diff(concentration);
derivative = dy ./ dt;
% Find zero-crossings of the derivative
zero_crossings = find(diff(sign(derivative)) ~= 0);
% Initialize output variables
Rpeak = NaN;
Tpeak = NaN;
peak_type = ‘None’;
% Check if there are zero crossings
if ~isempty(zero_crossings)
% Identify peaks and troughs by examining the sign changes
max_indices = zero_crossings(derivative(zero_crossings) > 0 & derivative(zero_crossings + 1) < 0);
min_indices = zero_crossings(derivative(zero_crossings) < 0 & derivative(zero_crossings + 1) > 0);
% Check if there are maxima or minima
if ~isempty(max_indices) || ~isempty(min_indices)
if ~isempty(max_indices) && ~isempty(min_indices)
% Find the highest maximum
[Rpeak_max, maxIdx] = max(concentration(max_indices));
% Find the lowest minimum
[Rpeak_min, minIdx] = min(concentration(min_indices));
% Determine whether the highest maximum is greater or the lowest minimum is smaller
if Rpeak_max >= abs(Rpeak_min)
Rpeak = Rpeak_max;
Tpeak = time(max_indices(maxIdx));
peak_type = ‘High’;
else
Rpeak = Rpeak_min;
Tpeak = time(min_indices(minIdx));
peak_type = ‘Low’;
end
% If only maxima exist
elseif ~isempty(max_indices)
[Rpeak, maxIdx] = max(concentration(max_indices));
Tpeak = time(max_indices(maxIdx));
peak_type = ‘High’;
% If only minima exist
elseif ~isempty(min_indices)
[Rpeak, minIdx] = min(concentration(min_indices));
Tpeak = time(min_indices(minIdx));
peak_type = ‘Low’;
end
end
end
end matlab MATLAB Answers — New Questions
Search for URLs within SharePoint Online Tenant
Hello!
I was asked by a team member to see if it’s possible to search SharePoint Online for all links/webpages/text that come from LinkedIn Learning with a specific string “https://learning.linkedin.com/“.
Hello!I was asked by a team member to see if it’s possible to search SharePoint Online for all links/webpages/text that come from LinkedIn Learning with a specific string “https://learning.linkedin.com/”. Read More
Looking for the right formula.
Hi guys,
Looking for the right formula that will let me enter in a text criteria and then subtract a certain number from the value 100, based on what text is matched.
i.e score is currently 100 but if No is entered in various cells, then the value is reduced by 20 each time it is.
How would I go about this?
Hi guys, Looking for the right formula that will let me enter in a text criteria and then subtract a certain number from the value 100, based on what text is matched. i.e score is currently 100 but if No is entered in various cells, then the value is reduced by 20 each time it is. How would I go about this? Read More
ASR Rule “Block use of copied or impersonated system tools” blocks on WSL
Our team was encountering difficulties with using Linux VMs within WSL after this rule was deployed to the fleet. Is this expected behavior, given wsl.exe is a Microsoft system tool? If so, I recommend documentation be updated _somewhere_ to indicate the need for administrators to exempt this interaction somehow. Otherwise, the ASR rule may need to be updated to interact properly with WSL.
Our team was encountering difficulties with using Linux VMs within WSL after this rule was deployed to the fleet. Is this expected behavior, given wsl.exe is a Microsoft system tool? If so, I recommend documentation be updated _somewhere_ to indicate the need for administrators to exempt this interaction somehow. Otherwise, the ASR rule may need to be updated to interact properly with WSL. Read More
Device added to group Randomly
Some devices are added to being added to a group in Intune randomly, Sometimes this group is a disk encryption scoped policy group which causes the devices to double encrypt if already encrypted and cause a bitlocker recovery screen upon restart.
This can also be solved by removing the encryption. However why does it happen.
While “add member to group” activity in audit logs usually shows a user “admin” culprit, Some users are added using a Service Principal which corresponds to “Microsoft Intune” application with no user culprit and no further context. Both Azure Audit an Compliance audit show the same results. Any idea why or how this can be checked further?
Some devices are added to being added to a group in Intune randomly, Sometimes this group is a disk encryption scoped policy group which causes the devices to double encrypt if already encrypted and cause a bitlocker recovery screen upon restart.This can also be solved by removing the encryption. However why does it happen.While “add member to group” activity in audit logs usually shows a user “admin” culprit, Some users are added using a Service Principal which corresponds to “Microsoft Intune” application with no user culprit and no further context. Both Azure Audit an Compliance audit show the same results. Any idea why or how this can be checked further? Read More
Lookup column in SharePoint lists – Hub and Associated sites
I have a hub site and a few associated sites. One of the associated sites has a list of projects. On the hub site I have a list where I would like to include one column that is a look up to the list of projects, living on the associated site. Is that possible? I know it is possible if the lists live in the same site, but what about hub and associated sites?
I have a hub site and a few associated sites. One of the associated sites has a list of projects. On the hub site I have a list where I would like to include one column that is a look up to the list of projects, living on the associated site. Is that possible? I know it is possible if the lists live in the same site, but what about hub and associated sites? Read More
Server 2022 Storage Bus Cache with Storage Spaces can’t identify cache devices
I have a brand new, fresh out of box server with a clean install of Server 2002 Standard. The server has 25 SATA spinning disks presented to the OS in JBOD fashion, and 4 6TB NVME drvies, again presented in JBOD.
Following the guide (Storage bus cache on Storage Spaces | Microsoft Learn) I’ve also ensured that cluster services is enabled.
Running Get-PhysicalDisk shows the drives as they should, and correctly displays the media type of SSD and HDD, as well as showing that they can pool.
Number FriendlyName SerialNumber MediaType CanPool OperationalStatus HealthSta tus —— ———— ———— ——— ——- —————– ——— 9 ATA ST24000NM002H-3K ZYD04JDL HDD True OK Healthy 26 Micron_7450_MTFDKCC6T4TFS 0000_0000_0000_0001_00A0_7523_4454_326C. SSD True OK Healthy 1 ATA ST24000NM002H-3K ZYD04DHG HDD True OK Healthy 0 ATA ST24000NM002H-3K ZYD05GQ3 HDD True OK Healthy 24 ATA ST24000NM002H-3K ZYD052MB HDD True OK Healthy 27 Micron_7450_MTFDKCC6T4TFS 0000_0000_0000_0001_00A0_7523_4454_46BD. SSD True OK Healthy
8 ATA ST24000NM002H-3K ZYD051JQ HDD True OK Healthy
12 ATA ST24000NM002H-3K ZYD01HX2 HDD True OK Healthy
22 ATA ST24000NM002H-3K ZYD050BB HDD True OK Healthy
7 ATA ST24000NM002H-3K ZYD050MB HDD True OK Healthy
29 Intel Raid 1 Volume Volume0 SSD False OK Healthy
15 ATA ST24000NM002H-3K ZYD04KEK HDD True OK Healthy
10 ATA ST24000NM002H-3K ZYD05GLS HDD True OK Healthy
13 ATA ST24000NM002H-3K ZYD041DX HDD True OK Healthy
11 ATA ST24000NM002H-3K ZYD04D3Y HDD True OK Healthy
16 ATA ST24000NM002H-3K ZYD04D3E HDD True OK Healthy
18 ATA ST24000NM002H-3K ZYD05MF2 HDD True OK Healthy
2 ATA ST24000NM002H-3K ZYD06L7S HDD True OK Healthy
4 ATA ST24000NM002H-3K ZYD05J2H HDD True OK Healthy
28 Micron_7450_MTFDKCC6T4TFS 0000_0000_0000_0001_00A0_7523_4454_46AF. SSD True OK Healthy
21 ATA ST24000NM002H-3K ZYD051M5 HDD True OK Healthy
3 ATA ST24000NM002H-3K ZYD05GWH HDD True OK Healthy
17 ATA ST24000NM002H-3K ZYD052L9 HDD True OK Healthy
6 ATA ST24000NM002H-3K ZYD04JTH HDD True OK Healthy
19 ATA ST24000NM002H-3K ZYD059Y7 HDD True OK Healthy
20 ATA ST24000NM002H-3K ZYD051RA HDD True OK Healthy
23 ATA ST24000NM002H-3K ZYD050ZP HDD True OK Healthy
14 ATA ST24000NM002H-3K ZYD05JF9 HDD True OK Healthy
25 Micron_7450_MTFDKCC6T4TFS 0000_0000_0000_0001_00A0_7523_4454_45C1. SSD True OK Healthy
5 ATA ST24000NM002H-3K ZYD05JA7 HDD True OK Healthy
However running Enable-StorageBusCache just yields the “Storage Bus does not have identifiable cache devices”
Update-StorageBusCache : Storage Bus does not have identifiable cache devices
At C:Windowssystem32WindowsPowerShellv1.0ModulesStorageBusCacheStorageBusCache.psm1:1074 char:13
+ Update-StorageBusCache
+ ~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (:) [Update-StorageBusCache], RuntimeException
+ FullyQualifiedErrorId : NotFound,Update-StorageBusCache
There aren’t many resources on the web about this, and there’s nothing in event viewer that indicates any kind of error or anything else beyond generic drive messages.
The only post I could find was one where another person seemed to run into this and ran DISKPART, and CLEAN on each disk. I’ve done this, but no success or change whatsoever.
I’ve also confirmed that despite the error message, it isn’t a false positive and no pool is created. The only pool that exists is the primordial one.
There doesn’t seem to be any way to force selection either, and it’s unclear why Windows is ignoring what’s reported in DiskPart.
Does anyone have any advice here?
I have a brand new, fresh out of box server with a clean install of Server 2002 Standard. The server has 25 SATA spinning disks presented to the OS in JBOD fashion, and 4 6TB NVME drvies, again presented in JBOD. Following the guide (Storage bus cache on Storage Spaces | Microsoft Learn) I’ve also ensured that cluster services is enabled. Running Get-PhysicalDisk shows the drives as they should, and correctly displays the media type of SSD and HDD, as well as showing that they can pool. Number FriendlyName SerialNumber MediaType CanPool OperationalStatus HealthSta tus —— ———— ———— ——— ——- —————– ——— 9 ATA ST24000NM002H-3K ZYD04JDL HDD True OK Healthy 26 Micron_7450_MTFDKCC6T4TFS 0000_0000_0000_0001_00A0_7523_4454_326C. SSD True OK Healthy 1 ATA ST24000NM002H-3K ZYD04DHG HDD True OK Healthy 0 ATA ST24000NM002H-3K ZYD05GQ3 HDD True OK Healthy 24 ATA ST24000NM002H-3K ZYD052MB HDD True OK Healthy 27 Micron_7450_MTFDKCC6T4TFS 0000_0000_0000_0001_00A0_7523_4454_46BD. SSD True OK Healthy
8 ATA ST24000NM002H-3K ZYD051JQ HDD True OK Healthy
12 ATA ST24000NM002H-3K ZYD01HX2 HDD True OK Healthy
22 ATA ST24000NM002H-3K ZYD050BB HDD True OK Healthy
7 ATA ST24000NM002H-3K ZYD050MB HDD True OK Healthy
29 Intel Raid 1 Volume Volume0 SSD False OK Healthy
15 ATA ST24000NM002H-3K ZYD04KEK HDD True OK Healthy
10 ATA ST24000NM002H-3K ZYD05GLS HDD True OK Healthy
13 ATA ST24000NM002H-3K ZYD041DX HDD True OK Healthy
11 ATA ST24000NM002H-3K ZYD04D3Y HDD True OK Healthy
16 ATA ST24000NM002H-3K ZYD04D3E HDD True OK Healthy
18 ATA ST24000NM002H-3K ZYD05MF2 HDD True OK Healthy
2 ATA ST24000NM002H-3K ZYD06L7S HDD True OK Healthy
4 ATA ST24000NM002H-3K ZYD05J2H HDD True OK Healthy
28 Micron_7450_MTFDKCC6T4TFS 0000_0000_0000_0001_00A0_7523_4454_46AF. SSD True OK Healthy
21 ATA ST24000NM002H-3K ZYD051M5 HDD True OK Healthy
3 ATA ST24000NM002H-3K ZYD05GWH HDD True OK Healthy
17 ATA ST24000NM002H-3K ZYD052L9 HDD True OK Healthy
6 ATA ST24000NM002H-3K ZYD04JTH HDD True OK Healthy
19 ATA ST24000NM002H-3K ZYD059Y7 HDD True OK Healthy
20 ATA ST24000NM002H-3K ZYD051RA HDD True OK Healthy
23 ATA ST24000NM002H-3K ZYD050ZP HDD True OK Healthy
14 ATA ST24000NM002H-3K ZYD05JF9 HDD True OK Healthy
25 Micron_7450_MTFDKCC6T4TFS 0000_0000_0000_0001_00A0_7523_4454_45C1. SSD True OK Healthy
5 ATA ST24000NM002H-3K ZYD05JA7 HDD True OK Healthy However running Enable-StorageBusCache just yields the “Storage Bus does not have identifiable cache devices” Update-StorageBusCache : Storage Bus does not have identifiable cache devices
At C:Windowssystem32WindowsPowerShellv1.0ModulesStorageBusCacheStorageBusCache.psm1:1074 char:13
+ Update-StorageBusCache
+ ~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (:) [Update-StorageBusCache], RuntimeException
+ FullyQualifiedErrorId : NotFound,Update-StorageBusCache There aren’t many resources on the web about this, and there’s nothing in event viewer that indicates any kind of error or anything else beyond generic drive messages. The only post I could find was one where another person seemed to run into this and ran DISKPART, and CLEAN on each disk. I’ve done this, but no success or change whatsoever. I’ve also confirmed that despite the error message, it isn’t a false positive and no pool is created. The only pool that exists is the primordial one. There doesn’t seem to be any way to force selection either, and it’s unclear why Windows is ignoring what’s reported in DiskPart. Does anyone have any advice here? Read More
Consolidate folder list to easily see multiple inboxes?
I am running Outlook® for Microsoft 365 MSO (Version 2407 Build 16.0.17830.20166) 32-bit on Windows 10 and have 3 Office 365 mailboxes in different organizations configured.
The problem I’m facing is I cannot see all three inbox folders in my folder list sidebar simultaneously because with all 3 mailboxes expanded, there is not enough vertical screen real estate. Since I cannot see all 3 inboxes at the same time, I have to remember to scroll up / down in the folder list to see if there are unread messages in each inbox, and I often forget to do this and end up seeing new messages on a delay.
Inside each mailbox, there are a number of folders that I don’t really need to see on a regular basis (drafts, sent items, outbox, rss subscriptions, etc.) and these take up a lot of space on the screen. If I could somehow hide those folders, it would give me enough space back to see all of my inbox folders.
Alternately, in a perfect world, there would be some way to ‘pin’ folders to the top of the list, similar to how you can pin folders to the Quick Access section in Windows Explorer.
Is there some way to accomplish one or both of these ideas? Or, is there another solution that would allow me to easily see all of my inbox folders simultaneously?
I am running Outlook® for Microsoft 365 MSO (Version 2407 Build 16.0.17830.20166) 32-bit on Windows 10 and have 3 Office 365 mailboxes in different organizations configured. The problem I’m facing is I cannot see all three inbox folders in my folder list sidebar simultaneously because with all 3 mailboxes expanded, there is not enough vertical screen real estate. Since I cannot see all 3 inboxes at the same time, I have to remember to scroll up / down in the folder list to see if there are unread messages in each inbox, and I often forget to do this and end up seeing new messages on a delay. Inside each mailbox, there are a number of folders that I don’t really need to see on a regular basis (drafts, sent items, outbox, rss subscriptions, etc.) and these take up a lot of space on the screen. If I could somehow hide those folders, it would give me enough space back to see all of my inbox folders. Alternately, in a perfect world, there would be some way to ‘pin’ folders to the top of the list, similar to how you can pin folders to the Quick Access section in Windows Explorer. Is there some way to accomplish one or both of these ideas? Or, is there another solution that would allow me to easily see all of my inbox folders simultaneously? Read More
OneNote Not Working on Android
Issue: unable to load Microsoft OneNote app on Android 14.0 device Samsung Galaxy.
– full error: “Please finish setting up your work or school account to access your notebooks. Tap here to Continue, or ask your administrator for help. Try again or Switch Account.”
-client has a Microsoft 365 E5 license.
-client is able to open OneNote and synchronize notes on iOS and Windows, but not Android.
– i have retired the device from intune >> re-enrolled >> same issue.
– i have wiped the device from intune >> re-enrolled >> same issue.
– the Android device is KNOX managed / COPE
– i have excluded Android from the main app protection policy
– Tried clearing cache and data in app storage settings for OneNote
– After clearing cache, tried enabling airplane mode, opening the app, disabling airplane mode, signing in – same error.
I have looked everywhere online and there are no answers to anything I have found
Issue: unable to load Microsoft OneNote app on Android 14.0 device Samsung Galaxy. – full error: “Please finish setting up your work or school account to access your notebooks. Tap here to Continue, or ask your administrator for help. Try again or Switch Account.” -client has a Microsoft 365 E5 license. -client is able to open OneNote and synchronize notes on iOS and Windows, but not Android. – i have retired the device from intune >> re-enrolled >> same issue.- i have wiped the device from intune >> re-enrolled >> same issue. – the Android device is KNOX managed / COPE- i have excluded Android from the main app protection policy- Tried clearing cache and data in app storage settings for OneNote- After clearing cache, tried enabling airplane mode, opening the app, disabling airplane mode, signing in – same error. I have looked everywhere online and there are no answers to anything I have found Read More
Excluding Communication Sites from Retention Policy
When I create or edit a retention policy and try to exclude a SharePoint classic or communication site, nothing is showing in the list of sites. The sites have been created for over 2 weeks so should be showing up by now.
When I create or edit a retention policy and try to exclude a SharePoint classic or communication site, nothing is showing in the list of sites. The sites have been created for over 2 weeks so should be showing up by now. Read More