Author: PuTI
Trying to start Obstacle Avoidance in NVIDIA Jetson with PX4 Autopilot in Hardware-in-the-Loop (HITL) Simulation with UAV Dynamics Modeled in Simulink
Hello, I ran into two problems when working with QGroundControl (QGC), Pixhawk and Jetson as a mission computer. QGC issues the error "Unable to start mission: Vehicle not changing to Mission flight mode". At the same time, the mission is loaded into autopilot, there is a connection between QGC and Pixhawk.
Obstacle Avoidance: The model in Simulink works, but the video viewer does not receive depth frames from Jetson.
In the Jetson log:
[sudo] password for superadmin: No protocol specified
nvbuf_utils: Couild not get EGL display connection
Opening in blocking MODE
State change is async
**starting the model**
I checked the connection beetween Host PC(192.168.1202) and Jetson(192.168.1.201) via wireshark
QGround also see mission computer
In simulink Obstacle Avoidance Model a have such warnings
What could be the cause of the error changing the flight mode to "Mission"? Could it be caused by issues on the Jetson side or in the Simulink model? How can I fix the "Could not get EGL display connection" error on the Jetson so that the obstacle avoidance model can transmit depth frames?Hello, I ran into two problems when working with QGroundControl (QGC), Pixhawk and Jetson as a mission computer. QGC issues the error "Unable to start mission: Vehicle not changing to Mission flight mode". At the same time, the mission is loaded into autopilot, there is a connection between QGC and Pixhawk.
Obstacle Avoidance: The model in Simulink works, but the video viewer does not receive depth frames from Jetson.
In the Jetson log:
[sudo] password for superadmin: No protocol specified
nvbuf_utils: Couild not get EGL display connection
Opening in blocking MODE
State change is async
**starting the model**
I checked the connection beetween Host PC(192.168.1202) and Jetson(192.168.1.201) via wireshark
QGround also see mission computer
In simulink Obstacle Avoidance Model a have such warnings
What could be the cause of the error changing the flight mode to "Mission"? Could it be caused by issues on the Jetson side or in the Simulink model? How can I fix the "Could not get EGL display connection" error on the Jetson so that the obstacle avoidance model can transmit depth frames? Hello, I ran into two problems when working with QGroundControl (QGC), Pixhawk and Jetson as a mission computer. QGC issues the error "Unable to start mission: Vehicle not changing to Mission flight mode". At the same time, the mission is loaded into autopilot, there is a connection between QGC and Pixhawk.
Obstacle Avoidance: The model in Simulink works, but the video viewer does not receive depth frames from Jetson.
In the Jetson log:
[sudo] password for superadmin: No protocol specified
nvbuf_utils: Couild not get EGL display connection
Opening in blocking MODE
State change is async
**starting the model**
I checked the connection beetween Host PC(192.168.1202) and Jetson(192.168.1.201) via wireshark
QGround also see mission computer
In simulink Obstacle Avoidance Model a have such warnings
What could be the cause of the error changing the flight mode to "Mission"? Could it be caused by issues on the Jetson side or in the Simulink model? How can I fix the "Could not get EGL display connection" error on the Jetson so that the obstacle avoidance model can transmit depth frames? jetson, px4, hitl, qgroundcontrol, cube orange plus MATLAB Answers — New Questions
C2000 CAN Video example calls out eCAN, but blockset shows CAN and we have an RX Issue
We are using two 379D launchpads. The TX section works fine.
The RX, when we connect the two boards, the bus stops as if the RX model is not configured correctly. We checked everything.
Is there a known good example of this we can use to get started ?We are using two 379D launchpads. The TX section works fine.
The RX, when we connect the two boards, the bus stops as if the RX model is not configured correctly. We checked everything.
Is there a known good example of this we can use to get started ? We are using two 379D launchpads. The TX section works fine.
The RX, when we connect the two boards, the bus stops as if the RX model is not configured correctly. We checked everything.
Is there a known good example of this we can use to get started ? c2000 can example issue MATLAB Answers — New Questions
Why am I getting a near 0 current in the flyback converter?
Hi,
I am simulating this flyback converter where Vin is 48 V, Vout should be 380 V, the mutual inductance has L1 = 1e-5 H, L2 = 0.036 H, VF in the diode is 2.1 V and C = 87e-6 F. As you can see in the diagram, I tried to control it first by close-loop but as I couldn’t get the right values, I tried by fixing a constant which is 0.116564 which is the calculated duty cycle for Vin= 48 V. The problem I get is the values of V_out which is -1.428 V and I_out near 0 but negative. I tried moving the current measurement block to the bottom and the top branch, changing the connection with the secondary inductance or the polarity in the voltage measurement. I never get positive voltage and positive current with high values. According to my calculations, I_out should be 2.53 A and V_out, as I said 380 V. Could someone with knowledge in power electronics and simulink help me with this issue? It’s R2022b version.
Thanks.
CarlosHi,
I am simulating this flyback converter where Vin is 48 V, Vout should be 380 V, the mutual inductance has L1 = 1e-5 H, L2 = 0.036 H, VF in the diode is 2.1 V and C = 87e-6 F. As you can see in the diagram, I tried to control it first by close-loop but as I couldn’t get the right values, I tried by fixing a constant which is 0.116564 which is the calculated duty cycle for Vin= 48 V. The problem I get is the values of V_out which is -1.428 V and I_out near 0 but negative. I tried moving the current measurement block to the bottom and the top branch, changing the connection with the secondary inductance or the polarity in the voltage measurement. I never get positive voltage and positive current with high values. According to my calculations, I_out should be 2.53 A and V_out, as I said 380 V. Could someone with knowledge in power electronics and simulink help me with this issue? It’s R2022b version.
Thanks.
Carlos Hi,
I am simulating this flyback converter where Vin is 48 V, Vout should be 380 V, the mutual inductance has L1 = 1e-5 H, L2 = 0.036 H, VF in the diode is 2.1 V and C = 87e-6 F. As you can see in the diagram, I tried to control it first by close-loop but as I couldn’t get the right values, I tried by fixing a constant which is 0.116564 which is the calculated duty cycle for Vin= 48 V. The problem I get is the values of V_out which is -1.428 V and I_out near 0 but negative. I tried moving the current measurement block to the bottom and the top branch, changing the connection with the secondary inductance or the polarity in the voltage measurement. I never get positive voltage and positive current with high values. According to my calculations, I_out should be 2.53 A and V_out, as I said 380 V. Could someone with knowledge in power electronics and simulink help me with this issue? It’s R2022b version.
Thanks.
Carlos flyback converter, power_electronics_control, power_conversion_control, simpowersystems, simulink MATLAB Answers — New Questions
Contact angle in a video of a sessile droplet
Hey all
Okay so i have this script to analyze videos of single droplets drying now i want to calculate the contact angles using the script i made which is also attachted but the method i am using now results in results that are not consistent and jaggery so do any of you have suggestions on how to improve the contact angle determination, i think it could also have something to do with how we binarize and determine the edge of the droplet? normally the script processes videos of around 30s at 100 fps but i couldnt attach that so here is a very short sample video. here is the code that calculates the contact angle
%binary image creation
backgroundDiff = abs(double(grayFrame) – averageBackground);
    % threshold
binaryImage = backgroundDiff > backgroundThreshold;
    % morphological operations to preserve droplet
cleanedImage = imopen(binaryImage, strel(‘disk’, morphOpenDiskSize));
cleanedImage = imclose(cleanedImage, strel(‘disk’, morphCloseDiskSize));
filledImage = imfill(cleanedImage, ‘holes’);
dropletOutsideSurface = filledImage & ~surfaceMask_logical;
dropletAll = filledImage;
% Find droplet boundary
dropletBoundary = bwboundaries(dropletMask);
if ~isempty(dropletBoundary)
outline = dropletBoundary{1};
x_outline = outline(:,2); % Column indices (x-coordinates)
y_outline = outline(:,1); % Row indices (y-coordinates)
            if numel(x_outline) >= 20 % Need sufficient points
% Convert to physical coordinates (meters)
x_phys = x_outline * scale_Image * 1e-6;
y_phys = y_outline * scale_Image * 1e-6;
                % Find contact points (points near the surface)
surface_y_phys = minYSurface * scale_Image * 1e-6;
contact_threshold = equiv_radius * 0.3; % 30% of droplet radius
                % Find all points near the surface
near_surface_indices = find(abs(y_phys – surface_y_phys) < contact_threshold);
                if length(near_surface_indices) >= 4
% Find the leftmost and rightmost contact points
x_contact = x_phys(near_surface_indices);
y_contact = y_phys(near_surface_indices);
                    [x_min, left_idx] = min(x_contact);
[x_max, right_idx] = max(x_contact);
                    left_contact_point = [x_min, y_contact(left_idx)];
right_contact_point = [x_max, y_contact(right_idx)];
                    % ADVANCED: Calculate contact angles using tangent method (from original)
tangent_range = equiv_radius * 0.2; % Distance for tangent calculation
                    % LEFT CONTACT ANGLE
left_contact_idx = near_surface_indices(left_idx);
distances_from_left = sqrt((x_phys – left_contact_point(1)).^2 + …
(y_phys – left_contact_point(2)).^2);
tangent_indices_left = find(distances_from_left <= tangent_range & …
distances_from_left > 0);
                    if length(tangent_indices_left) >= 3
above_contact = tangent_indices_left(y_phys(tangent_indices_left) < left_contact_point(2));
if length(above_contact) >= 3
x_fit = x_phys(above_contact);
y_fit = y_phys(above_contact);
[x_fit, sort_idx] = sort(x_fit);
y_fit = y_fit(sort_idx);
                            if length(unique(x_fit)) >= 2 && length(x_fit) >= 2
try
p_left = polyfit(x_fit, y_fit, 1);
slope_left = p_left(1);
catch
slope_left = NaN;
end
else
slope_left = NaN;
end
                            if ~isnan(slope_left)
angle_rad_left = atan(slope_left);
contact_angle_left = 180 – rad2deg(angle_rad_left);
if contact_angle_left < 0
contact_angle_left = contact_angle_left + 180;
elseif contact_angle_left > 180
contact_angle_left = contact_angle_left – 180;
end
end
end
end
                    % RIGHT CONTACT ANGLE (similar process)
right_contact_idx = near_surface_indices(right_idx);
distances_from_right = sqrt((x_phys – right_contact_point(1)).^2 + …
(y_phys – right_contact_point(2)).^2);
tangent_indices_right = find(distances_from_right <= tangent_range & …
distances_from_right > 0);
                    if length(tangent_indices_right) >= 3
above_contact = tangent_indices_right(y_phys(tangent_indices_right) < right_contact_point(2));
if length(above_contact) >= 3
x_fit = x_phys(above_contact);
y_fit = y_phys(above_contact);
[x_fit, sort_idx] = sort(x_fit);
y_fit = y_fit(sort_idx);
                            if length(unique(x_fit)) >= 2 && length(x_fit) >= 2
try
p_right = polyfit(x_fit, y_fit, 1);
slope_right = p_right(1);
catch
slope_right = NaN;
end
else
slope_right = NaN;
end
                            if ~isnan(slope_right)
angle_rad_right = atan(slope_right);
contact_angle_right = rad2deg(angle_rad_right);
if contact_angle_right < 0
contact_angle_right = contact_angle_right + 180;
elseif contact_angle_right > 180
contact_angle_right = contact_angle_right – 180;
end
end
end
end
                    % Calculate average contact angle
if ~isnan(contact_angle_left) && ~isnan(contact_angle_right)
contact_angle_avg = (contact_angle_left + contact_angle_right) / 2;
elseif ~isnan(contact_angle_left)
contact_angle_avg = contact_angle_left;
elseif ~isnan(contact_angle_right)
contact_angle_avg = contact_angle_right;
end
end
end
endHey all
Okay so i have this script to analyze videos of single droplets drying now i want to calculate the contact angles using the script i made which is also attachted but the method i am using now results in results that are not consistent and jaggery so do any of you have suggestions on how to improve the contact angle determination, i think it could also have something to do with how we binarize and determine the edge of the droplet? normally the script processes videos of around 30s at 100 fps but i couldnt attach that so here is a very short sample video. here is the code that calculates the contact angle
%binary image creation
backgroundDiff = abs(double(grayFrame) – averageBackground);
    % threshold
binaryImage = backgroundDiff > backgroundThreshold;
    % morphological operations to preserve droplet
cleanedImage = imopen(binaryImage, strel(‘disk’, morphOpenDiskSize));
cleanedImage = imclose(cleanedImage, strel(‘disk’, morphCloseDiskSize));
filledImage = imfill(cleanedImage, ‘holes’);
dropletOutsideSurface = filledImage & ~surfaceMask_logical;
dropletAll = filledImage;
% Find droplet boundary
dropletBoundary = bwboundaries(dropletMask);
if ~isempty(dropletBoundary)
outline = dropletBoundary{1};
x_outline = outline(:,2); % Column indices (x-coordinates)
y_outline = outline(:,1); % Row indices (y-coordinates)
            if numel(x_outline) >= 20 % Need sufficient points
% Convert to physical coordinates (meters)
x_phys = x_outline * scale_Image * 1e-6;
y_phys = y_outline * scale_Image * 1e-6;
                % Find contact points (points near the surface)
surface_y_phys = minYSurface * scale_Image * 1e-6;
contact_threshold = equiv_radius * 0.3; % 30% of droplet radius
                % Find all points near the surface
near_surface_indices = find(abs(y_phys – surface_y_phys) < contact_threshold);
                if length(near_surface_indices) >= 4
% Find the leftmost and rightmost contact points
x_contact = x_phys(near_surface_indices);
y_contact = y_phys(near_surface_indices);
                    [x_min, left_idx] = min(x_contact);
[x_max, right_idx] = max(x_contact);
                    left_contact_point = [x_min, y_contact(left_idx)];
right_contact_point = [x_max, y_contact(right_idx)];
                    % ADVANCED: Calculate contact angles using tangent method (from original)
tangent_range = equiv_radius * 0.2; % Distance for tangent calculation
                    % LEFT CONTACT ANGLE
left_contact_idx = near_surface_indices(left_idx);
distances_from_left = sqrt((x_phys – left_contact_point(1)).^2 + …
(y_phys – left_contact_point(2)).^2);
tangent_indices_left = find(distances_from_left <= tangent_range & …
distances_from_left > 0);
                    if length(tangent_indices_left) >= 3
above_contact = tangent_indices_left(y_phys(tangent_indices_left) < left_contact_point(2));
if length(above_contact) >= 3
x_fit = x_phys(above_contact);
y_fit = y_phys(above_contact);
[x_fit, sort_idx] = sort(x_fit);
y_fit = y_fit(sort_idx);
                            if length(unique(x_fit)) >= 2 && length(x_fit) >= 2
try
p_left = polyfit(x_fit, y_fit, 1);
slope_left = p_left(1);
catch
slope_left = NaN;
end
else
slope_left = NaN;
end
                            if ~isnan(slope_left)
angle_rad_left = atan(slope_left);
contact_angle_left = 180 – rad2deg(angle_rad_left);
if contact_angle_left < 0
contact_angle_left = contact_angle_left + 180;
elseif contact_angle_left > 180
contact_angle_left = contact_angle_left – 180;
end
end
end
end
                    % RIGHT CONTACT ANGLE (similar process)
right_contact_idx = near_surface_indices(right_idx);
distances_from_right = sqrt((x_phys – right_contact_point(1)).^2 + …
(y_phys – right_contact_point(2)).^2);
tangent_indices_right = find(distances_from_right <= tangent_range & …
distances_from_right > 0);
                    if length(tangent_indices_right) >= 3
above_contact = tangent_indices_right(y_phys(tangent_indices_right) < right_contact_point(2));
if length(above_contact) >= 3
x_fit = x_phys(above_contact);
y_fit = y_phys(above_contact);
[x_fit, sort_idx] = sort(x_fit);
y_fit = y_fit(sort_idx);
                            if length(unique(x_fit)) >= 2 && length(x_fit) >= 2
try
p_right = polyfit(x_fit, y_fit, 1);
slope_right = p_right(1);
catch
slope_right = NaN;
end
else
slope_right = NaN;
end
                            if ~isnan(slope_right)
angle_rad_right = atan(slope_right);
contact_angle_right = rad2deg(angle_rad_right);
if contact_angle_right < 0
contact_angle_right = contact_angle_right + 180;
elseif contact_angle_right > 180
contact_angle_right = contact_angle_right – 180;
end
end
end
end
                    % Calculate average contact angle
if ~isnan(contact_angle_left) && ~isnan(contact_angle_right)
contact_angle_avg = (contact_angle_left + contact_angle_right) / 2;
elseif ~isnan(contact_angle_left)
contact_angle_avg = contact_angle_left;
elseif ~isnan(contact_angle_right)
contact_angle_avg = contact_angle_right;
end
end
end
end Hey all
Okay so i have this script to analyze videos of single droplets drying now i want to calculate the contact angles using the script i made which is also attachted but the method i am using now results in results that are not consistent and jaggery so do any of you have suggestions on how to improve the contact angle determination, i think it could also have something to do with how we binarize and determine the edge of the droplet? normally the script processes videos of around 30s at 100 fps but i couldnt attach that so here is a very short sample video. here is the code that calculates the contact angle
%binary image creation
backgroundDiff = abs(double(grayFrame) – averageBackground);
    % threshold
binaryImage = backgroundDiff > backgroundThreshold;
    % morphological operations to preserve droplet
cleanedImage = imopen(binaryImage, strel(‘disk’, morphOpenDiskSize));
cleanedImage = imclose(cleanedImage, strel(‘disk’, morphCloseDiskSize));
filledImage = imfill(cleanedImage, ‘holes’);
dropletOutsideSurface = filledImage & ~surfaceMask_logical;
dropletAll = filledImage;
% Find droplet boundary
dropletBoundary = bwboundaries(dropletMask);
if ~isempty(dropletBoundary)
outline = dropletBoundary{1};
x_outline = outline(:,2); % Column indices (x-coordinates)
y_outline = outline(:,1); % Row indices (y-coordinates)
            if numel(x_outline) >= 20 % Need sufficient points
% Convert to physical coordinates (meters)
x_phys = x_outline * scale_Image * 1e-6;
y_phys = y_outline * scale_Image * 1e-6;
                % Find contact points (points near the surface)
surface_y_phys = minYSurface * scale_Image * 1e-6;
contact_threshold = equiv_radius * 0.3; % 30% of droplet radius
                % Find all points near the surface
near_surface_indices = find(abs(y_phys – surface_y_phys) < contact_threshold);
                if length(near_surface_indices) >= 4
% Find the leftmost and rightmost contact points
x_contact = x_phys(near_surface_indices);
y_contact = y_phys(near_surface_indices);
                    [x_min, left_idx] = min(x_contact);
[x_max, right_idx] = max(x_contact);
                    left_contact_point = [x_min, y_contact(left_idx)];
right_contact_point = [x_max, y_contact(right_idx)];
                    % ADVANCED: Calculate contact angles using tangent method (from original)
tangent_range = equiv_radius * 0.2; % Distance for tangent calculation
                    % LEFT CONTACT ANGLE
left_contact_idx = near_surface_indices(left_idx);
distances_from_left = sqrt((x_phys – left_contact_point(1)).^2 + …
(y_phys – left_contact_point(2)).^2);
tangent_indices_left = find(distances_from_left <= tangent_range & …
distances_from_left > 0);
                    if length(tangent_indices_left) >= 3
above_contact = tangent_indices_left(y_phys(tangent_indices_left) < left_contact_point(2));
if length(above_contact) >= 3
x_fit = x_phys(above_contact);
y_fit = y_phys(above_contact);
[x_fit, sort_idx] = sort(x_fit);
y_fit = y_fit(sort_idx);
                            if length(unique(x_fit)) >= 2 && length(x_fit) >= 2
try
p_left = polyfit(x_fit, y_fit, 1);
slope_left = p_left(1);
catch
slope_left = NaN;
end
else
slope_left = NaN;
end
                            if ~isnan(slope_left)
angle_rad_left = atan(slope_left);
contact_angle_left = 180 – rad2deg(angle_rad_left);
if contact_angle_left < 0
contact_angle_left = contact_angle_left + 180;
elseif contact_angle_left > 180
contact_angle_left = contact_angle_left – 180;
end
end
end
end
                    % RIGHT CONTACT ANGLE (similar process)
right_contact_idx = near_surface_indices(right_idx);
distances_from_right = sqrt((x_phys – right_contact_point(1)).^2 + …
(y_phys – right_contact_point(2)).^2);
tangent_indices_right = find(distances_from_right <= tangent_range & …
distances_from_right > 0);
                    if length(tangent_indices_right) >= 3
above_contact = tangent_indices_right(y_phys(tangent_indices_right) < right_contact_point(2));
if length(above_contact) >= 3
x_fit = x_phys(above_contact);
y_fit = y_phys(above_contact);
[x_fit, sort_idx] = sort(x_fit);
y_fit = y_fit(sort_idx);
                            if length(unique(x_fit)) >= 2 && length(x_fit) >= 2
try
p_right = polyfit(x_fit, y_fit, 1);
slope_right = p_right(1);
catch
slope_right = NaN;
end
else
slope_right = NaN;
end
                            if ~isnan(slope_right)
angle_rad_right = atan(slope_right);
contact_angle_right = rad2deg(angle_rad_right);
if contact_angle_right < 0
contact_angle_right = contact_angle_right + 180;
elseif contact_angle_right > 180
contact_angle_right = contact_angle_right – 180;
end
end
end
end
                    % Calculate average contact angle
if ~isnan(contact_angle_left) && ~isnan(contact_angle_right)
contact_angle_avg = (contact_angle_left + contact_angle_right) / 2;
elseif ~isnan(contact_angle_left)
contact_angle_avg = contact_angle_left;
elseif ~isnan(contact_angle_right)
contact_angle_avg = contact_angle_right;
end
end
end
end image processing, image analysis MATLAB Answers — New Questions
Possible bug in coneprog.m function
I am running a trajectory optimisation problem.
The formulation is convexified via slack variables and linearisation and I was testing coneprog as solver.
I noticed some issues with the function that I would like to report and verify if it is my mistake or a bug.
My code is completely deterministic. There is no randomisation and the execution should be 100% reproducible.
Nevertheless, running the same code multiple times with the same input and options leads to different results.
Unlinke fmincon, with coneprog it is impossible to access internal calculation and to understand what is going on, therefore I do not have many insights.
My guess is that a random noise is applied to the initial guess.
In theory this should not be a problem since a convex problem has only one minimum.
In practice, the solver sometimes finds an optimal solution and other times declares the problem unfeasible.
I can solve the same exact problem with an NLP formulation using fmincon, so I know for sure the proble is solvable.
I tried to change the initial conditions and the problem persists.
Sometimes, different minima are found in different calls of the solver.
This is not due to the presence of a flat in the solution space because the fval differ by 1 to 2 orders of magnitude.
Another issue I am having is connected to the iterative procedure I have implemented.
At first I obtain an anlytical initial guess that is numerically propagated.
The constraints are linearised around this reference trajectory and the coneprog is called to solve the problem.
Once the optimal control is obtained, the solution is again propagated and if the error is not below the specified tolerance the process is repeated iteratively.
For some initial conditions the solver works smoothly, but for other it stops at the 5-th or 6-th iteration (declaring the problem unfeasible) when it is really close to the finalise the solution.
Again, it is important to highlight that I am 100% confident that the problem is feasible.
It is important to highlight that some degree of reproducibility is still present.
Even if the solver behaves differently, the number of possible behaviours is limited to just a few outcomes, depending on the initial conditions.
In general, for every problem there are 2 or 3 possible outcomes.
Moreover, some outcomes may occur more frequently than others.
I have spent days trying to find the issue in my code, but now, after testing with fmincon, I am starting to be confident that the problem is in coneprog.
I have also noticed that the solver behaves differently depending on the optimalityTolerance.
This was later confirmed when I found out that the problem has already been reported on this forum here.
An other bug I noticed in some solutions is that both Primal and Dual Feasibility report a value, but if I check manually the constraint satisfaction, the feasibility is off by several order of magnitudes.
I am 100% confident that the check I performed is correct because it was performed with a breakpoint placed right after the call to coneprog as shown below.
I have also stored the inputs of coneprog right before the function was called.
In my opinion, if the problem is coneprog as I think it is, the bug is related to the update step of the current guess.
Have you experienced similar problem with coneprog, or are you aware of some limitations it may have?
Did you already encountered such problem and understood where it is coming from?
The main motivations why I think coneprog is the problem are the different outputs produced from a deterministic code, and the fact that, when the problem converges, the solution is correct.
As a final comment, I think it would be really useful to have the freedom of specifying an initial guess.
If I know already a solution that is both an interior point and very close to the optimal one, this would cut down considerably the computational time.
—————————————————————————————————————————-
Below you can find an example of the solver converging to an unfeasible point after some iterations.
The target value of poc is 1e-10.
The formulation of the optimsiation problem is based on a direct transcription to discretise a continuous trajectory into discrete nodes.
The solution vector x is built as:
x = [ux1 uy1 uz1 u1 … uxN uyN uzN uN b1 b2]
where:
[uxi uyi uzi] is the control vector at the i-th node.
ui is the magnitude of the control vector at the i-th node.
[b1 b2] are some end conditions that must satisfy a linear constraint
The only cone constraints present are the one that impose:
sqrt(uxi^2 + uyi^2 + uzi^2) <= 1
sqrt(uxi^2 + uyi^2 + uzi^2) <= ui
The linear objective function minimises the control effort defined as:
In the example below, the trajectory is discretised into 852 nodes.
This is clear from the initial Fval of every iteration that corresponds to the number of nodes, as the initial guess is probably all ones.
The last call of coneprog declares the problem unfeasible and it is the only iteration where Fval increases after the initial guess.
The problem with the constraint satisfication can be understood from the values of the Infeasibilities.
To help the problem converges I defined a lower bound to uxi, uyi, and uzi of -1, and a lower bound to ui of 0.
Similarly, I defined an upper bound to uxi, uyi, uzi, and ui of 1.
An Fval of 1.118894e+03 in the last line of the example below, clearly goes against the upper bound constraint, as the maximum value of Fval allowed by the upper bound is 852.
Instead the sovler is analysing a solution with Fval of approximately 1119, but it thinks that the constraints are satisfied, which is impossible.
Maybe my interpretation of Primal and Dual Feasibility is wrong, but my intuition is suggesting me that coneprog may have some problems.
Iter           Fval  Primal Infeas    Dual Infeas    Duality Gap    Time
0   8.520000e+02   3.351509e-01   2.500000e-01   8.338790e-02    0.43
1   2.903535e+02   5.653968e-02   4.217479e-02   1.406747e-02    0.46
2   5.760140e+01   1.155766e-02   8.621236e-03   2.875627e-03    0.50
3   1.826360e+01   3.567321e-03   2.660981e-03   8.875744e-04    0.54
4   1.587390e+01   2.115580e-03   1.578080e-03   5.263711e-04    0.58
5   1.496351e+01   1.979895e-03   1.476868e-03   4.926117e-04    0.61
6   1.477297e+01   1.930240e-03   1.439829e-03   4.802573e-04    0.65
7   1.407791e+01   1.740965e-03   1.298643e-03   4.331644e-04    0.69
8   1.195150e+01   1.139652e-03   8.501032e-04   2.835533e-04    0.73
9   1.118074e+01   9.249616e-04   6.899590e-04   2.301369e-04    0.76
10   9.263514e+00   3.932808e-04   2.933610e-04   9.785102e-05    0.80
11   8.435984e+00   1.662211e-04   1.239898e-04   4.135699e-05    0.84
12   8.137082e+00   8.259246e-05   6.160841e-05   2.054958e-05    0.89
13   7.834045e+00   4.811473e-06   3.589036e-06   1.197128e-06    0.93
14   7.817072e+00   4.211285e-07   3.141435e-07   1.047797e-07    0.97
15   7.815469e+00   1.297491e-08   9.741467e-09   3.228250e-09    1.02
16   7.815429e+00   2.773558e-09   3.724366e-09   6.900807e-10    1.05
Optimal solution found.
poc =
4.7669e-05
Iter           Fval  Primal Infeas    Dual Infeas    Duality Gap    Time
0   8.520000e+02   4.148309e-01   2.500000e-01   8.339003e-02    0.24
1   2.936365e+02   7.220152e-02   4.351262e-02   1.451408e-02    0.28
2   3.227398e+01   9.133979e-03   5.504640e-03   1.836128e-03    0.32
3   2.999204e+01   5.626122e-03   3.390612e-03   1.130973e-03    0.36
4   2.891739e+01   5.422358e-03   3.267812e-03   1.090012e-03    0.40
5   2.734221e+01   4.962369e-03   2.990597e-03   9.975440e-04    0.44
6   2.355320e+01   3.776002e-03   2.275627e-03   7.590585e-04    0.48
7   1.765904e+01   1.858229e-03   1.119871e-03   3.735444e-04    0.53
8   1.493406e+01   9.914144e-04   5.974810e-04   1.992958e-04    0.57
9   1.321215e+01   4.284890e-04   2.582311e-04   8.613560e-05    0.61
10   1.247209e+01   1.862607e-04   1.122510e-04   3.744245e-05    0.65
11   1.203916e+01   4.726695e-05   2.848568e-05   9.501685e-06    0.68
12   1.190390e+01   4.898257e-06   2.951962e-06   9.846561e-07    0.73
13   1.188906e+01   1.900382e-07   1.145391e-07   3.820181e-08    0.77
14   1.188847e+01   9.042867e-09   5.942560e-09   1.817813e-09    0.81
Optimal solution found.
poc =
1.7472e-08
Iter           Fval  Primal Infeas    Dual Infeas    Duality Gap    Time
0   8.520000e+02   3.740554e-01   2.500000e-01   8.338857e-02    0.23
1   2.549188e+02   4.172979e-02   2.789011e-02   9.302867e-03    0.26
2   9.392526e+01   1.561744e-02   1.043792e-02   3.481612e-03    0.30
3   2.667086e+01   4.410425e-03   2.947708e-03   9.832206e-04    0.34
4   2.407913e+01   2.549053e-03   1.703660e-03   5.682632e-04    0.39
5   2.355160e+01   2.499060e-03   1.670247e-03   5.571180e-04    0.43
6   2.324912e+01   2.449195e-03   1.636919e-03   5.460015e-04    0.47
7   2.249923e+01   2.308274e-03   1.542735e-03   5.145858e-04    0.50
8   2.040632e+01   1.851989e-03   1.237777e-03   4.128657e-04    0.54
9   1.970151e+01   1.692941e-03   1.131477e-03   3.774090e-04    0.59
10   1.744126e+01   1.126199e-03   7.526951e-04   2.510647e-04    0.62
11   1.620420e+01   8.023922e-04   5.362790e-04   1.788781e-04    0.66
12   1.474391e+01   3.945190e-04   2.636768e-04   8.795053e-05    0.70
13   1.427557e+01   2.644519e-04   1.767465e-04   5.895455e-05    0.73
14   1.370019e+01   1.011430e-04   6.759892e-05   2.254791e-05    0.77
15   1.348178e+01   3.984925e-05   2.663325e-05   8.883635e-06    0.81
16   1.336507e+01   7.537767e-06   5.037870e-06   1.680402e-06    0.85
17   1.334002e+01   6.477134e-07   4.329037e-07   1.443954e-07    0.88
18   1.333772e+01   1.179424e-08   7.999240e-09   2.629302e-09    0.93
19   1.333768e+01   1.381986e-10   8.290199e-09   3.080877e-11    0.99
Optimal solution found.
poc =
5.3035e-10
Iter           Fval  Primal Infeas    Dual Infeas    Duality Gap    Time
0   8.520000e+02   3.472650e-01   2.500000e-01   8.338749e-02    0.23
1   2.309201e+02   2.520373e-02   1.814445e-02   6.052081e-03    0.27
2   9.405942e+01   1.047608e-02   7.541850e-03   2.515584e-03    0.31
3   2.721726e+01   3.116075e-03   2.243298e-03   7.482520e-04    0.35
4   2.416710e+01   1.805118e-03   1.299525e-03   4.334564e-04    0.40
5   2.375956e+01   1.781739e-03   1.282694e-03   4.278426e-04    0.43
6   2.358202e+01   1.764206e-03   1.270072e-03   4.236324e-04    0.47
7   2.304355e+01   1.703461e-03   1.226341e-03   4.090461e-04    0.52
8   2.181656e+01   1.527846e-03   1.099914e-03   3.668761e-04    0.56
9   2.124914e+01   1.448597e-03   1.042861e-03   3.478463e-04    0.60
10   1.948615e+01   1.170737e-03   8.428266e-04   2.811248e-04    0.64
11   1.783054e+01   8.717316e-04   6.275695e-04   2.093258e-04    0.68
12   1.708765e+01   7.336925e-04   5.281936e-04   1.761789e-04    0.72
13   1.550449e+01   3.894897e-04   2.803981e-04   9.352676e-05    0.76
14   1.514484e+01   3.155406e-04   2.271613e-04   7.576962e-05    0.80
15   1.441642e+01   1.496860e-04   1.077607e-04   3.594357e-05    0.85
16   1.411738e+01   7.908921e-05   5.693722e-05   1.899141e-05    0.90
17   1.383348e+01   1.063875e-05   7.658959e-06   2.554645e-06    0.95
18   1.380209e+01   2.769706e-06   1.993947e-06   6.650794e-07    0.99
19   1.379178e+01   1.701668e-07   1.225354e-07   4.086155e-08    1.03
20   1.379114e+01   8.779631e-09   6.671732e-09   2.108221e-09    1.07
Optimal solution found.
poc =
1.8216e-10
Iter           Fval  Primal Infeas    Dual Infeas    Duality Gap    Time
0   8.520000e+02   3.384156e-01   2.500000e-01   8.338731e-02    0.24
1   2.283493e+02   2.314639e-02   1.709909e-02   5.703387e-03    0.29
2   9.475565e+01   9.793019e-03   7.234463e-03   2.413050e-03    0.33
3   2.755188e+01   2.925713e-03   2.161331e-03   7.209104e-04    0.37
4   2.438422e+01   1.697792e-03   1.254221e-03   4.183445e-04    0.41
5   2.398865e+01   1.677057e-03   1.238903e-03   4.132353e-04    0.45
6   2.383017e+01   1.662889e-03   1.228437e-03   4.097444e-04    0.49
7   2.333142e+01   1.612151e-03   1.190955e-03   3.972422e-04    0.53
8   2.217540e+01   1.460099e-03   1.078629e-03   3.597758e-04    0.56
9   2.173362e+01   1.404707e-03   1.037709e-03   3.461270e-04    0.61
10   2.035602e+01   1.210646e-03   8.943487e-04   2.983093e-04    0.65
11   1.865148e+01   9.312689e-04   6.879625e-04   2.294694e-04    0.68
12   1.727485e+01   7.016610e-04   5.183427e-04   1.728928e-04    0.72
13   1.622825e+01   5.067634e-04   3.743647e-04   1.248691e-04    0.76
14   1.539423e+01   3.289696e-04   2.430219e-04   8.105977e-05    0.80
15   1.498430e+01   2.416941e-04   1.785483e-04   5.955466e-05    0.83
16   1.446995e+01   1.222391e-04   9.030248e-05   3.012032e-05    0.87
17   1.418069e+01   5.599477e-05   4.136539e-05   1.379739e-05    0.91
18   1.397083e+01   5.693174e-06   4.205758e-06   1.402827e-06    0.95
19   1.394958e+01   5.174181e-07   3.822538e-07   1.274944e-07    0.99
20   1.394766e+01   4.663196e-08   3.460641e-08   1.149035e-08    1.03
21   1.394748e+01   2.032849e-09   2.212183e-09   5.009042e-10    1.07
Optimal solution found.
poc =
1.0958e-10
Iter           Fval  Primal Infeas    Dual Infeas    Duality Gap    Time
0   8.520000e+02   3.341137e-01   2.500000e-01   8.338698e-02    0.24
1   9.059917e+02   1.639868e-01   1.227028e-01   4.092728e-02    0.28
2   1.017406e+03   7.906474e-02   5.916006e-02   1.973271e-02    0.31
3   1.124331e+03   4.121461e-03   3.083876e-03   1.028620e-03    0.35
4   1.118894e+03   6.591392e-06   4.931998e-06   1.645058e-06    0.39
5   1.118894e+03   9.882157e-09   7.394312e-09   2.466356e-09    0.43
6   1.118894e+03   1.481584e-11   1.109217e-11   3.698267e-12    0.46
Problem is infeasible.
This was tested on R2025a and R2023a.I am running a trajectory optimisation problem.
The formulation is convexified via slack variables and linearisation and I was testing coneprog as solver.
I noticed some issues with the function that I would like to report and verify if it is my mistake or a bug.
My code is completely deterministic. There is no randomisation and the execution should be 100% reproducible.
Nevertheless, running the same code multiple times with the same input and options leads to different results.
Unlinke fmincon, with coneprog it is impossible to access internal calculation and to understand what is going on, therefore I do not have many insights.
My guess is that a random noise is applied to the initial guess.
In theory this should not be a problem since a convex problem has only one minimum.
In practice, the solver sometimes finds an optimal solution and other times declares the problem unfeasible.
I can solve the same exact problem with an NLP formulation using fmincon, so I know for sure the proble is solvable.
I tried to change the initial conditions and the problem persists.
Sometimes, different minima are found in different calls of the solver.
This is not due to the presence of a flat in the solution space because the fval differ by 1 to 2 orders of magnitude.
Another issue I am having is connected to the iterative procedure I have implemented.
At first I obtain an anlytical initial guess that is numerically propagated.
The constraints are linearised around this reference trajectory and the coneprog is called to solve the problem.
Once the optimal control is obtained, the solution is again propagated and if the error is not below the specified tolerance the process is repeated iteratively.
For some initial conditions the solver works smoothly, but for other it stops at the 5-th or 6-th iteration (declaring the problem unfeasible) when it is really close to the finalise the solution.
Again, it is important to highlight that I am 100% confident that the problem is feasible.
It is important to highlight that some degree of reproducibility is still present.
Even if the solver behaves differently, the number of possible behaviours is limited to just a few outcomes, depending on the initial conditions.
In general, for every problem there are 2 or 3 possible outcomes.
Moreover, some outcomes may occur more frequently than others.
I have spent days trying to find the issue in my code, but now, after testing with fmincon, I am starting to be confident that the problem is in coneprog.
I have also noticed that the solver behaves differently depending on the optimalityTolerance.
This was later confirmed when I found out that the problem has already been reported on this forum here.
An other bug I noticed in some solutions is that both Primal and Dual Feasibility report a value, but if I check manually the constraint satisfaction, the feasibility is off by several order of magnitudes.
I am 100% confident that the check I performed is correct because it was performed with a breakpoint placed right after the call to coneprog as shown below.
I have also stored the inputs of coneprog right before the function was called.
In my opinion, if the problem is coneprog as I think it is, the bug is related to the update step of the current guess.
Have you experienced similar problem with coneprog, or are you aware of some limitations it may have?
Did you already encountered such problem and understood where it is coming from?
The main motivations why I think coneprog is the problem are the different outputs produced from a deterministic code, and the fact that, when the problem converges, the solution is correct.
As a final comment, I think it would be really useful to have the freedom of specifying an initial guess.
If I know already a solution that is both an interior point and very close to the optimal one, this would cut down considerably the computational time.
—————————————————————————————————————————-
Below you can find an example of the solver converging to an unfeasible point after some iterations.
The target value of poc is 1e-10.
The formulation of the optimsiation problem is based on a direct transcription to discretise a continuous trajectory into discrete nodes.
The solution vector x is built as:
x = [ux1 uy1 uz1 u1 … uxN uyN uzN uN b1 b2]
where:
[uxi uyi uzi] is the control vector at the i-th node.
ui is the magnitude of the control vector at the i-th node.
[b1 b2] are some end conditions that must satisfy a linear constraint
The only cone constraints present are the one that impose:
sqrt(uxi^2 + uyi^2 + uzi^2) <= 1
sqrt(uxi^2 + uyi^2 + uzi^2) <= ui
The linear objective function minimises the control effort defined as:
In the example below, the trajectory is discretised into 852 nodes.
This is clear from the initial Fval of every iteration that corresponds to the number of nodes, as the initial guess is probably all ones.
The last call of coneprog declares the problem unfeasible and it is the only iteration where Fval increases after the initial guess.
The problem with the constraint satisfication can be understood from the values of the Infeasibilities.
To help the problem converges I defined a lower bound to uxi, uyi, and uzi of -1, and a lower bound to ui of 0.
Similarly, I defined an upper bound to uxi, uyi, uzi, and ui of 1.
An Fval of 1.118894e+03 in the last line of the example below, clearly goes against the upper bound constraint, as the maximum value of Fval allowed by the upper bound is 852.
Instead the sovler is analysing a solution with Fval of approximately 1119, but it thinks that the constraints are satisfied, which is impossible.
Maybe my interpretation of Primal and Dual Feasibility is wrong, but my intuition is suggesting me that coneprog may have some problems.
Iter           Fval  Primal Infeas    Dual Infeas    Duality Gap    Time
0   8.520000e+02   3.351509e-01   2.500000e-01   8.338790e-02    0.43
1   2.903535e+02   5.653968e-02   4.217479e-02   1.406747e-02    0.46
2   5.760140e+01   1.155766e-02   8.621236e-03   2.875627e-03    0.50
3   1.826360e+01   3.567321e-03   2.660981e-03   8.875744e-04    0.54
4   1.587390e+01   2.115580e-03   1.578080e-03   5.263711e-04    0.58
5   1.496351e+01   1.979895e-03   1.476868e-03   4.926117e-04    0.61
6   1.477297e+01   1.930240e-03   1.439829e-03   4.802573e-04    0.65
7   1.407791e+01   1.740965e-03   1.298643e-03   4.331644e-04    0.69
8   1.195150e+01   1.139652e-03   8.501032e-04   2.835533e-04    0.73
9   1.118074e+01   9.249616e-04   6.899590e-04   2.301369e-04    0.76
10   9.263514e+00   3.932808e-04   2.933610e-04   9.785102e-05    0.80
11   8.435984e+00   1.662211e-04   1.239898e-04   4.135699e-05    0.84
12   8.137082e+00   8.259246e-05   6.160841e-05   2.054958e-05    0.89
13   7.834045e+00   4.811473e-06   3.589036e-06   1.197128e-06    0.93
14   7.817072e+00   4.211285e-07   3.141435e-07   1.047797e-07    0.97
15   7.815469e+00   1.297491e-08   9.741467e-09   3.228250e-09    1.02
16   7.815429e+00   2.773558e-09   3.724366e-09   6.900807e-10    1.05
Optimal solution found.
poc =
4.7669e-05
Iter           Fval  Primal Infeas    Dual Infeas    Duality Gap    Time
0   8.520000e+02   4.148309e-01   2.500000e-01   8.339003e-02    0.24
1   2.936365e+02   7.220152e-02   4.351262e-02   1.451408e-02    0.28
2   3.227398e+01   9.133979e-03   5.504640e-03   1.836128e-03    0.32
3   2.999204e+01   5.626122e-03   3.390612e-03   1.130973e-03    0.36
4   2.891739e+01   5.422358e-03   3.267812e-03   1.090012e-03    0.40
5   2.734221e+01   4.962369e-03   2.990597e-03   9.975440e-04    0.44
6   2.355320e+01   3.776002e-03   2.275627e-03   7.590585e-04    0.48
7   1.765904e+01   1.858229e-03   1.119871e-03   3.735444e-04    0.53
8   1.493406e+01   9.914144e-04   5.974810e-04   1.992958e-04    0.57
9   1.321215e+01   4.284890e-04   2.582311e-04   8.613560e-05    0.61
10   1.247209e+01   1.862607e-04   1.122510e-04   3.744245e-05    0.65
11   1.203916e+01   4.726695e-05   2.848568e-05   9.501685e-06    0.68
12   1.190390e+01   4.898257e-06   2.951962e-06   9.846561e-07    0.73
13   1.188906e+01   1.900382e-07   1.145391e-07   3.820181e-08    0.77
14   1.188847e+01   9.042867e-09   5.942560e-09   1.817813e-09    0.81
Optimal solution found.
poc =
1.7472e-08
Iter           Fval  Primal Infeas    Dual Infeas    Duality Gap    Time
0   8.520000e+02   3.740554e-01   2.500000e-01   8.338857e-02    0.23
1   2.549188e+02   4.172979e-02   2.789011e-02   9.302867e-03    0.26
2   9.392526e+01   1.561744e-02   1.043792e-02   3.481612e-03    0.30
3   2.667086e+01   4.410425e-03   2.947708e-03   9.832206e-04    0.34
4   2.407913e+01   2.549053e-03   1.703660e-03   5.682632e-04    0.39
5   2.355160e+01   2.499060e-03   1.670247e-03   5.571180e-04    0.43
6   2.324912e+01   2.449195e-03   1.636919e-03   5.460015e-04    0.47
7   2.249923e+01   2.308274e-03   1.542735e-03   5.145858e-04    0.50
8   2.040632e+01   1.851989e-03   1.237777e-03   4.128657e-04    0.54
9   1.970151e+01   1.692941e-03   1.131477e-03   3.774090e-04    0.59
10   1.744126e+01   1.126199e-03   7.526951e-04   2.510647e-04    0.62
11   1.620420e+01   8.023922e-04   5.362790e-04   1.788781e-04    0.66
12   1.474391e+01   3.945190e-04   2.636768e-04   8.795053e-05    0.70
13   1.427557e+01   2.644519e-04   1.767465e-04   5.895455e-05    0.73
14   1.370019e+01   1.011430e-04   6.759892e-05   2.254791e-05    0.77
15   1.348178e+01   3.984925e-05   2.663325e-05   8.883635e-06    0.81
16   1.336507e+01   7.537767e-06   5.037870e-06   1.680402e-06    0.85
17   1.334002e+01   6.477134e-07   4.329037e-07   1.443954e-07    0.88
18   1.333772e+01   1.179424e-08   7.999240e-09   2.629302e-09    0.93
19   1.333768e+01   1.381986e-10   8.290199e-09   3.080877e-11    0.99
Optimal solution found.
poc =
5.3035e-10
Iter           Fval  Primal Infeas    Dual Infeas    Duality Gap    Time
0   8.520000e+02   3.472650e-01   2.500000e-01   8.338749e-02    0.23
1   2.309201e+02   2.520373e-02   1.814445e-02   6.052081e-03    0.27
2   9.405942e+01   1.047608e-02   7.541850e-03   2.515584e-03    0.31
3   2.721726e+01   3.116075e-03   2.243298e-03   7.482520e-04    0.35
4   2.416710e+01   1.805118e-03   1.299525e-03   4.334564e-04    0.40
5   2.375956e+01   1.781739e-03   1.282694e-03   4.278426e-04    0.43
6   2.358202e+01   1.764206e-03   1.270072e-03   4.236324e-04    0.47
7   2.304355e+01   1.703461e-03   1.226341e-03   4.090461e-04    0.52
8   2.181656e+01   1.527846e-03   1.099914e-03   3.668761e-04    0.56
9   2.124914e+01   1.448597e-03   1.042861e-03   3.478463e-04    0.60
10   1.948615e+01   1.170737e-03   8.428266e-04   2.811248e-04    0.64
11   1.783054e+01   8.717316e-04   6.275695e-04   2.093258e-04    0.68
12   1.708765e+01   7.336925e-04   5.281936e-04   1.761789e-04    0.72
13   1.550449e+01   3.894897e-04   2.803981e-04   9.352676e-05    0.76
14   1.514484e+01   3.155406e-04   2.271613e-04   7.576962e-05    0.80
15   1.441642e+01   1.496860e-04   1.077607e-04   3.594357e-05    0.85
16   1.411738e+01   7.908921e-05   5.693722e-05   1.899141e-05    0.90
17   1.383348e+01   1.063875e-05   7.658959e-06   2.554645e-06    0.95
18   1.380209e+01   2.769706e-06   1.993947e-06   6.650794e-07    0.99
19   1.379178e+01   1.701668e-07   1.225354e-07   4.086155e-08    1.03
20   1.379114e+01   8.779631e-09   6.671732e-09   2.108221e-09    1.07
Optimal solution found.
poc =
1.8216e-10
Iter           Fval  Primal Infeas    Dual Infeas    Duality Gap    Time
0   8.520000e+02   3.384156e-01   2.500000e-01   8.338731e-02    0.24
1   2.283493e+02   2.314639e-02   1.709909e-02   5.703387e-03    0.29
2   9.475565e+01   9.793019e-03   7.234463e-03   2.413050e-03    0.33
3   2.755188e+01   2.925713e-03   2.161331e-03   7.209104e-04    0.37
4   2.438422e+01   1.697792e-03   1.254221e-03   4.183445e-04    0.41
5   2.398865e+01   1.677057e-03   1.238903e-03   4.132353e-04    0.45
6   2.383017e+01   1.662889e-03   1.228437e-03   4.097444e-04    0.49
7   2.333142e+01   1.612151e-03   1.190955e-03   3.972422e-04    0.53
8   2.217540e+01   1.460099e-03   1.078629e-03   3.597758e-04    0.56
9   2.173362e+01   1.404707e-03   1.037709e-03   3.461270e-04    0.61
10   2.035602e+01   1.210646e-03   8.943487e-04   2.983093e-04    0.65
11   1.865148e+01   9.312689e-04   6.879625e-04   2.294694e-04    0.68
12   1.727485e+01   7.016610e-04   5.183427e-04   1.728928e-04    0.72
13   1.622825e+01   5.067634e-04   3.743647e-04   1.248691e-04    0.76
14   1.539423e+01   3.289696e-04   2.430219e-04   8.105977e-05    0.80
15   1.498430e+01   2.416941e-04   1.785483e-04   5.955466e-05    0.83
16   1.446995e+01   1.222391e-04   9.030248e-05   3.012032e-05    0.87
17   1.418069e+01   5.599477e-05   4.136539e-05   1.379739e-05    0.91
18   1.397083e+01   5.693174e-06   4.205758e-06   1.402827e-06    0.95
19   1.394958e+01   5.174181e-07   3.822538e-07   1.274944e-07    0.99
20   1.394766e+01   4.663196e-08   3.460641e-08   1.149035e-08    1.03
21   1.394748e+01   2.032849e-09   2.212183e-09   5.009042e-10    1.07
Optimal solution found.
poc =
1.0958e-10
Iter           Fval  Primal Infeas    Dual Infeas    Duality Gap    Time
0   8.520000e+02   3.341137e-01   2.500000e-01   8.338698e-02    0.24
1   9.059917e+02   1.639868e-01   1.227028e-01   4.092728e-02    0.28
2   1.017406e+03   7.906474e-02   5.916006e-02   1.973271e-02    0.31
3   1.124331e+03   4.121461e-03   3.083876e-03   1.028620e-03    0.35
4   1.118894e+03   6.591392e-06   4.931998e-06   1.645058e-06    0.39
5   1.118894e+03   9.882157e-09   7.394312e-09   2.466356e-09    0.43
6   1.118894e+03   1.481584e-11   1.109217e-11   3.698267e-12    0.46
Problem is infeasible.
This was tested on R2025a and R2023a. I am running a trajectory optimisation problem.
The formulation is convexified via slack variables and linearisation and I was testing coneprog as solver.
I noticed some issues with the function that I would like to report and verify if it is my mistake or a bug.
My code is completely deterministic. There is no randomisation and the execution should be 100% reproducible.
Nevertheless, running the same code multiple times with the same input and options leads to different results.
Unlinke fmincon, with coneprog it is impossible to access internal calculation and to understand what is going on, therefore I do not have many insights.
My guess is that a random noise is applied to the initial guess.
In theory this should not be a problem since a convex problem has only one minimum.
In practice, the solver sometimes finds an optimal solution and other times declares the problem unfeasible.
I can solve the same exact problem with an NLP formulation using fmincon, so I know for sure the proble is solvable.
I tried to change the initial conditions and the problem persists.
Sometimes, different minima are found in different calls of the solver.
This is not due to the presence of a flat in the solution space because the fval differ by 1 to 2 orders of magnitude.
Another issue I am having is connected to the iterative procedure I have implemented.
At first I obtain an anlytical initial guess that is numerically propagated.
The constraints are linearised around this reference trajectory and the coneprog is called to solve the problem.
Once the optimal control is obtained, the solution is again propagated and if the error is not below the specified tolerance the process is repeated iteratively.
For some initial conditions the solver works smoothly, but for other it stops at the 5-th or 6-th iteration (declaring the problem unfeasible) when it is really close to the finalise the solution.
Again, it is important to highlight that I am 100% confident that the problem is feasible.
It is important to highlight that some degree of reproducibility is still present.
Even if the solver behaves differently, the number of possible behaviours is limited to just a few outcomes, depending on the initial conditions.
In general, for every problem there are 2 or 3 possible outcomes.
Moreover, some outcomes may occur more frequently than others.
I have spent days trying to find the issue in my code, but now, after testing with fmincon, I am starting to be confident that the problem is in coneprog.
I have also noticed that the solver behaves differently depending on the optimalityTolerance.
This was later confirmed when I found out that the problem has already been reported on this forum here.
An other bug I noticed in some solutions is that both Primal and Dual Feasibility report a value, but if I check manually the constraint satisfaction, the feasibility is off by several order of magnitudes.
I am 100% confident that the check I performed is correct because it was performed with a breakpoint placed right after the call to coneprog as shown below.
I have also stored the inputs of coneprog right before the function was called.
In my opinion, if the problem is coneprog as I think it is, the bug is related to the update step of the current guess.
Have you experienced similar problem with coneprog, or are you aware of some limitations it may have?
Did you already encountered such problem and understood where it is coming from?
The main motivations why I think coneprog is the problem are the different outputs produced from a deterministic code, and the fact that, when the problem converges, the solution is correct.
As a final comment, I think it would be really useful to have the freedom of specifying an initial guess.
If I know already a solution that is both an interior point and very close to the optimal one, this would cut down considerably the computational time.
—————————————————————————————————————————-
Below you can find an example of the solver converging to an unfeasible point after some iterations.
The target value of poc is 1e-10.
The formulation of the optimsiation problem is based on a direct transcription to discretise a continuous trajectory into discrete nodes.
The solution vector x is built as:
x = [ux1 uy1 uz1 u1 … uxN uyN uzN uN b1 b2]
where:
[uxi uyi uzi] is the control vector at the i-th node.
ui is the magnitude of the control vector at the i-th node.
[b1 b2] are some end conditions that must satisfy a linear constraint
The only cone constraints present are the one that impose:
sqrt(uxi^2 + uyi^2 + uzi^2) <= 1
sqrt(uxi^2 + uyi^2 + uzi^2) <= ui
The linear objective function minimises the control effort defined as:
In the example below, the trajectory is discretised into 852 nodes.
This is clear from the initial Fval of every iteration that corresponds to the number of nodes, as the initial guess is probably all ones.
The last call of coneprog declares the problem unfeasible and it is the only iteration where Fval increases after the initial guess.
The problem with the constraint satisfication can be understood from the values of the Infeasibilities.
To help the problem converges I defined a lower bound to uxi, uyi, and uzi of -1, and a lower bound to ui of 0.
Similarly, I defined an upper bound to uxi, uyi, uzi, and ui of 1.
An Fval of 1.118894e+03 in the last line of the example below, clearly goes against the upper bound constraint, as the maximum value of Fval allowed by the upper bound is 852.
Instead the sovler is analysing a solution with Fval of approximately 1119, but it thinks that the constraints are satisfied, which is impossible.
Maybe my interpretation of Primal and Dual Feasibility is wrong, but my intuition is suggesting me that coneprog may have some problems.
Iter           Fval  Primal Infeas    Dual Infeas    Duality Gap    Time
0   8.520000e+02   3.351509e-01   2.500000e-01   8.338790e-02    0.43
1   2.903535e+02   5.653968e-02   4.217479e-02   1.406747e-02    0.46
2   5.760140e+01   1.155766e-02   8.621236e-03   2.875627e-03    0.50
3   1.826360e+01   3.567321e-03   2.660981e-03   8.875744e-04    0.54
4   1.587390e+01   2.115580e-03   1.578080e-03   5.263711e-04    0.58
5   1.496351e+01   1.979895e-03   1.476868e-03   4.926117e-04    0.61
6   1.477297e+01   1.930240e-03   1.439829e-03   4.802573e-04    0.65
7   1.407791e+01   1.740965e-03   1.298643e-03   4.331644e-04    0.69
8   1.195150e+01   1.139652e-03   8.501032e-04   2.835533e-04    0.73
9   1.118074e+01   9.249616e-04   6.899590e-04   2.301369e-04    0.76
10   9.263514e+00   3.932808e-04   2.933610e-04   9.785102e-05    0.80
11   8.435984e+00   1.662211e-04   1.239898e-04   4.135699e-05    0.84
12   8.137082e+00   8.259246e-05   6.160841e-05   2.054958e-05    0.89
13   7.834045e+00   4.811473e-06   3.589036e-06   1.197128e-06    0.93
14   7.817072e+00   4.211285e-07   3.141435e-07   1.047797e-07    0.97
15   7.815469e+00   1.297491e-08   9.741467e-09   3.228250e-09    1.02
16   7.815429e+00   2.773558e-09   3.724366e-09   6.900807e-10    1.05
Optimal solution found.
poc =
4.7669e-05
Iter           Fval  Primal Infeas    Dual Infeas    Duality Gap    Time
0   8.520000e+02   4.148309e-01   2.500000e-01   8.339003e-02    0.24
1   2.936365e+02   7.220152e-02   4.351262e-02   1.451408e-02    0.28
2   3.227398e+01   9.133979e-03   5.504640e-03   1.836128e-03    0.32
3   2.999204e+01   5.626122e-03   3.390612e-03   1.130973e-03    0.36
4   2.891739e+01   5.422358e-03   3.267812e-03   1.090012e-03    0.40
5   2.734221e+01   4.962369e-03   2.990597e-03   9.975440e-04    0.44
6   2.355320e+01   3.776002e-03   2.275627e-03   7.590585e-04    0.48
7   1.765904e+01   1.858229e-03   1.119871e-03   3.735444e-04    0.53
8   1.493406e+01   9.914144e-04   5.974810e-04   1.992958e-04    0.57
9   1.321215e+01   4.284890e-04   2.582311e-04   8.613560e-05    0.61
10   1.247209e+01   1.862607e-04   1.122510e-04   3.744245e-05    0.65
11   1.203916e+01   4.726695e-05   2.848568e-05   9.501685e-06    0.68
12   1.190390e+01   4.898257e-06   2.951962e-06   9.846561e-07    0.73
13   1.188906e+01   1.900382e-07   1.145391e-07   3.820181e-08    0.77
14   1.188847e+01   9.042867e-09   5.942560e-09   1.817813e-09    0.81
Optimal solution found.
poc =
1.7472e-08
Iter           Fval  Primal Infeas    Dual Infeas    Duality Gap    Time
0   8.520000e+02   3.740554e-01   2.500000e-01   8.338857e-02    0.23
1   2.549188e+02   4.172979e-02   2.789011e-02   9.302867e-03    0.26
2   9.392526e+01   1.561744e-02   1.043792e-02   3.481612e-03    0.30
3   2.667086e+01   4.410425e-03   2.947708e-03   9.832206e-04    0.34
4   2.407913e+01   2.549053e-03   1.703660e-03   5.682632e-04    0.39
5   2.355160e+01   2.499060e-03   1.670247e-03   5.571180e-04    0.43
6   2.324912e+01   2.449195e-03   1.636919e-03   5.460015e-04    0.47
7   2.249923e+01   2.308274e-03   1.542735e-03   5.145858e-04    0.50
8   2.040632e+01   1.851989e-03   1.237777e-03   4.128657e-04    0.54
9   1.970151e+01   1.692941e-03   1.131477e-03   3.774090e-04    0.59
10   1.744126e+01   1.126199e-03   7.526951e-04   2.510647e-04    0.62
11   1.620420e+01   8.023922e-04   5.362790e-04   1.788781e-04    0.66
12   1.474391e+01   3.945190e-04   2.636768e-04   8.795053e-05    0.70
13   1.427557e+01   2.644519e-04   1.767465e-04   5.895455e-05    0.73
14   1.370019e+01   1.011430e-04   6.759892e-05   2.254791e-05    0.77
15   1.348178e+01   3.984925e-05   2.663325e-05   8.883635e-06    0.81
16   1.336507e+01   7.537767e-06   5.037870e-06   1.680402e-06    0.85
17   1.334002e+01   6.477134e-07   4.329037e-07   1.443954e-07    0.88
18   1.333772e+01   1.179424e-08   7.999240e-09   2.629302e-09    0.93
19   1.333768e+01   1.381986e-10   8.290199e-09   3.080877e-11    0.99
Optimal solution found.
poc =
5.3035e-10
Iter           Fval  Primal Infeas    Dual Infeas    Duality Gap    Time
0   8.520000e+02   3.472650e-01   2.500000e-01   8.338749e-02    0.23
1   2.309201e+02   2.520373e-02   1.814445e-02   6.052081e-03    0.27
2   9.405942e+01   1.047608e-02   7.541850e-03   2.515584e-03    0.31
3   2.721726e+01   3.116075e-03   2.243298e-03   7.482520e-04    0.35
4   2.416710e+01   1.805118e-03   1.299525e-03   4.334564e-04    0.40
5   2.375956e+01   1.781739e-03   1.282694e-03   4.278426e-04    0.43
6   2.358202e+01   1.764206e-03   1.270072e-03   4.236324e-04    0.47
7   2.304355e+01   1.703461e-03   1.226341e-03   4.090461e-04    0.52
8   2.181656e+01   1.527846e-03   1.099914e-03   3.668761e-04    0.56
9   2.124914e+01   1.448597e-03   1.042861e-03   3.478463e-04    0.60
10   1.948615e+01   1.170737e-03   8.428266e-04   2.811248e-04    0.64
11   1.783054e+01   8.717316e-04   6.275695e-04   2.093258e-04    0.68
12   1.708765e+01   7.336925e-04   5.281936e-04   1.761789e-04    0.72
13   1.550449e+01   3.894897e-04   2.803981e-04   9.352676e-05    0.76
14   1.514484e+01   3.155406e-04   2.271613e-04   7.576962e-05    0.80
15   1.441642e+01   1.496860e-04   1.077607e-04   3.594357e-05    0.85
16   1.411738e+01   7.908921e-05   5.693722e-05   1.899141e-05    0.90
17   1.383348e+01   1.063875e-05   7.658959e-06   2.554645e-06    0.95
18   1.380209e+01   2.769706e-06   1.993947e-06   6.650794e-07    0.99
19   1.379178e+01   1.701668e-07   1.225354e-07   4.086155e-08    1.03
20   1.379114e+01   8.779631e-09   6.671732e-09   2.108221e-09    1.07
Optimal solution found.
poc =
1.8216e-10
Iter           Fval  Primal Infeas    Dual Infeas    Duality Gap    Time
0   8.520000e+02   3.384156e-01   2.500000e-01   8.338731e-02    0.24
1   2.283493e+02   2.314639e-02   1.709909e-02   5.703387e-03    0.29
2   9.475565e+01   9.793019e-03   7.234463e-03   2.413050e-03    0.33
3   2.755188e+01   2.925713e-03   2.161331e-03   7.209104e-04    0.37
4   2.438422e+01   1.697792e-03   1.254221e-03   4.183445e-04    0.41
5   2.398865e+01   1.677057e-03   1.238903e-03   4.132353e-04    0.45
6   2.383017e+01   1.662889e-03   1.228437e-03   4.097444e-04    0.49
7   2.333142e+01   1.612151e-03   1.190955e-03   3.972422e-04    0.53
8   2.217540e+01   1.460099e-03   1.078629e-03   3.597758e-04    0.56
9   2.173362e+01   1.404707e-03   1.037709e-03   3.461270e-04    0.61
10   2.035602e+01   1.210646e-03   8.943487e-04   2.983093e-04    0.65
11   1.865148e+01   9.312689e-04   6.879625e-04   2.294694e-04    0.68
12   1.727485e+01   7.016610e-04   5.183427e-04   1.728928e-04    0.72
13   1.622825e+01   5.067634e-04   3.743647e-04   1.248691e-04    0.76
14   1.539423e+01   3.289696e-04   2.430219e-04   8.105977e-05    0.80
15   1.498430e+01   2.416941e-04   1.785483e-04   5.955466e-05    0.83
16   1.446995e+01   1.222391e-04   9.030248e-05   3.012032e-05    0.87
17   1.418069e+01   5.599477e-05   4.136539e-05   1.379739e-05    0.91
18   1.397083e+01   5.693174e-06   4.205758e-06   1.402827e-06    0.95
19   1.394958e+01   5.174181e-07   3.822538e-07   1.274944e-07    0.99
20   1.394766e+01   4.663196e-08   3.460641e-08   1.149035e-08    1.03
21   1.394748e+01   2.032849e-09   2.212183e-09   5.009042e-10    1.07
Optimal solution found.
poc =
1.0958e-10
Iter           Fval  Primal Infeas    Dual Infeas    Duality Gap    Time
0   8.520000e+02   3.341137e-01   2.500000e-01   8.338698e-02    0.24
1   9.059917e+02   1.639868e-01   1.227028e-01   4.092728e-02    0.28
2   1.017406e+03   7.906474e-02   5.916006e-02   1.973271e-02    0.31
3   1.124331e+03   4.121461e-03   3.083876e-03   1.028620e-03    0.35
4   1.118894e+03   6.591392e-06   4.931998e-06   1.645058e-06    0.39
5   1.118894e+03   9.882157e-09   7.394312e-09   2.466356e-09    0.43
6   1.118894e+03   1.481584e-11   1.109217e-11   3.698267e-12    0.46
Problem is infeasible.
This was tested on R2025a and R2023a. coneprog, bug MATLAB Answers — New Questions
SIMULINK launching Logic Analyzer causes memory leak
Hi all,
I have built a testbench in SIMULINK 2024b usaing the vision HDL toolbox for streaming in video from a test file (.avi) passing through a DUT and then displaying video using the video viewer.
When I try to run a simulation where I stream out 3 of my 1280×1024 8bit pixles from the file (by setting stop time to 36ms), convert to a pixel stream, convert back to a frame and view the video, it works! However, when I try to open the logic analyser to view my 6 logged signals after (or have it open before and run the simulation) MATLAB completely halts, and i have to force quit from the task manager.
From the task manager I can see the Memory consumed by MATLAB rise continually as if there is a memory leak. What is going on here?
Update:
I have removed more and more blocks in my design and have tracked the problem down i believe to the pixels to frame block
Above is a heavily simplified version of my design I/O. Video loaded in from file, converted to pixel stream, then back to a frame and into a display. However Running simulation crashes my matlab – but not immediately:
I open the design and configure my stop time to be equivalent to three frames worth, then I open the logic analyzer to view my logged signals. Then I commence the simulation. The 3 frames appear correctly in the video viewer, but my logged signals do not appear. Then a swirly Icon appears on my logic analyzer and there is a massive surge in memory usage from MATLAB (~20GB). I have to force quit the application.
Note: when I comment out the pixels to frame and video viewer, the logic analyser works completely fine for reading data out of the frame to pixels block
What is going on?Hi all,
I have built a testbench in SIMULINK 2024b usaing the vision HDL toolbox for streaming in video from a test file (.avi) passing through a DUT and then displaying video using the video viewer.
When I try to run a simulation where I stream out 3 of my 1280×1024 8bit pixles from the file (by setting stop time to 36ms), convert to a pixel stream, convert back to a frame and view the video, it works! However, when I try to open the logic analyser to view my 6 logged signals after (or have it open before and run the simulation) MATLAB completely halts, and i have to force quit from the task manager.
From the task manager I can see the Memory consumed by MATLAB rise continually as if there is a memory leak. What is going on here?
Update:
I have removed more and more blocks in my design and have tracked the problem down i believe to the pixels to frame block
Above is a heavily simplified version of my design I/O. Video loaded in from file, converted to pixel stream, then back to a frame and into a display. However Running simulation crashes my matlab – but not immediately:
I open the design and configure my stop time to be equivalent to three frames worth, then I open the logic analyzer to view my logged signals. Then I commence the simulation. The 3 frames appear correctly in the video viewer, but my logged signals do not appear. Then a swirly Icon appears on my logic analyzer and there is a massive surge in memory usage from MATLAB (~20GB). I have to force quit the application.
Note: when I comment out the pixels to frame and video viewer, the logic analyser works completely fine for reading data out of the frame to pixels block
What is going on? Hi all,
I have built a testbench in SIMULINK 2024b usaing the vision HDL toolbox for streaming in video from a test file (.avi) passing through a DUT and then displaying video using the video viewer.
When I try to run a simulation where I stream out 3 of my 1280×1024 8bit pixles from the file (by setting stop time to 36ms), convert to a pixel stream, convert back to a frame and view the video, it works! However, when I try to open the logic analyser to view my 6 logged signals after (or have it open before and run the simulation) MATLAB completely halts, and i have to force quit from the task manager.
From the task manager I can see the Memory consumed by MATLAB rise continually as if there is a memory leak. What is going on here?
Update:
I have removed more and more blocks in my design and have tracked the problem down i believe to the pixels to frame block
Above is a heavily simplified version of my design I/O. Video loaded in from file, converted to pixel stream, then back to a frame and into a display. However Running simulation crashes my matlab – but not immediately:
I open the design and configure my stop time to be equivalent to three frames worth, then I open the logic analyzer to view my logged signals. Then I commence the simulation. The 3 frames appear correctly in the video viewer, but my logged signals do not appear. Then a swirly Icon appears on my logic analyzer and there is a massive surge in memory usage from MATLAB (~20GB). I have to force quit the application.
Note: when I comment out the pixels to frame and video viewer, the logic analyser works completely fine for reading data out of the frame to pixels block
What is going on? computer vision, image processing, simulink, video MATLAB Answers — New Questions
polar/plot incompatibility
Can any one explain the design choise that causes this:
polarscatter(linspace(0,pi*2/3,100).^2,…
linspace(0,pi*2/3,100),…
32,…
linspace(0,pi*2/3,100),’filled’)
hold on
plot([-1 1],[1 -1],’m’)
Error using newplot
Adding Cartesian plot to polaraxes is not supported.
Error in matlab.graphics.internal.newplotwrapper (line 11)
axReturn = newplot(varargin{:});
From my perspective picking polar/cartesian representation of my grid is just that – a choise of either cartesian grid-lines of polar grid-lines. Why should it not be possible to add objects with cartesian coordinates to a region with polar grid-lines or the other way around?Can any one explain the design choise that causes this:
polarscatter(linspace(0,pi*2/3,100).^2,…
linspace(0,pi*2/3,100),…
32,…
linspace(0,pi*2/3,100),’filled’)
hold on
plot([-1 1],[1 -1],’m’)
Error using newplot
Adding Cartesian plot to polaraxes is not supported.
Error in matlab.graphics.internal.newplotwrapper (line 11)
axReturn = newplot(varargin{:});
From my perspective picking polar/cartesian representation of my grid is just that – a choise of either cartesian grid-lines of polar grid-lines. Why should it not be possible to add objects with cartesian coordinates to a region with polar grid-lines or the other way around? Can any one explain the design choise that causes this:
polarscatter(linspace(0,pi*2/3,100).^2,…
linspace(0,pi*2/3,100),…
32,…
linspace(0,pi*2/3,100),’filled’)
hold on
plot([-1 1],[1 -1],’m’)
Error using newplot
Adding Cartesian plot to polaraxes is not supported.
Error in matlab.graphics.internal.newplotwrapper (line 11)
axReturn = newplot(varargin{:});
From my perspective picking polar/cartesian representation of my grid is just that – a choise of either cartesian grid-lines of polar grid-lines. Why should it not be possible to add objects with cartesian coordinates to a region with polar grid-lines or the other way around? polar plot MATLAB Answers — New Questions
Issue Saving image with text overlay to png
I am having issues saving an image that has been displayed in a figure, with a couple markers plotted at specific coordinates and then text overlaid using the text function. I am trying to safe this off as a png via     saveas(gcf,’filename.png’); and the figure exports but the overlaid text is missing.  The title and the marker points I plotted show up but no text. Below is the figure.
Attached is the exported png using saveas
My code looks as follows:
figure; imshow(img,[]);
hold on;
plot(Stats(TestNum).Centroid(1),Stats(TestNum).Centroid(2),’b*’);
set(gca, ‘ActivePositionProperty’, ‘OuterPosition’);
[filepath,name,ext] = fileparts(files(TestNum).name);
title({[];name;[‘Original Image With Centroid Marked’]},’FontSize’,FontSize);
text(20,500,{[‘Area = ‘,num2str(Stats(TestNum).Area.*pixel_scale^2,’%3.2f’),’mm^2′];…
[‘Eccentricity = ‘,num2str(Stats(TestNum).Eccentricity,’%3.2f’)];…
[‘Orientation = ‘,num2str(Stats(TestNum).Orientation,’%3.2f’),char(176)];…
[‘Major Axis Length = ‘,num2str(Stats(TestNum).MajorAxisLength.*pixel_scale,’%3.2f’),’mm’];…
[‘Minor Axis Length = ‘,num2str(Stats(TestNum).MinorAxisLength.*pixel_scale,’%3.2f’),’mm’]},…
‘Color’,’white’,’FontSize’,FontSize);
saveas(gcf,[pwd ‘outputTest ‘,num2str(TestNum),’TubeMidpointCrossSection – Test ‘,num2str(TestNum),’.png’]);I am having issues saving an image that has been displayed in a figure, with a couple markers plotted at specific coordinates and then text overlaid using the text function. I am trying to safe this off as a png via     saveas(gcf,’filename.png’); and the figure exports but the overlaid text is missing.  The title and the marker points I plotted show up but no text. Below is the figure.
Attached is the exported png using saveas
My code looks as follows:
figure; imshow(img,[]);
hold on;
plot(Stats(TestNum).Centroid(1),Stats(TestNum).Centroid(2),’b*’);
set(gca, ‘ActivePositionProperty’, ‘OuterPosition’);
[filepath,name,ext] = fileparts(files(TestNum).name);
title({[];name;[‘Original Image With Centroid Marked’]},’FontSize’,FontSize);
text(20,500,{[‘Area = ‘,num2str(Stats(TestNum).Area.*pixel_scale^2,’%3.2f’),’mm^2′];…
[‘Eccentricity = ‘,num2str(Stats(TestNum).Eccentricity,’%3.2f’)];…
[‘Orientation = ‘,num2str(Stats(TestNum).Orientation,’%3.2f’),char(176)];…
[‘Major Axis Length = ‘,num2str(Stats(TestNum).MajorAxisLength.*pixel_scale,’%3.2f’),’mm’];…
[‘Minor Axis Length = ‘,num2str(Stats(TestNum).MinorAxisLength.*pixel_scale,’%3.2f’),’mm’]},…
‘Color’,’white’,’FontSize’,FontSize);
saveas(gcf,[pwd ‘outputTest ‘,num2str(TestNum),’TubeMidpointCrossSection – Test ‘,num2str(TestNum),’.png’]); I am having issues saving an image that has been displayed in a figure, with a couple markers plotted at specific coordinates and then text overlaid using the text function. I am trying to safe this off as a png via     saveas(gcf,’filename.png’); and the figure exports but the overlaid text is missing.  The title and the marker points I plotted show up but no text. Below is the figure.
Attached is the exported png using saveas
My code looks as follows:
figure; imshow(img,[]);
hold on;
plot(Stats(TestNum).Centroid(1),Stats(TestNum).Centroid(2),’b*’);
set(gca, ‘ActivePositionProperty’, ‘OuterPosition’);
[filepath,name,ext] = fileparts(files(TestNum).name);
title({[];name;[‘Original Image With Centroid Marked’]},’FontSize’,FontSize);
text(20,500,{[‘Area = ‘,num2str(Stats(TestNum).Area.*pixel_scale^2,’%3.2f’),’mm^2′];…
[‘Eccentricity = ‘,num2str(Stats(TestNum).Eccentricity,’%3.2f’)];…
[‘Orientation = ‘,num2str(Stats(TestNum).Orientation,’%3.2f’),char(176)];…
[‘Major Axis Length = ‘,num2str(Stats(TestNum).MajorAxisLength.*pixel_scale,’%3.2f’),’mm’];…
[‘Minor Axis Length = ‘,num2str(Stats(TestNum).MinorAxisLength.*pixel_scale,’%3.2f’),’mm’]},…
‘Color’,’white’,’FontSize’,FontSize);
saveas(gcf,[pwd ‘outputTest ‘,num2str(TestNum),’TubeMidpointCrossSection – Test ‘,num2str(TestNum),’.png’]); saveas, text, png file, figure, overlaid text MATLAB Answers — New Questions
Monitor losses in MOSFET in SimScape
Using the Simscape probe, I can observe the latest turn-on and turn-off switching losses during the simulation. Do these values include both MOSFET and body-diode losses, or can body-diode (reverse-recovery) losses be monitored separately so that the probe’s losses correspond exclusively to the MOSFET?Using the Simscape probe, I can observe the latest turn-on and turn-off switching losses during the simulation. Do these values include both MOSFET and body-diode losses, or can body-diode (reverse-recovery) losses be monitored separately so that the probe’s losses correspond exclusively to the MOSFET? Using the Simscape probe, I can observe the latest turn-on and turn-off switching losses during the simulation. Do these values include both MOSFET and body-diode losses, or can body-diode (reverse-recovery) losses be monitored separately so that the probe’s losses correspond exclusively to the MOSFET? power losses in mosfet simscape MATLAB Answers — New Questions
Editing the format of a chart title in excel through actxserver
I have been trying to work out how to underscore a section of a chart title string in an existing chart in excel through actxserver. I would typically use invoke to format strings in excel cells, but I can’t use that approach in chart titles.
In the code below I am replacing a section of the title string, which has a portion already underscored. This automically underscoes the whole title for some reason, which I then remove and try to underscore just the section that was already underscored.
If anyone has a solution it would be much appreciated. I have tried different LLMs, but this is the method they suggest. Which should work based on excel VBA. Possibly this is just not supported in Matlab?
Example of editing characters in a chart title that doesn’t work.
excel = actxserver(‘Excel.Application’);
file = excel.Workbooks.Open("ABC.xlsx");
Sheet = excel.Worksheets.Item(‘ABC’);
ChartObjects = Sheet.ChartObjects;
chart = ChartObjects.Item(1).Chart; % Selecting chart
s = chart.ChartTitle.Text; % find current chart title
chart.ChartTitle.Text = strrep(s, OldWord, NewWord); % Replace key word in chart title
chart.ChartTitle.Characters.Font.Underline = 0; % Removing all underscored characters
pos = strfind(s, ‘-‘); % finding end of region to underline
% Works up to this last line
chart.ChartTitle.Characters(1, pos(1)-2).Font.Underline = 2; % Underscoring desired region
Example for editing a string in a excel cell that works.
Range = get(Sheet,’Range’, ‘A1’);
Range.Value = {‘(Test Area = 21.65 cm2)’};
Chars = invoke(Range,’Characters’,22,1); % Selecting character range within cell starting at character 22 and continuing for 1 length
Chars.Font.Superscript = ‘true’; % Seting selected character to supersciptI have been trying to work out how to underscore a section of a chart title string in an existing chart in excel through actxserver. I would typically use invoke to format strings in excel cells, but I can’t use that approach in chart titles.
In the code below I am replacing a section of the title string, which has a portion already underscored. This automically underscoes the whole title for some reason, which I then remove and try to underscore just the section that was already underscored.
If anyone has a solution it would be much appreciated. I have tried different LLMs, but this is the method they suggest. Which should work based on excel VBA. Possibly this is just not supported in Matlab?
Example of editing characters in a chart title that doesn’t work.
excel = actxserver(‘Excel.Application’);
file = excel.Workbooks.Open("ABC.xlsx");
Sheet = excel.Worksheets.Item(‘ABC’);
ChartObjects = Sheet.ChartObjects;
chart = ChartObjects.Item(1).Chart; % Selecting chart
s = chart.ChartTitle.Text; % find current chart title
chart.ChartTitle.Text = strrep(s, OldWord, NewWord); % Replace key word in chart title
chart.ChartTitle.Characters.Font.Underline = 0; % Removing all underscored characters
pos = strfind(s, ‘-‘); % finding end of region to underline
% Works up to this last line
chart.ChartTitle.Characters(1, pos(1)-2).Font.Underline = 2; % Underscoring desired region
Example for editing a string in a excel cell that works.
Range = get(Sheet,’Range’, ‘A1’);
Range.Value = {‘(Test Area = 21.65 cm2)’};
Chars = invoke(Range,’Characters’,22,1); % Selecting character range within cell starting at character 22 and continuing for 1 length
Chars.Font.Superscript = ‘true’; % Seting selected character to superscipt I have been trying to work out how to underscore a section of a chart title string in an existing chart in excel through actxserver. I would typically use invoke to format strings in excel cells, but I can’t use that approach in chart titles.
In the code below I am replacing a section of the title string, which has a portion already underscored. This automically underscoes the whole title for some reason, which I then remove and try to underscore just the section that was already underscored.
If anyone has a solution it would be much appreciated. I have tried different LLMs, but this is the method they suggest. Which should work based on excel VBA. Possibly this is just not supported in Matlab?
Example of editing characters in a chart title that doesn’t work.
excel = actxserver(‘Excel.Application’);
file = excel.Workbooks.Open("ABC.xlsx");
Sheet = excel.Worksheets.Item(‘ABC’);
ChartObjects = Sheet.ChartObjects;
chart = ChartObjects.Item(1).Chart; % Selecting chart
s = chart.ChartTitle.Text; % find current chart title
chart.ChartTitle.Text = strrep(s, OldWord, NewWord); % Replace key word in chart title
chart.ChartTitle.Characters.Font.Underline = 0; % Removing all underscored characters
pos = strfind(s, ‘-‘); % finding end of region to underline
% Works up to this last line
chart.ChartTitle.Characters(1, pos(1)-2).Font.Underline = 2; % Underscoring desired region
Example for editing a string in a excel cell that works.
Range = get(Sheet,’Range’, ‘A1’);
Range.Value = {‘(Test Area = 21.65 cm2)’};
Chars = invoke(Range,’Characters’,22,1); % Selecting character range within cell starting at character 22 and continuing for 1 length
Chars.Font.Superscript = ‘true’; % Seting selected character to superscipt actxserver, excel, chart title, underscore MATLAB Answers — New Questions
Becoming Frontier: How human ambition and AI-first differentiation are helping Microsoft customers go further with AI
Over the past few years, we have driven remarkable progress accelerating AI innovation together with our customers and partners. We are achieving efficiency and productivity at scale to shape industries and markets around the world. It is time to demand more of AI to solve humanity’s biggest challenges by democratizing intelligence, obsolescing the mundane and unlocking creativity. This is the notion of becoming Frontier: to empower human ambition and find AI-first differentiation in everything we do to maximize an organization’s potential and our impact on society.
Microsoft’s technology portfolio ensures our customers can go further with AI on their way to becoming Frontier firms, using our AI Transformation success framework as their guide. Our AI business solutions are dramatically changing how people gain actionable insights from data — fusing the capabilities of AI agents and Copilots while keeping humans at the center. We have the largest, most scalable, most capable cloud and AI platform in the industry for our customers to build upon their aspirations. We remain deeply focused on ensuring AI is used responsibly and securely, and embed security into everything we do to help our customers prioritize cybersecurity and guard against threats.
We are fortunate to work with thousands of customers and partners around the world — across every geography and industry. I am pleased to share some of the customer stories being showcased at our recently opened Experience Center One facility — each exemplifying the path to becoming Frontier.
Driven by a commitment to innovation, sustainability and operational excellence, ADNOC is helping meet the world’s growing energy demands safely and reliably, while accelerating decarbonization efforts. To empower its workforce, the company introduced OneTalent — a unified AI-powered platform consolidating over 16 legacy HR processes into a single, intelligent system that furthers its dedication to nurturing talent, aligning people with strategic goals and turning every member of its workforce into an AI collaborator. Partnering with Microsoft and AIQ, ADNOC applied AI across its operations to reimagine everything from seismic analysis to predictive maintenance. ENERGYai and Neuron 5 — AI-powered platforms built natively on Azure OpenAI — turn complexity into actionable insights. The platforms use predictive models to reduce downtime — by as much as 50% at one plant. They are also using autonomous agents to optimize energy use; unlocking data-driven insights that have accelerated energy workflows from months or years to just days or minutes.
Asset manager and technology provider BlackRock has been on a journey to infuse AI to level up how its organization operates across three key pillars: how they invest, how they operate and how they serve clients. To accelerate this mission, they partnered with Microsoft to transform processes across the investment management lifecycle by integrating cloud and AI technologies alongside its Aladdin platform. Embedded across 20 applications and accessed by tens of thousands of users, the Aladdin platform’s AI capabilities deliver functionally relevant tools to help redefine workflows for different types of financial service professionals. Client relationship managers are saving hours per client, reducing duplication and improving accuracy by evaluating CRM and market data to generate personalized client briefs and opportunity analyses using natural language processing — supported by verification and review methods that facilitate accuracy and compliance. Investment compliance officers are streamlining portfolio onboarding and compliance guideline coding, saving time on more straightforward tasks to focus on complex, investigative tasks. Portfolio managers can access data, analytics, research summaries, cash balances and more through AI-powered chat capabilities; enabling faster, more informed decision-making aligned with client mandates. With accelerated insights, improved data quality and enhanced risk management, BlackRock and its clients gain an advantage while enhancing client service, compliance and portfolio management.
To build on its culture of innovation and enable hyper-relevant messaging at scale, multinational advertising and media agency dentsu built a cutting-edge solution using Azure OpenAI: dentsu.Connect — a unified OS for its applications. By leveraging the power of AI across the entire campaign lifecycle, clients can build and execute campaigns while predicting marketers’ next best impact with confidence and precision. This end-to-end platform drives data connectivity and ensures seamless interoperability with clients’ technology and data stacks to maximize and drive brand relevance across content, production and media activation while aligning every action with business goals. dentsu.Connect helps minimize the gap between insights and action with speed and precision. Since launching, users have increased operational efficiency by 25%, improved business outcomes by 30% and quickened decision-making and data-driven AI insight generation by 125X.
Water management solutions and services partner Ecolab is harnessing the power of data-driven solutions to enable organizations to reduce water consumption, maximize system performance and optimize operating costs. Using Microsoft Azure and IoT services, the company built ECOLAB3D: an intelligent cloud platform that unifies diverse and dispersed IoT data to visualize and optimize water systems remotely. By providing actionable insights for real-time optimization across multiple assets and sites, Ecolab partners with global leaders such as Microsoft to collectively drive hundreds of millions in operational savings — while conserving more than 226 billion gallons of water annually; equivalent to the drinking water needs of nearly 800 million people. Delivering solutions across diverse industries, Ecolab is also a trusted partner for foodservice locations, helping balance labor costs with customer satisfaction. Its cloud-based platform Ecolab RushReady transforms data into an AI-enabled dashboard that improves daily operations by delivering actionable insights. In an Ecolab customer case study, this helped improve speed of service and sales labor per hour, resulting in increased profit of more than 10%. From data centers to dining rooms, Ecolab delivers intelligent, scalable solutions that transform operations for greater efficiency and measurable impact.
Leveraging Microsoft’s AI solutions across its portfolio, Epic built agentic “personas” to support care teams and patients, improve operations and financial performance and advance the practice of medicine. By summarizing patient records and automatically drafting clinical notes, one organization found that “Art” decreased after-hours documentation for clinicians by 60%, reduced burnout by 82% and helped them focus more on patient care. Care teams can also track long-term patient health and better plan treatment for chronic conditions, while nurses can perform wound image analysis automatically with 72% greater precision than manual methods. At one hospital, AI review of routine chest X-rays led to earlier discovery of over 100 cases of lung cancer, increasing the detection rate to 70% compared to the 27% national average. To support back-end operations, organizations are using “Penny” to improve the revenue cycle — resulting in $3.4 million in additional revenue at one regional network services provider. Epic also developed “Emmie” to have conversational interactions with patients and more easily help them schedule appointments and ask questions. Epic is leveraging Azure Fabric for the Cosmos platform to bring together anonymized data from more than 300 million patients, including 13 million with rare diseases, so physicians can connect with peers who have treated similar cases to improve rare disease diagnosis and select the most effective treatment.
To reduce professional burnout and accelerate scale across the industry, Harvey built an AI platform to automate legal research, contract reviews and document analysis. Harvey Assistant assists attorney searches across large document sets to identify specific clauses or provisions within seconds instead of hours. To support large-scale analysis, Harvey Vault manages and analyzes up to 100,000 files per project for complex tasks like litigation, while Harvey Workflows automates routine yet critical tasks into smaller AI-managed steps. With the integration of the newly expanded Microsoft Word add-in, AI capabilities provide legal teams with the ability to edit 100-plus page documents with a single query, enabling centrally controlled document compliance reviews that enhance efficiency while reducing risk. With more than 74,000 legal professionals using the platform, Harvey is helping them streamline workflows, reduce administrative burden and combat attorney fatigue — with the average user saving up to 25 hours of time per month.
To revolutionize drug discovery, biotech company Insilico Medicine is leveraging AI across its entire development pipeline — from target identification to molecule design and clinical trials. The company created Pharma.AI to accelerate research while reducing costs and improving success rates in emerging novel therapies — with developmental candidate timelines reduced from 2.5-4.5 years to 9-18 months for more than 20 therapeutic programs. The integrated AI platforms built with Azure AI Foundry manage complex biological data, identify disease-relevant targets and advance candidates to clinical trials — accelerating research in what is traditionally a slow, costly and complex pharmaceutical R&D process. They enable researchers to analyze genetic data and identify drug targets with AI-generated reports to facilitate business case development; use physics-based models to evaluate candidates for potency, safety and synthesizability; integrate with specialized large language models for drug discovery; and combine AI agents with structured workflows to reduce document drafting time by over 85% while improving first-pass quality of scientific documents by 60%.
To enhance manufacturing operations in a fast-paced and complex industry, global consumer foods producer Kraft Heinz partnered with Microsoft to embed AI and machine learning across its production facilities, resulting in smarter decision-making and operational improvements. The company built an AI-powered platform — Plant Chat — providing real-time insights on the factory floor and reducing downtime to enable faster, more confident decision-making with proactive guidance. The solution analyzes over 300 variables and allows operators to interact via natural language to improve consistency, reduce guesswork, decrease waste and maintain compliance — even for less experienced operators. Since implementation and collectively with other initiatives, these efforts have resulted in a 40% reduction in supply-chain waste, a 20% increase in sales forecast accuracy and a 6% product-yield improvement across all North American manufacturing sites through the third quarter of 2024. Combined with further operational improvements, this work has yielded more than $1.1 billion in gross efficiencies from 2023 through the third quarter of 2024.
To redefine work and scale intelligent automation globally, digital native Manus AI developed an advanced autonomous AI system designed to understand user intent and execute complex workflows independently across various domains. The solution leverages a multi-agent architecture through Microsoft Azure AI Foundry to deliver scalable, versatile task automation for millions of users worldwide. Its Wide Research capability deploys specialized sub-agents to rapidly perform large-scale, multi-dimensional research tasks; saving significant time and delivering actionable insights to make complex analysis accessible and efficient for strategic decision-making. Manus AI can also build dynamic dashboards so organizations can visualize trends, anomalies and market insights in real-time; driving strategic planning with reliable, up-to-date information. The multimodel image editing and creation capabilities also allow users to support brand consistency and enable marketers and product teams to iterate rapidly.
To advance automotive innovation, stabilize supply chain volatility, simplify production complexity and meet sustainability demands, Mercedes-Benz scaled AI innovation across its global production network. The MO360 data platform connects over 30 car plants worldwide to the Microsoft Cloud, enabling real-time data access, global optimization and analytics. The Digital Factory Chatbot Ecosystem uses a multi-agent system to empower employees with collaborative insights, and Paint Shop AI leverages machine learning simulations to diagnose efficiency declines and reduce energy consumption of the buildings and machines — including 20% energy savings in the Rastatt paint shop. Using NVIDIA Omniverse on Azure, Mercedes-Benz created large-scale factory digital twins for visualization, testing and optimization of production lines — enabling agile planning and continuous improvement. The MBUX Virtual Assistant embedded in over 3 million vehicles, powered by Microsoft’s ChatGPT and Bing Search, offers natural, conversational voice interactions and integrates Microsoft 365 Copilot with Teams directly into vehicles to enable mobile workspaces.
U.S. stock exchange and financial services technology company Nasdaq integrated AI capabilities into its Nasdaq Boardvantage platform to help corporate governance teams and board members save time, reduce information overload, improve decision-making and enhance board meeting preparation and governance workflows. The board management platform is used by leadership teams at over 4,000 organizations worldwide to centralize activities like meeting planning, agenda building, decision support, resolution approval, voting and signatures. Using Azure OpenAI GPT-4o mini, the AI Summarization feature helps board secretaries significantly reduce manual effort, saving hundreds of hours annually with accuracy between 91% to 97%. AI Meeting Minutes helps governance teams draft minutes by processing agendas, documents and notes while allowing for customization of length, tone and anonymization; accelerating post-meeting workflows and saving up to five hours per meeting.
As customers seek to use AI more to shop and search for products, luxury lifestyle company Ralph Lauren developed a personal, frictionless, inspirational and accessible solution to blend fashion with cutting-edge AI. Working with Microsoft, Ralph Lauren developed Ask Ralph: an AI-powered conversational tool providing styling tips and outfit recommendations from across the Polo Ralph Lauren brand. Powered by Azure OpenAI, the AI tool uses a natural language search engine to adapt dynamically to specific language inputs and interpret user intent to improve accuracy. It supports complex queries with exploratory or nuanced information needs with contextual understanding; and can discern tone, satisfaction and intent to refine recommendations. The tool also picks up on cues like location-based insights or event-driven needs. With Ask Ralph, customers can now reimagine how they shop online by putting the brand’s unique and iconic take on style right into their own hands.
Industrial automation and digital transformation expert Rockwell Automation is integrating AI and advanced analytics into its products to help manufacturers adapt seamlessly to market changes, reduce risk and develop agentic AI capabilities to support innovation and growth. FactoryTalk Design Studio Copilot, a cloud-based environment for programming, enables rapid updates to code for evolving production needs — reducing complex coding tasks from days to minutes. Rockwell’s digital twin software, Emulate3D®, creates physics-based models for virtual testing of automation code and AI, reducing costly real-world errors and production risks while cutting on-site commissioning times by 50%. With the integration of NVIDIA Omniverse — a collaborative, large-scale digital twin platform — users can perform multi-user factory design and testing to facilitate cross-disciplinary collaboration, address industry challenges and unlock opportunities through digital simulation before real-world deployment.
 Copilot, a cloud-based environment for programming, enables rapid updates to code for evolving production needs — reducing complex coding tasks from days to minutes. Rockwell’s digital twin software, Emulate3D®, creates physics-based models for virtual testing of automation code and AI, reducing costly real-world errors and production risks while cutting on-site commissioning times by 50%. With the integration of NVIDIA Omniverse — a collaborative, large-scale digital twin platform — users can perform multi-user factory design and testing to facilitate cross-disciplinary collaboration, address industry challenges and unlock opportunities through digital simulation before real-world deployment.
To enable a cleaner, more resilient energy future, Schneider Electric is powering AI-driven industry innovation by addressing grid stability and enterprise sustainability challenges. Built using Microsoft Azure, the company developed solutions for organizations to act faster and smarter while delivering measurable improvements in grid reliability and enterprise ESG management. Resource Advisor Copilot transforms raw ESG and energy data into actionable insights via natural language queries to support knowledge-based and system data questions; saving sustainability managers hundreds of hours annually in data analysis and reporting tasks in early testing. Grid AI Assistant allows operators to interact with complex grids using natural language to improve response times and accuracy during critical events; reducing outages by 40% and speeding up application deployment by 60%. Schneider Electric’s integration of AI tools reflects a strategic approach to digitally transforming energy management, addressing both operational resilience and sustainability imperatives.
To enhance personalized learning, streamline operations and support educators with innovative technology, the State of São Paulo’s Department of Education (SEDUC) partnered with Microsoft to equip schools with cloud and AI solutions — including Azure OpenAI, Microsoft 365, Azure and Dynamics 365. SEDUC is applying responsible AI solutions at scale to address sector priorities like delivering timely, high-quality formative feedback and reducing repetitive administrative work. With Essay Grader, teachers automate portions of grading and receive suggested feedback, freeing time for lesson design and individual support. With Question Grader, students can answer questions more openly with their own perspectives and reasoning while still receiving curated feedback typically reserved for extensive exams. By leveraging these AI-powered solutions, SEDUC is improving learning outcomes, boosting efficiency and strengthening teacher impact — anchored in equity, transparency and sound governance.
Australia’s leading telecommunications company, Telstra, is transforming its customer service operations to improve the experience for its customers and the people that serve them. One of the biggest pain points for teams is navigating multiple systems to identify and resolve a customer issue — leading to long handling times and reliance on how team members interpret various data sources. By leveraging AI solutions built on Azure OpenAI and Microsoft 365 Copilot, the company is enabling instant knowledge access and streamlined workflows. With One Sentence Summary, agents have a concise overview of customer interactions to improve efficiency and customer satisfaction — reducing call handling time by over one minute and repeat contacts by nearly 10%. Ask Telstra provides AI-generated responses from Telstra’s knowledge base in near real-time to assist agents with accurate product, plan and troubleshooting information across a wide variety of topics during calls; facilitating seamless agent-customer interactions with AI assistance.
As one of the largest leading global automakers, Toyota is pioneering AI intelligence in manufacturing with O-beya System: a multi-agent AI system simulating expert discussions virtually. Based on decades of engineering knowledge, the solution fosters a collaborative project management approach to enhance problem-solving and innovation in vehicle development while identifying key challenges to help analyze and diagnose problems. O-beya can auto-select AI agents in fields like fuel efficiency, drivability, noise and vibration, energy management and power management to pinpoint causes and suggest solutions. The system also offers interactive features; including prompt history, term explanations and creative summaries to further enable engineers to explore and validate mitigation strategies efficiently. The system leverages Microsoft Azure OpenAI, Azure AI Search and Azure Cosmos DB to analyze internal design data and help Toyota accelerate innovation, preserve institutional knowledge and resolve complex engineering issues faster. Since January 2024, over 800 powertrain engineers have accessed the system, utilizing it hundreds of times monthly across multiple business units.
As we seek to help our customers realize their AI ambitions, our mission remains unchanged: to empower every person and every organization on the planet to achieve more. We are at our best as a company when we put our technology to work for others. As you move forward on your AI journey, ask what AI can do for your organization and what it means to demand more from it. Leveraging the Microsoft portfolio, together we can do more to positively impact society; going beyond efficiency and productivity to solve for humanity’s biggest challenges. I look forward to partnering with you on your path to becoming Frontier.
The post Becoming Frontier: How human ambition and AI-first differentiation are helping Microsoft customers go further with AI appeared first on The Official Microsoft Blog.
Over the past few years, we have driven remarkable progress accelerating AI innovation together with our customers and partners. We are achieving efficiency and productivity at scale to shape industries and markets around the world. It is time to demand more of AI to solve humanity’s biggest challenges by democratizing intelligence, obsolescing the mundane and…
The post Becoming Frontier: How human ambition and AI-first differentiation are helping Microsoft customers go further with AI appeared first on The Official Microsoft Blog.Read More
The next chapter of the Microsoft–OpenAI partnership
Since 2019, Microsoft and OpenAI have shared a vision to advance artificial intelligence responsibly and make its benefits broadly accessible. What began as an investment in a research organization has grown into one of the most successful partnerships in our industry. As we enter the next phase of this partnership, we’ve signed a new definitive agreement that builds on our foundation, strengthens our partnership, and sets the stage for long-term success for both organizations.
First, Microsoft supports the OpenAI board moving forward with formation of a public benefit corporation (PBC) and recapitalization. Following the recapitalization, Microsoft holds an investment in OpenAI Group PBC valued at approximately $135 billion, representing roughly 27 percent on an as-converted diluted basis, inclusive of all owners – employees, investors, and the OpenAI Foundation. Excluding the impact of OpenAI’s recent funding rounds, Microsoft held a 32.5 percent stake on an as-converted basis in the OpenAI for-profit.
The agreement preserves key elements that have fueled this successful partnership – meaning OpenAI remains Microsoft’s frontier model partner and Microsoft continues to have exclusive IP rights and Azure API exclusivity until Artificial General Intelligence (AGI).
It also refines and adds new provisions that enable each company to independently continue advancing innovation and growth.
What has evolved:
- Once AGI is declared by OpenAI, that declaration will now be verified by an independent expert panel.
- Microsoft’s IP rights for both models and products are extended through 2032 and now include models post-AGI, with appropriate safety guardrails.
- Microsoft’s IP rights to research, defined as the confidential methods used in the development of models and systems, will remain until either the expert panel verifies AGI or through 2030, whichever is first. Research IP includes, for example, models intended for internal deployment or research only. Beyond that research IP does not include model architecture, model weights, inference code, finetuning code, and any IP related to data center hardware and software; and Microsoft retains these non-Research IP rights.
- Microsoft’s IP rights now exclude OpenAI’s consumer hardware.
- OpenAI can now jointly develop some products with third parties. API products developed with third parties will be exclusive to Azure. Non-API products may be served on any cloud provider.
- Microsoft can now independently pursue AGI alone or in partnership with third parties.
- If Microsoft uses OpenAI’s IP to develop AGI, prior to AGI being declared, the models will be subject to compute thresholds; those thresholds are significantly larger than the size of systems used to train leading models today.
- The revenue share agreement remains until the expert panel verifies AGI, though payments will be made over a longer period of time.
- OpenAI has contracted to purchase an incremental $250B of Azure services, and Microsoft will no longer have a right of first refusal to be OpenAI’s compute provider.
- OpenAI can now provide API access to US government national security customers, regardless of the cloud provider.
- OpenAI is now able to release open weight models that meet requisite capability criteria.
As we step into this next chapter of our partnership, both companies are better positioned than ever to continue building great products that meet real-world needs, and create new opportunity for everyone and every business.
The post The next chapter of the Microsoft–OpenAI partnership appeared first on The Official Microsoft Blog.
Since 2019, Microsoft and OpenAI have shared a vision to advance artificial intelligence responsibly and make its benefits broadly accessible. What began as an investment in a research organization has grown into one of the most successful partnerships in our industry. As we enter the next phase of this partnership, we’ve signed a new definitive…
The post The next chapter of the Microsoft–OpenAI partnership appeared first on The Official Microsoft Blog.Read More
How to detect and prevent antivirus from affecting MATLAB and Simulink performance?
I suspect that my antivirus software is impacting the performance of MATLAB and Simulink. Is there something that I can do to detect this and to help prevent this type of interference? I suspect that my antivirus software is impacting the performance of MATLAB and Simulink. Is there something that I can do to detect this and to help prevent this type of interference?  I suspect that my antivirus software is impacting the performance of MATLAB and Simulink. Is there something that I can do to detect this and to help prevent this type of interference?  antivirus, slow, simulink, ui MATLAB Answers — New Questions
Evaporator heat-flow reversed in refrigerant loop model (Simscape)
Hello everyone,
I’m currently modeling a refrigerant test loop in Simscape. The flow path is:
High-pressure reservoir → condenser → short pipe → valve (TXV or EXV) → short pipe → evaporator → low-pressure reservoir. All parameters are set to realistic values (pressures, diameters, temperatures, etc.).
The issue I’m facing is that the evaporator appears to be removing heat from the refrigerant instead of adding it, the temperature at port B is higher than at port A, even though the evaporator’s ambient is hotter. This causes downstream effects such as superheat decreasing when the valve closes, which is the opposite of physical behavior. Meanwhile, the condenser behaves correctly (temperature drops from port A → B as it rejects heat). Has anyone seen this before or know why the evaporator heat direction might flip in Simscape?Hello everyone,
I’m currently modeling a refrigerant test loop in Simscape. The flow path is:
High-pressure reservoir → condenser → short pipe → valve (TXV or EXV) → short pipe → evaporator → low-pressure reservoir. All parameters are set to realistic values (pressures, diameters, temperatures, etc.).
The issue I’m facing is that the evaporator appears to be removing heat from the refrigerant instead of adding it, the temperature at port B is higher than at port A, even though the evaporator’s ambient is hotter. This causes downstream effects such as superheat decreasing when the valve closes, which is the opposite of physical behavior. Meanwhile, the condenser behaves correctly (temperature drops from port A → B as it rejects heat). Has anyone seen this before or know why the evaporator heat direction might flip in Simscape? Hello everyone,
I’m currently modeling a refrigerant test loop in Simscape. The flow path is:
High-pressure reservoir → condenser → short pipe → valve (TXV or EXV) → short pipe → evaporator → low-pressure reservoir. All parameters are set to realistic values (pressures, diameters, temperatures, etc.).
The issue I’m facing is that the evaporator appears to be removing heat from the refrigerant instead of adding it, the temperature at port B is higher than at port A, even though the evaporator’s ambient is hotter. This causes downstream effects such as superheat decreasing when the valve closes, which is the opposite of physical behavior. Meanwhile, the condenser behaves correctly (temperature drops from port A → B as it rejects heat). Has anyone seen this before or know why the evaporator heat direction might flip in Simscape? simscape MATLAB Answers — New Questions
Why do I get an “Unrecognized method, property, or field ‘IsInterface'” error when accessing NET.assembly properties with .NET 9
With .NET 9, I am attempting to get the properties of a NET.Assembly (like Classes or Interfaces), but this throws an error. For example, 
>> asmInfo = NET.addAssembly("System.Windows.Forms");
>> asmInfo.Classes
Unrecognized method, property, or field ‘IsInterface’ for class ‘System.RuntimeType’.
…
This same code works with .NET 8. Why am I getting an error with .NET 9?With .NET 9, I am attempting to get the properties of a NET.Assembly (like Classes or Interfaces), but this throws an error. For example, 
>> asmInfo = NET.addAssembly("System.Windows.Forms");
>> asmInfo.Classes
Unrecognized method, property, or field ‘IsInterface’ for class ‘System.RuntimeType’.
…
This same code works with .NET 8. Why am I getting an error with .NET 9? With .NET 9, I am attempting to get the properties of a NET.Assembly (like Classes or Interfaces), but this throws an error. For example, 
>> asmInfo = NET.addAssembly("System.Windows.Forms");
>> asmInfo.Classes
Unrecognized method, property, or field ‘IsInterface’ for class ‘System.RuntimeType’.
…
This same code works with .NET 8. Why am I getting an error with .NET 9?  MATLAB Answers — New Questions
Discrepancy in sparse matrix math, when NaN’s present
I expect result1 and result2 below to be identical, but they aren’t. The discrepancy must be a bug, right? I’m working in R2024b, but the Run output below shows the issue exists as well in whatever the Matlab online engine is now running.
n = 5; m = 3;
S = sparse(n, m);
v=nan(n, 1);
D=sparse(diag(v));
result1=full(v.*S) %correct
result2=full(D*S) %incorrectI expect result1 and result2 below to be identical, but they aren’t. The discrepancy must be a bug, right? I’m working in R2024b, but the Run output below shows the issue exists as well in whatever the Matlab online engine is now running.
n = 5; m = 3;
S = sparse(n, m);
v=nan(n, 1);
D=sparse(diag(v));
result1=full(v.*S) %correct
result2=full(D*S) %incorrect I expect result1 and result2 below to be identical, but they aren’t. The discrepancy must be a bug, right? I’m working in R2024b, but the Run output below shows the issue exists as well in whatever the Matlab online engine is now running.
n = 5; m = 3;
S = sparse(n, m);
v=nan(n, 1);
D=sparse(diag(v));
result1=full(v.*S) %correct
result2=full(D*S) %incorrect sparse, nan, bug?, numeric MATLAB Answers — New Questions
Simulink on Windows 11 cannot talk to WSL2 app over UDP sockets
Hi,
I’m running a Simulink model on Windows 11 Pro that has "UDP Send" blocks. The "UDP Send" block will send UDP packets to the address and port you specify. I am trying to communicate from an executing Simulink model over UDP to a simple UDP client running on WSL2. My WSL2 system is configured for mirrored networking with loopback addressing enabled. However, I cannot receive any packets on my WSL2 UDP client, although when I run the exact same program ported to Windows it works perfectly fine. I can send UDP packets manually from Windows 11 to WSL2 on the command line in PowerShell, so I know the network path is fine. Something about the Simulink UDP implementation is unusual in that is does not send UDP packets to sockets in my WSL2 environment. I have tried so many things (using physical IP address, broadcast, loopback, etc.) and I have disabled checksums in WSL2 and temporarily turned off the both the Windows Defender firewall and Hyper-V firewall. Nothing works. Anyone have any ideas?
Thanks,
-LukeHi,
I’m running a Simulink model on Windows 11 Pro that has "UDP Send" blocks. The "UDP Send" block will send UDP packets to the address and port you specify. I am trying to communicate from an executing Simulink model over UDP to a simple UDP client running on WSL2. My WSL2 system is configured for mirrored networking with loopback addressing enabled. However, I cannot receive any packets on my WSL2 UDP client, although when I run the exact same program ported to Windows it works perfectly fine. I can send UDP packets manually from Windows 11 to WSL2 on the command line in PowerShell, so I know the network path is fine. Something about the Simulink UDP implementation is unusual in that is does not send UDP packets to sockets in my WSL2 environment. I have tried so many things (using physical IP address, broadcast, loopback, etc.) and I have disabled checksums in WSL2 and temporarily turned off the both the Windows Defender firewall and Hyper-V firewall. Nothing works. Anyone have any ideas?
Thanks,
-Luke Hi,
I’m running a Simulink model on Windows 11 Pro that has "UDP Send" blocks. The "UDP Send" block will send UDP packets to the address and port you specify. I am trying to communicate from an executing Simulink model over UDP to a simple UDP client running on WSL2. My WSL2 system is configured for mirrored networking with loopback addressing enabled. However, I cannot receive any packets on my WSL2 UDP client, although when I run the exact same program ported to Windows it works perfectly fine. I can send UDP packets manually from Windows 11 to WSL2 on the command line in PowerShell, so I know the network path is fine. Something about the Simulink UDP implementation is unusual in that is does not send UDP packets to sockets in my WSL2 environment. I have tried so many things (using physical IP address, broadcast, loopback, etc.) and I have disabled checksums in WSL2 and temporarily turned off the both the Windows Defender firewall and Hyper-V firewall. Nothing works. Anyone have any ideas?
Thanks,
-Luke socket, udp, wsl2, simulink, packet, firewall MATLAB Answers — New Questions
Why do Nan values greatly increase the cost of sparse multiplication
Consider this code:
clear; close all;
n = 1e6;
m = 1e3;
s = 1e-3;
p = round(s^2 * n * m);
I = randperm(n, p);
J = randperm(m, p);
phi = sparse(I, J, 1, n, m);
Gx = randn(n, 1);
for k = 1:3
tic
L = Gx .* phi;
toc
end
Gx(1) = NaN;
for k = 1:3
tic
L = Gx .* phi;
toc
end
Now consider the output on my macbook pro M1 running Matlab 2024a (so through rosetta).
Elapsed time is 0.001591 seconds.
Elapsed time is 0.000291 seconds.
Elapsed time is 0.000282 seconds.
Elapsed time is 0.573762 seconds.
Elapsed time is 0.548177 seconds.
Elapsed time is 0.560880 seconds.
Notice the very large difference in computation times between the no-NaN version of Gx and the version that contains a single NaN value.
The solution is quite obvious, just remove the NaN values with your favorite method (isnan, isfinite, etc.). So this is not my question.
What intregues me is:
why the computation time changes so drastically?Consider this code:
clear; close all;
n = 1e6;
m = 1e3;
s = 1e-3;
p = round(s^2 * n * m);
I = randperm(n, p);
J = randperm(m, p);
phi = sparse(I, J, 1, n, m);
Gx = randn(n, 1);
for k = 1:3
tic
L = Gx .* phi;
toc
end
Gx(1) = NaN;
for k = 1:3
tic
L = Gx .* phi;
toc
end
Now consider the output on my macbook pro M1 running Matlab 2024a (so through rosetta).
Elapsed time is 0.001591 seconds.
Elapsed time is 0.000291 seconds.
Elapsed time is 0.000282 seconds.
Elapsed time is 0.573762 seconds.
Elapsed time is 0.548177 seconds.
Elapsed time is 0.560880 seconds.
Notice the very large difference in computation times between the no-NaN version of Gx and the version that contains a single NaN value.
The solution is quite obvious, just remove the NaN values with your favorite method (isnan, isfinite, etc.). So this is not my question.
What intregues me is:
why the computation time changes so drastically? Consider this code:
clear; close all;
n = 1e6;
m = 1e3;
s = 1e-3;
p = round(s^2 * n * m);
I = randperm(n, p);
J = randperm(m, p);
phi = sparse(I, J, 1, n, m);
Gx = randn(n, 1);
for k = 1:3
tic
L = Gx .* phi;
toc
end
Gx(1) = NaN;
for k = 1:3
tic
L = Gx .* phi;
toc
end
Now consider the output on my macbook pro M1 running Matlab 2024a (so through rosetta).
Elapsed time is 0.001591 seconds.
Elapsed time is 0.000291 seconds.
Elapsed time is 0.000282 seconds.
Elapsed time is 0.573762 seconds.
Elapsed time is 0.548177 seconds.
Elapsed time is 0.560880 seconds.
Notice the very large difference in computation times between the no-NaN version of Gx and the version that contains a single NaN value.
The solution is quite obvious, just remove the NaN values with your favorite method (isnan, isfinite, etc.). So this is not my question.
What intregues me is:
why the computation time changes so drastically? sparse, mtimes MATLAB Answers — New Questions
help with a heat map
Hello, I have been trying to create a heat map with the following characteristics: variation of the magnitude of the increase in vertical effort in a mesh every 1 cm for point, linear, and distributed rectangular loads. I am a civil engineer and hope you can help me.heat mapHello, I have been trying to create a heat map with the following characteristics: variation of the magnitude of the increase in vertical effort in a mesh every 1 cm for point, linear, and distributed rectangular loads. I am a civil engineer and hope you can help me.heat map Hello, I have been trying to create a heat map with the following characteristics: variation of the magnitude of the increase in vertical effort in a mesh every 1 cm for point, linear, and distributed rectangular loads. I am a civil engineer and hope you can help me.heat map heat map MATLAB Answers — New Questions
Sending Emails with MATLAB
Hello,
I am currently running a script in matlab that sends an email out when it is through with a .pdf attachment. This was working flawlessly two days ago and now I can’t seem to get it to work.
I am recieving the following error message:
Error using sendmail (line 175)
530 5.7.57 Client not authenticated to send mail. [BLAP220CA0019.NAMP220.PROD.OUTLOOK.COM]
Here is my code:
mail = ’email@address.com’;   % false email for forum
password = ‘password’;     % false pass for forum
mailingList = {‘people@email.com’}; % false email for forum
server = ‘smtp-mail.outlook.com’;
props = java.lang.System.getProperties;
props.setProperty(‘mail.smtp.port’,’587′);
props.setProperty(‘mail.smtp.starttls.enable’,’true’);
setpref(‘Internet’,’E_mail’,mail);
setpref(‘Internet’,’SMTP_Server’,server);
setpref(‘Internet’,’SMTP_Username’,mail);
setpref(‘Internet’,’SMTP_Password’,password);
messageBody = sprintf(‘   Good morning team!’);
messageBody = sprintf(‘%snn   Here is the data analysis from yesterdays data. Have a great day!’, messageBody);
messageBody = sprintf(‘%snn   – Brian Gregory’, messageBody);
messageBody = sprintf(‘%snnn   *This email was generated and sent automatically via MATLAB’, messageBody);
sendmail(mailingList, …
"Data Analysis – "+date, …
messageBody,fileDir7);Hello,
I am currently running a script in matlab that sends an email out when it is through with a .pdf attachment. This was working flawlessly two days ago and now I can’t seem to get it to work.
I am recieving the following error message:
Error using sendmail (line 175)
530 5.7.57 Client not authenticated to send mail. [BLAP220CA0019.NAMP220.PROD.OUTLOOK.COM]
Here is my code:
mail = ’email@address.com’;   % false email for forum
password = ‘password’;     % false pass for forum
mailingList = {‘people@email.com’}; % false email for forum
server = ‘smtp-mail.outlook.com’;
props = java.lang.System.getProperties;
props.setProperty(‘mail.smtp.port’,’587′);
props.setProperty(‘mail.smtp.starttls.enable’,’true’);
setpref(‘Internet’,’E_mail’,mail);
setpref(‘Internet’,’SMTP_Server’,server);
setpref(‘Internet’,’SMTP_Username’,mail);
setpref(‘Internet’,’SMTP_Password’,password);
messageBody = sprintf(‘   Good morning team!’);
messageBody = sprintf(‘%snn   Here is the data analysis from yesterdays data. Have a great day!’, messageBody);
messageBody = sprintf(‘%snn   – Brian Gregory’, messageBody);
messageBody = sprintf(‘%snnn   *This email was generated and sent automatically via MATLAB’, messageBody);
sendmail(mailingList, …
"Data Analysis – "+date, …
messageBody,fileDir7); Hello,
I am currently running a script in matlab that sends an email out when it is through with a .pdf attachment. This was working flawlessly two days ago and now I can’t seem to get it to work.
I am recieving the following error message:
Error using sendmail (line 175)
530 5.7.57 Client not authenticated to send mail. [BLAP220CA0019.NAMP220.PROD.OUTLOOK.COM]
Here is my code:
mail = ’email@address.com’;   % false email for forum
password = ‘password’;     % false pass for forum
mailingList = {‘people@email.com’}; % false email for forum
server = ‘smtp-mail.outlook.com’;
props = java.lang.System.getProperties;
props.setProperty(‘mail.smtp.port’,’587′);
props.setProperty(‘mail.smtp.starttls.enable’,’true’);
setpref(‘Internet’,’E_mail’,mail);
setpref(‘Internet’,’SMTP_Server’,server);
setpref(‘Internet’,’SMTP_Username’,mail);
setpref(‘Internet’,’SMTP_Password’,password);
messageBody = sprintf(‘   Good morning team!’);
messageBody = sprintf(‘%snn   Here is the data analysis from yesterdays data. Have a great day!’, messageBody);
messageBody = sprintf(‘%snn   – Brian Gregory’, messageBody);
messageBody = sprintf(‘%snnn   *This email was generated and sent automatically via MATLAB’, messageBody);
sendmail(mailingList, …
"Data Analysis – "+date, …
messageBody,fileDir7); email, error, matlab MATLAB Answers — New Questions










