Month: March 2025
How the Google-Wiz acquisition redefines cloud security
Google’s acquisition of Wiz, announced last week, is a pivotal moment as it marks a strategic shift in how cyber security will evolve over the next few years. It instantly turns Google into a major player in security, adding Wiz to other building blocks Google has racked up in the past couple of years, most notably Mandiant and Google Chronicle.
Google’s acquisition of Wiz, announced last week, is a pivotal moment as it marks a strategic shift in how cyber security will evolve over the next few years. It instantly turns Google into a major player in security, adding Wiz to other building blocks Google has racked up in the past couple of years, most notably Mandiant and Google Chronicle.
Read More
Why this error is occuring while deploying in ROS2?
Hey all, I am trying to deploy in a ROS2 device from Simulink. I keep facing this error. FYI, the device being deployed in is Intel Nuc. It is being deployed through Wi-Fi. I also deployed in another ROS2 machine without any error therefore the Simulink model has no error by design. Please don’t hesitate to ask for further information. Glad to provide to solve the issue.Hey all, I am trying to deploy in a ROS2 device from Simulink. I keep facing this error. FYI, the device being deployed in is Intel Nuc. It is being deployed through Wi-Fi. I also deployed in another ROS2 machine without any error therefore the Simulink model has no error by design. Please don’t hesitate to ask for further information. Glad to provide to solve the issue. Hey all, I am trying to deploy in a ROS2 device from Simulink. I keep facing this error. FYI, the device being deployed in is Intel Nuc. It is being deployed through Wi-Fi. I also deployed in another ROS2 machine without any error therefore the Simulink model has no error by design. Please don’t hesitate to ask for further information. Glad to provide to solve the issue. ros2, simulink MATLAB Answers — New Questions
When I import a Creo model to Simscape Multibody, some of my reference frames are not being imported. Is there something I need to do in Creo or in Simscape?
I have imported a Creo model via the multibody link to Simscape. When I open the model in Mechanics Explorer, the model itself has been imported correctly, but not all the reference frames are imported (I set reference frames at the desired locations in Creo). I want my reference point at a specific location on my model so that I can measure the position (x, y, z). How can I ensure that all reference frames are imported correctly and set a reference point at a specific location?I have imported a Creo model via the multibody link to Simscape. When I open the model in Mechanics Explorer, the model itself has been imported correctly, but not all the reference frames are imported (I set reference frames at the desired locations in Creo). I want my reference point at a specific location on my model so that I can measure the position (x, y, z). How can I ensure that all reference frames are imported correctly and set a reference point at a specific location? I have imported a Creo model via the multibody link to Simscape. When I open the model in Mechanics Explorer, the model itself has been imported correctly, but not all the reference frames are imported (I set reference frames at the desired locations in Creo). I want my reference point at a specific location on my model so that I can measure the position (x, y, z). How can I ensure that all reference frames are imported correctly and set a reference point at a specific location? multibody link MATLAB Answers — New Questions
How to perform definite integration with non-commutable symbolic coefficients?
Hi All,
I am trying to perform a definite integration in X (length axis) to calculate some beam modeshapes, following this the variables will be passed into a time integration using ode45. In the integration there are beam modeshape terms (W) which are a function of x and there are time dependent terms (qw) which are not. Crucially the qw terms are not commutable so cannot be factored out of the integrals. I need the answer to W6 to be given in terms W6=Y1*qw1+Y2*qw2… where Y1 and Y2 are numerical coefficients.
Here is my code:
clear all
clc
syms x qw1 qw2
L=0.52;
qw=[qw1; qw2];
%Bending Mode
Landa=[1.875104069 4.694091133];% 7.854757];% 10.99554];
for j=1:length(Landa)
SIGMA(j)=(cos(Landa(j))+cosh(Landa(j)))/(sin(Landa(j))+sinh(Landa(j)));
W(j)=cosh(Landa(j)*x/L)-cos(Landa(j)*x/L)-SIGMA(j)*(sinh(Landa(j)*x/L)-sin(Landa(j)*x/L));
end
% Integration in X over length of beam
W6=(vpaintegral(W*diff(diff(W,x,1)*qw*diff(diff(W,x,1)*qw*diff(W,x,2)*qw,x,1),x,1),0,L));
The value W6 is left as symbolic without the integrals being solved, this means that when I pass the W6 term into the time integration in a separate script and solve for qw terms the time integration is much slower because it is computing the spatial integration in X for each time of the 1000 time-steps.
I have tried using the ‘double’,’simplify’ and ‘collect’ commands but I have not been able to get the result in the form I want it. So what I’m asking is, is there a way to "force" matlab to do the integrations with the symbolic coefficients attahced. Any help would be much appreciated!Hi All,
I am trying to perform a definite integration in X (length axis) to calculate some beam modeshapes, following this the variables will be passed into a time integration using ode45. In the integration there are beam modeshape terms (W) which are a function of x and there are time dependent terms (qw) which are not. Crucially the qw terms are not commutable so cannot be factored out of the integrals. I need the answer to W6 to be given in terms W6=Y1*qw1+Y2*qw2… where Y1 and Y2 are numerical coefficients.
Here is my code:
clear all
clc
syms x qw1 qw2
L=0.52;
qw=[qw1; qw2];
%Bending Mode
Landa=[1.875104069 4.694091133];% 7.854757];% 10.99554];
for j=1:length(Landa)
SIGMA(j)=(cos(Landa(j))+cosh(Landa(j)))/(sin(Landa(j))+sinh(Landa(j)));
W(j)=cosh(Landa(j)*x/L)-cos(Landa(j)*x/L)-SIGMA(j)*(sinh(Landa(j)*x/L)-sin(Landa(j)*x/L));
end
% Integration in X over length of beam
W6=(vpaintegral(W*diff(diff(W,x,1)*qw*diff(diff(W,x,1)*qw*diff(W,x,2)*qw,x,1),x,1),0,L));
The value W6 is left as symbolic without the integrals being solved, this means that when I pass the W6 term into the time integration in a separate script and solve for qw terms the time integration is much slower because it is computing the spatial integration in X for each time of the 1000 time-steps.
I have tried using the ‘double’,’simplify’ and ‘collect’ commands but I have not been able to get the result in the form I want it. So what I’m asking is, is there a way to "force" matlab to do the integrations with the symbolic coefficients attahced. Any help would be much appreciated! Hi All,
I am trying to perform a definite integration in X (length axis) to calculate some beam modeshapes, following this the variables will be passed into a time integration using ode45. In the integration there are beam modeshape terms (W) which are a function of x and there are time dependent terms (qw) which are not. Crucially the qw terms are not commutable so cannot be factored out of the integrals. I need the answer to W6 to be given in terms W6=Y1*qw1+Y2*qw2… where Y1 and Y2 are numerical coefficients.
Here is my code:
clear all
clc
syms x qw1 qw2
L=0.52;
qw=[qw1; qw2];
%Bending Mode
Landa=[1.875104069 4.694091133];% 7.854757];% 10.99554];
for j=1:length(Landa)
SIGMA(j)=(cos(Landa(j))+cosh(Landa(j)))/(sin(Landa(j))+sinh(Landa(j)));
W(j)=cosh(Landa(j)*x/L)-cos(Landa(j)*x/L)-SIGMA(j)*(sinh(Landa(j)*x/L)-sin(Landa(j)*x/L));
end
% Integration in X over length of beam
W6=(vpaintegral(W*diff(diff(W,x,1)*qw*diff(diff(W,x,1)*qw*diff(W,x,2)*qw,x,1),x,1),0,L));
The value W6 is left as symbolic without the integrals being solved, this means that when I pass the W6 term into the time integration in a separate script and solve for qw terms the time integration is much slower because it is computing the spatial integration in X for each time of the 1000 time-steps.
I have tried using the ‘double’,’simplify’ and ‘collect’ commands but I have not been able to get the result in the form I want it. So what I’m asking is, is there a way to "force" matlab to do the integrations with the symbolic coefficients attahced. Any help would be much appreciated! definite integration, symbolic toolbox, simplifying MATLAB Answers — New Questions
Non-linear scaling for linear increase in complexity
I have a class which defines an array and then loops over this array updating each element in turn. If I change the length of the array linearly the runtime increases non-linearly. Why? I must be missing something silly.
classdef C
properties
N uint32 {mustBeInteger, mustBePositive}
x (1, 🙂 {mustBeFloat, mustBeNonnegative} = []
end
methods
function c = C(N)
arguments
N uint32 {mustBeInteger, mustBePositive}
end
c.N = N;
c.x = zeros(1, c.N);
end
function run(c)
arguments
c C
end
for i = 1:c.N
c.x(i) = 1;
end
end
end
end
N_range = 1e4:1e4:1e5;
times = zeros(1, length(N_range));
N_i = 1;
for N = N_range
c = C(N);
tic
c.run();
times(N_i) = toc;
N_i = N_i + 1;
end
plot(times)I have a class which defines an array and then loops over this array updating each element in turn. If I change the length of the array linearly the runtime increases non-linearly. Why? I must be missing something silly.
classdef C
properties
N uint32 {mustBeInteger, mustBePositive}
x (1, 🙂 {mustBeFloat, mustBeNonnegative} = []
end
methods
function c = C(N)
arguments
N uint32 {mustBeInteger, mustBePositive}
end
c.N = N;
c.x = zeros(1, c.N);
end
function run(c)
arguments
c C
end
for i = 1:c.N
c.x(i) = 1;
end
end
end
end
N_range = 1e4:1e4:1e5;
times = zeros(1, length(N_range));
N_i = 1;
for N = N_range
c = C(N);
tic
c.run();
times(N_i) = toc;
N_i = N_i + 1;
end
plot(times) I have a class which defines an array and then loops over this array updating each element in turn. If I change the length of the array linearly the runtime increases non-linearly. Why? I must be missing something silly.
classdef C
properties
N uint32 {mustBeInteger, mustBePositive}
x (1, 🙂 {mustBeFloat, mustBeNonnegative} = []
end
methods
function c = C(N)
arguments
N uint32 {mustBeInteger, mustBePositive}
end
c.N = N;
c.x = zeros(1, c.N);
end
function run(c)
arguments
c C
end
for i = 1:c.N
c.x(i) = 1;
end
end
end
end
N_range = 1e4:1e4:1e5;
times = zeros(1, length(N_range));
N_i = 1;
for N = N_range
c = C(N);
tic
c.run();
times(N_i) = toc;
N_i = N_i + 1;
end
plot(times) complexity, validation, overhead, speed, performance MATLAB Answers — New Questions
I have this system of linear equations and i need to solve it for unknowns. how i can solve it in MATLAB? we have 8 unknowns and 8 equations.
$$
begin{aligned}
& b_{0}^{l}=a_{0}^{l} A_{00}^{l}+sum_{n=a_{n}}^{infty} a_{n}^{l} A_{0} n^{ell}+Z_{0}^{l} \
& b_{m}^{l}=a_{0}^{l} A_{m 0}^{l}+sum_{n=1}^{infty} a_{n}^{l} A_{m n}^{l}+Z_{m}^{l} \
& a_{0}^{l}=b_{0}^{l} B_{00}^{l}+sum_{m=1}^{infty} b_{m}{ }^{l} B_{0 m}^{l}+c_{0}^{l} C_{00}^{l}+sum_{m=1}^{infty} c_{m}^{l} C_{0 m}^{l}+Y_{0}^{l} \
& a_{n}^{l}=b_{0}^{l} B_{n 0}^{l}+sum_{m=1}^{infty} b_{m}^{l} B_{n m}^{l}+c_{0}^{l} C_{n 0}^{l}+sum_{m=1}^{infty} c_{m}^{l} C_{n m}^{l}+Y_{n}^{l}
end{aligned}
$$
and:
$$
begin{aligned}
& c_{0}^{l}=d_{0}^{l} D_{00}^{ell}+sum_{n=1}^{infty} d_{n}^{l} D_{0 n}^{l}+X_{0}^{l} \
& c_{m}^{l}=d_{0}^{l} D_{m 0}^{ell}+sum_{n=1}^{infty} d_{n}^{l} D_{m n}^{ell}+X_{m}^{ell} \
& d_{0}^{ell} = b_{0}^{l} E_{00}^{ell}+sum_{m=1}^{infty} b_{m}^{ell} E_{0 m}^{l}+c_{0}^{l} F_{00}^{l}+sum_{m=1}^{infty} c_{m}^{l} F_{0 m}^{l}+W_{0}^{l} \
& d_{n}^{l}=b_{0}^{l} E_{n 0}^{l}+sum_{m=1}^{infty} b_{m}^{l} E_{n m}^{l}+c_{0}^{l} F_{n 0}^{l}+sum_{m=1}^{infty} c_{m}^{l} F_{n m}^{l}+W_{n}^{l}
end{aligned}
$$
Unknowns are:-
$$
begin{gathered}
left(a_{0}^{l}, a_{n}^{l}right) ;left(b_{0}^{l}, b_{n}^{l}right),left(c_{0}^{l}, c_{n}^{l}right) and \
left(d_{0}^{l}, d_{n}^{l}right) .
end{gathered}
$$
The above system of equations which is linear one is the latex code for these equations and i need to solve it for these unknowns. I am confused that how i can solved this system. how i can write these equations in matrix form to solved it for the unknowns? Help me.$$
begin{aligned}
& b_{0}^{l}=a_{0}^{l} A_{00}^{l}+sum_{n=a_{n}}^{infty} a_{n}^{l} A_{0} n^{ell}+Z_{0}^{l} \
& b_{m}^{l}=a_{0}^{l} A_{m 0}^{l}+sum_{n=1}^{infty} a_{n}^{l} A_{m n}^{l}+Z_{m}^{l} \
& a_{0}^{l}=b_{0}^{l} B_{00}^{l}+sum_{m=1}^{infty} b_{m}{ }^{l} B_{0 m}^{l}+c_{0}^{l} C_{00}^{l}+sum_{m=1}^{infty} c_{m}^{l} C_{0 m}^{l}+Y_{0}^{l} \
& a_{n}^{l}=b_{0}^{l} B_{n 0}^{l}+sum_{m=1}^{infty} b_{m}^{l} B_{n m}^{l}+c_{0}^{l} C_{n 0}^{l}+sum_{m=1}^{infty} c_{m}^{l} C_{n m}^{l}+Y_{n}^{l}
end{aligned}
$$
and:
$$
begin{aligned}
& c_{0}^{l}=d_{0}^{l} D_{00}^{ell}+sum_{n=1}^{infty} d_{n}^{l} D_{0 n}^{l}+X_{0}^{l} \
& c_{m}^{l}=d_{0}^{l} D_{m 0}^{ell}+sum_{n=1}^{infty} d_{n}^{l} D_{m n}^{ell}+X_{m}^{ell} \
& d_{0}^{ell} = b_{0}^{l} E_{00}^{ell}+sum_{m=1}^{infty} b_{m}^{ell} E_{0 m}^{l}+c_{0}^{l} F_{00}^{l}+sum_{m=1}^{infty} c_{m}^{l} F_{0 m}^{l}+W_{0}^{l} \
& d_{n}^{l}=b_{0}^{l} E_{n 0}^{l}+sum_{m=1}^{infty} b_{m}^{l} E_{n m}^{l}+c_{0}^{l} F_{n 0}^{l}+sum_{m=1}^{infty} c_{m}^{l} F_{n m}^{l}+W_{n}^{l}
end{aligned}
$$
Unknowns are:-
$$
begin{gathered}
left(a_{0}^{l}, a_{n}^{l}right) ;left(b_{0}^{l}, b_{n}^{l}right),left(c_{0}^{l}, c_{n}^{l}right) and \
left(d_{0}^{l}, d_{n}^{l}right) .
end{gathered}
$$
The above system of equations which is linear one is the latex code for these equations and i need to solve it for these unknowns. I am confused that how i can solved this system. how i can write these equations in matrix form to solved it for the unknowns? Help me. $$
begin{aligned}
& b_{0}^{l}=a_{0}^{l} A_{00}^{l}+sum_{n=a_{n}}^{infty} a_{n}^{l} A_{0} n^{ell}+Z_{0}^{l} \
& b_{m}^{l}=a_{0}^{l} A_{m 0}^{l}+sum_{n=1}^{infty} a_{n}^{l} A_{m n}^{l}+Z_{m}^{l} \
& a_{0}^{l}=b_{0}^{l} B_{00}^{l}+sum_{m=1}^{infty} b_{m}{ }^{l} B_{0 m}^{l}+c_{0}^{l} C_{00}^{l}+sum_{m=1}^{infty} c_{m}^{l} C_{0 m}^{l}+Y_{0}^{l} \
& a_{n}^{l}=b_{0}^{l} B_{n 0}^{l}+sum_{m=1}^{infty} b_{m}^{l} B_{n m}^{l}+c_{0}^{l} C_{n 0}^{l}+sum_{m=1}^{infty} c_{m}^{l} C_{n m}^{l}+Y_{n}^{l}
end{aligned}
$$
and:
$$
begin{aligned}
& c_{0}^{l}=d_{0}^{l} D_{00}^{ell}+sum_{n=1}^{infty} d_{n}^{l} D_{0 n}^{l}+X_{0}^{l} \
& c_{m}^{l}=d_{0}^{l} D_{m 0}^{ell}+sum_{n=1}^{infty} d_{n}^{l} D_{m n}^{ell}+X_{m}^{ell} \
& d_{0}^{ell} = b_{0}^{l} E_{00}^{ell}+sum_{m=1}^{infty} b_{m}^{ell} E_{0 m}^{l}+c_{0}^{l} F_{00}^{l}+sum_{m=1}^{infty} c_{m}^{l} F_{0 m}^{l}+W_{0}^{l} \
& d_{n}^{l}=b_{0}^{l} E_{n 0}^{l}+sum_{m=1}^{infty} b_{m}^{l} E_{n m}^{l}+c_{0}^{l} F_{n 0}^{l}+sum_{m=1}^{infty} c_{m}^{l} F_{n m}^{l}+W_{n}^{l}
end{aligned}
$$
Unknowns are:-
$$
begin{gathered}
left(a_{0}^{l}, a_{n}^{l}right) ;left(b_{0}^{l}, b_{n}^{l}right),left(c_{0}^{l}, c_{n}^{l}right) and \
left(d_{0}^{l}, d_{n}^{l}right) .
end{gathered}
$$
The above system of equations which is linear one is the latex code for these equations and i need to solve it for these unknowns. I am confused that how i can solved this system. how i can write these equations in matrix form to solved it for the unknowns? Help me. system of equations MATLAB Answers — New Questions
Why Teams Clients Prompt for Your Location
Location Privacy Setting for Teams is Now Separate to Windows
If you wonder why Teams has suddenly started to prompt for approval to use your precise location and location history when you sign into a client, the answer lies in message center notification MC993226 (last updated 7 March 2025). It’s all to do with an update to Microsoft privacy policies governing how apps can use location information. Microsoft refers to this as a “location consent experience” which applies to Windows (running version 24H2 or later) and Mac workstations, but not VDI clients.
Take the example shown in Figure 1. Teams knows that the location setting for the Windows PC permits location information to be shared with IT admins to help troubleshoot issues like network connectivity (Figure 2). Until the change became effective, Teams used the Windows setting, but now Teams has its setting to govern whether it can access location data.


VDI desktops obviously don’t support the same level of precision when it comes to location data, which is why they’re currently excluded from location privacy. For more information about how to manage location sharing in Teams, see the Microsoft support documentation.
Targeted release has started, and general availability is slated for deployment between late March and early April 2025. The update will be available in the commercial and government clouds. Microsoft notes that the new location privacy consent “does not apply to fully managed devices where users are restricted from user granted location access” and that current policies will continue working as before.
Location Privacy is a Per Tenant Choice
Teams displays the location notice for each tenant accessed during a client session. For instance, if you switch from your home tenant to a tenant where you’re a guest member, Teams displays the location notice again. The reason is that the location information gathered by Teams is provided on a tenant basis, so the notice acts as a prompt for the user to disable the information in the Privacy section of the Teams settings app (Figure 3).

Location Data for Teams
MC993226 says that Teams is specifically interested in the SSID and BSSID. The SSID (service set identifier or network name) is the identifier for a Wi-Fi network. The BSSID (Basic service set identifier) is the MAC address of the network access point or Wi-Fi router used by a device to connect to a network.
Teams uses this information for the Call Quality Dashboard to track call quality at the organization level. Knowing someone’s location is also critical for location-based call routing to work. The data is also used for dynamic emergency calling in Teams Phone to allow the location of emergency calls to be identified. If your organization doesn’t have a Teams Phone subscription and a calling plan, you won’t have access to emergency calling. On the surface, if you don’t use Teams Phone, it seems like you don’t need to worry about location privacy.
Microsoft hasn’t given a firm number for Teams Phone users since July 2021 when they said that 80 million people used Teams Phone. However, although Microsoft has been nudging customers to use Teams Phone for years, the reported number doesn’t say how many users have paid calling plans instead of just using Teams Phone for VOIP calls.
Location Privacy is Important
Obviously, Microsoft would like users to consent to sharing location data with Teams as otherwise features won’t work as designed. I don’t think that anyone will complain too much about location data being shared with Teams to measure the quality of calls or to know where someone is when they make an emergency call. Using location data for other purposes, such as knowing the hot desk that someone is working at might be another matter, which is why keeping an eye on location privacy is important.
Learn how to exploit the data available to Microsoft 365 tenant administrators through the Office 365 for IT Pros eBook. We love figuring out how things work.
How can i change rotation axis?
Rotation axis normally defined axis around Z,I want to rotate my modal around x and y axis how can i change rotation axis of the revolute joint?
ThanksRotation axis normally defined axis around Z,I want to rotate my modal around x and y axis how can i change rotation axis of the revolute joint?
Thanks Rotation axis normally defined axis around Z,I want to rotate my modal around x and y axis how can i change rotation axis of the revolute joint?
Thanks rotation, axis, simmechanics MATLAB Answers — New Questions
How do I find the number of circles in an image? I’ve given the code I used and output image below
clc;
close all;
clear all;
a=imread(‘C:UsersHemaDesktopnonemptylot.jpg’);
b=imread(‘C:UsersHemaDesktopemptylot.jpg’);
[x,y]= size(a);
[c d]=size(b);
e=rgb2hsv(a);
f=rgb2hsv(b);
subplot(1,2,1)
imshow(e);
title(‘HSV of Nonempty’);
centers = imfindcircles(e,[20 20]);
[centers,radii] = imfindcircles(e,[5 15]);
[centers,radii,metric] = imfindcircles(e,[5 15]);
BW=size(viscircles(centers, radii,’EdgeColor’,’b’));
STATS = regionprops(BW,’EquivDiameter’);
subplot(1,2,2)
imshow(f);
title(‘HSV of empty’);
centers = imfindcircles(f,[20 20]);
[centers,radii] = imfindcircles(f,[5 15]);
[centers,radii,metric] = imfindcircles(f,[5 15]);
BW=size(viscircles(centers, radii,’EdgeColor’,’b’));
STATS = regionprops(BW,’EquivDiameter’);
disp(STATS);clc;
close all;
clear all;
a=imread(‘C:UsersHemaDesktopnonemptylot.jpg’);
b=imread(‘C:UsersHemaDesktopemptylot.jpg’);
[x,y]= size(a);
[c d]=size(b);
e=rgb2hsv(a);
f=rgb2hsv(b);
subplot(1,2,1)
imshow(e);
title(‘HSV of Nonempty’);
centers = imfindcircles(e,[20 20]);
[centers,radii] = imfindcircles(e,[5 15]);
[centers,radii,metric] = imfindcircles(e,[5 15]);
BW=size(viscircles(centers, radii,’EdgeColor’,’b’));
STATS = regionprops(BW,’EquivDiameter’);
subplot(1,2,2)
imshow(f);
title(‘HSV of empty’);
centers = imfindcircles(f,[20 20]);
[centers,radii] = imfindcircles(f,[5 15]);
[centers,radii,metric] = imfindcircles(f,[5 15]);
BW=size(viscircles(centers, radii,’EdgeColor’,’b’));
STATS = regionprops(BW,’EquivDiameter’);
disp(STATS); clc;
close all;
clear all;
a=imread(‘C:UsersHemaDesktopnonemptylot.jpg’);
b=imread(‘C:UsersHemaDesktopemptylot.jpg’);
[x,y]= size(a);
[c d]=size(b);
e=rgb2hsv(a);
f=rgb2hsv(b);
subplot(1,2,1)
imshow(e);
title(‘HSV of Nonempty’);
centers = imfindcircles(e,[20 20]);
[centers,radii] = imfindcircles(e,[5 15]);
[centers,radii,metric] = imfindcircles(e,[5 15]);
BW=size(viscircles(centers, radii,’EdgeColor’,’b’));
STATS = regionprops(BW,’EquivDiameter’);
subplot(1,2,2)
imshow(f);
title(‘HSV of empty’);
centers = imfindcircles(f,[20 20]);
[centers,radii] = imfindcircles(f,[5 15]);
[centers,radii,metric] = imfindcircles(f,[5 15]);
BW=size(viscircles(centers, radii,’EdgeColor’,’b’));
STATS = regionprops(BW,’EquivDiameter’);
disp(STATS); circles, finding number of objects, image processing MATLAB Answers — New Questions
How to put a legend outside of a tiled layout graph?
I am trying to create some graphs, and I am struggling to put the legend where I want it in my graph. I would like my graph to look like this:
However, the code that i have wrtiien:
%%% plot mean and SD:
s = sprintf(‘[%c]’, char(176)); % degree angle symbol
figure
title(‘Mean and SD’)
ax1=subplot(4,1,1);
fontsize=get(ax1, ‘FontSize’);
title(‘Start’)
hold on
[m,n] = size(DATA1start);
xaxis=repmat(1:101, n, 1);
scatter(xaxis,DATA1start’,2,’MarkerFaceColor’,"#228b22",’MarkerEdgeColor’,"#228b22", ‘MarkerFaceAlpha’,.3,’MarkerEdgeAlpha’,.3)
[m,n] = size(DATA2start);
xaxis=repmat(1:101, n, 1);
scatter(xaxis,DATA2start’,2,’MarkerFaceColor’,"#395dc7",’MarkerEdgeColor’,"#395dc7", ‘MarkerFaceAlpha’,.3,’MarkerEdgeAlpha’,.3)%stdshade(DATA2start’,’0.3′,’b’)
hold on
[m,n] = size(DATA3start);
xaxis=repmat(1:101, n, 1);
scatter(xaxis,DATA3start’,2,’MarkerFaceColor’,"#f88f09",’MarkerEdgeColor’,"#f88f09", ‘MarkerFaceAlpha’,.3,’MarkerEdgeAlpha’,.3)
hold on
scatter(1:101,mean(DATA1start’,’omitnan’),10,’MarkerFaceColor’,"#228b22",’MarkerEdgeColor’,"#228b22")
hold on
scatter(1:101,mean(DATA2start’,’omitnan’),10,’MarkerFaceColor’,"#395dc7",’MarkerEdgeColor’,"#395dc7")
hold on
scatter(1:101,mean(DATA3start’,’omitnan’),10,’MarkerFaceColor’,"#f88f09",’MarkerEdgeColor’,"#f88f09")
ylabel([‘Angular Difference’, s])
xlabel([‘Percentage of gait cycle (%)’])
xlim([0 100])
ylim([0 60])
% Create fake points for the legend
hFakeDATA1 = plot(NaN, NaN, ‘o’, ‘MarkerFaceColor’, "#228b22", ‘MarkerEdgeColor’, "#228b22", ‘MarkerSize’, 5);
hFakeDATA2 = plot(NaN, NaN, ‘o’, ‘MarkerFaceColor’, "#395dc7", ‘MarkerEdgeColor’, "#395dc7", ‘MarkerSize’, 5);
hFakeDATA3 = plot(NaN, NaN, ‘o’, ‘MarkerFaceColor’, "#f88f09", ‘MarkerEdgeColor’, "#f88f09", ‘MarkerSize’, 5);
% Create fake entry for the shaded region
hShadedRegion = plot(NaN, NaN, ‘s’, ‘MarkerFaceColor’, [0.7 0.7 0.7], ‘MarkerEdgeColor’, ‘none’, ‘MarkerSize’, 8);
% Create custom legend with the fake points
legend([hFakeDATA1, hFakeDATA2, hFakeDATA3, hShadedRegion], …
{‘DATA1’, ‘DATA2’, ‘DATA3’, ‘Main effect of group’}, ‘Location’, ‘bestoutside’);
subplot(4,1,2)
title(‘Middle’)
hold on
[m,n] = size(DATA1middle);
xaxis=repmat(1:101, n, 1);
scatter(xaxis,DATA1middle’,2,’MarkerFaceColor’,"#228b22",’MarkerEdgeColor’,"#228b22", ‘MarkerFaceAlpha’,.3,’MarkerEdgeAlpha’,.3)
[m,n] = size(DATA2middle);
xaxis=repmat(1:101, n, 1);
scatter(xaxis,DATA2middle’,2,’MarkerFaceColor’,"#395dc7",’MarkerEdgeColor’,"#395dc7", ‘MarkerFaceAlpha’,.3,’MarkerEdgeAlpha’,.3)%stdshade(DATA2start’,’0.3′,’b’)
hold on
[m,n] = size(DATA3middle);
xaxis=repmat(1:101, n, 1);
scatter(xaxis,DATA3middle’,2,’MarkerFaceColor’,"#f88f09",’MarkerEdgeColor’,"#f88f09", ‘MarkerFaceAlpha’,.3,’MarkerEdgeAlpha’,.3)
hold on
scatter(1:101,mean(DATA1middle’,’omitnan’),10,’MarkerFaceColor’,"#228b22",’MarkerEdgeColor’,"#228b22")
hold on
scatter(1:101,mean(DATA2middle’,’omitnan’),10,’MarkerFaceColor’,"#395dc7",’MarkerEdgeColor’,"#395dc7")
hold on
scatter(1:101,mean(DATA3middle’,’omitnan’),10,’MarkerFaceColor’,"#f88f09",’MarkerEdgeColor’,"#f88f09")
ylabel([‘Angular Difference’, s])
xlabel([‘Percentage of gait cycle (%)’])
xlim([0 100])
ylim([0 60])
subplot(4,1,3)
title(‘End’)
hold on
[m,n] = size(DATA1last);
xaxis=repmat(1:101, n, 1);
scatter(xaxis,DATA1last’,2,’MarkerFaceColor’,"#228b22",’MarkerEdgeColor’,"#228b22", ‘MarkerFaceAlpha’,.3,’MarkerEdgeAlpha’,.3)
[m,n] = size(DATA2last);
xaxis=repmat(1:101, n, 1);
scatter(xaxis,DATA2last’,2,’MarkerFaceColor’,"#395dc7",’MarkerEdgeColor’,"#395dc7", ‘MarkerFaceAlpha’,.3,’MarkerEdgeAlpha’,.3)%stdshade(DATA2start’,’0.3′,’b’)
hold on
[m,n] = size(DATA3last);
xaxis=repmat(1:101, n, 1);
scatter(xaxis,DATA3last’,2,’MarkerFaceColor’,"#f88f09",’MarkerEdgeColor’,"#f88f09", ‘MarkerFaceAlpha’,.3,’MarkerEdgeAlpha’,.3)
hold on
scatter(1:101,mean(DATA1last’,’omitnan’),10,’MarkerFaceColor’,"#228b22",’MarkerEdgeColor’,"#228b22")
hold on
scatter(1:101,mean(DATA2last’,’omitnan’),10,’MarkerFaceColor’,"#395dc7",’MarkerEdgeColor’,"#395dc7")
hold on
scatter(1:101,mean(DATA3last’,’omitnan’),10,’MarkerFaceColor’,"#f88f09",’MarkerEdgeColor’,"#f88f09")
ylabel([‘Angular Difference’, s])
xlabel([‘Percentage of gait cycle (%)’])
xlim([0 100])
ylim([0 60])
Provides me with the graph shown here. I can’t seem to put the legend in the correct place ( I have moved the block of code around to create the legend before and after each graph, but with no success). I would like the legend to be outside of all the tiles! Any advice would be much appreciated :)I am trying to create some graphs, and I am struggling to put the legend where I want it in my graph. I would like my graph to look like this:
However, the code that i have wrtiien:
%%% plot mean and SD:
s = sprintf(‘[%c]’, char(176)); % degree angle symbol
figure
title(‘Mean and SD’)
ax1=subplot(4,1,1);
fontsize=get(ax1, ‘FontSize’);
title(‘Start’)
hold on
[m,n] = size(DATA1start);
xaxis=repmat(1:101, n, 1);
scatter(xaxis,DATA1start’,2,’MarkerFaceColor’,"#228b22",’MarkerEdgeColor’,"#228b22", ‘MarkerFaceAlpha’,.3,’MarkerEdgeAlpha’,.3)
[m,n] = size(DATA2start);
xaxis=repmat(1:101, n, 1);
scatter(xaxis,DATA2start’,2,’MarkerFaceColor’,"#395dc7",’MarkerEdgeColor’,"#395dc7", ‘MarkerFaceAlpha’,.3,’MarkerEdgeAlpha’,.3)%stdshade(DATA2start’,’0.3′,’b’)
hold on
[m,n] = size(DATA3start);
xaxis=repmat(1:101, n, 1);
scatter(xaxis,DATA3start’,2,’MarkerFaceColor’,"#f88f09",’MarkerEdgeColor’,"#f88f09", ‘MarkerFaceAlpha’,.3,’MarkerEdgeAlpha’,.3)
hold on
scatter(1:101,mean(DATA1start’,’omitnan’),10,’MarkerFaceColor’,"#228b22",’MarkerEdgeColor’,"#228b22")
hold on
scatter(1:101,mean(DATA2start’,’omitnan’),10,’MarkerFaceColor’,"#395dc7",’MarkerEdgeColor’,"#395dc7")
hold on
scatter(1:101,mean(DATA3start’,’omitnan’),10,’MarkerFaceColor’,"#f88f09",’MarkerEdgeColor’,"#f88f09")
ylabel([‘Angular Difference’, s])
xlabel([‘Percentage of gait cycle (%)’])
xlim([0 100])
ylim([0 60])
% Create fake points for the legend
hFakeDATA1 = plot(NaN, NaN, ‘o’, ‘MarkerFaceColor’, "#228b22", ‘MarkerEdgeColor’, "#228b22", ‘MarkerSize’, 5);
hFakeDATA2 = plot(NaN, NaN, ‘o’, ‘MarkerFaceColor’, "#395dc7", ‘MarkerEdgeColor’, "#395dc7", ‘MarkerSize’, 5);
hFakeDATA3 = plot(NaN, NaN, ‘o’, ‘MarkerFaceColor’, "#f88f09", ‘MarkerEdgeColor’, "#f88f09", ‘MarkerSize’, 5);
% Create fake entry for the shaded region
hShadedRegion = plot(NaN, NaN, ‘s’, ‘MarkerFaceColor’, [0.7 0.7 0.7], ‘MarkerEdgeColor’, ‘none’, ‘MarkerSize’, 8);
% Create custom legend with the fake points
legend([hFakeDATA1, hFakeDATA2, hFakeDATA3, hShadedRegion], …
{‘DATA1’, ‘DATA2’, ‘DATA3’, ‘Main effect of group’}, ‘Location’, ‘bestoutside’);
subplot(4,1,2)
title(‘Middle’)
hold on
[m,n] = size(DATA1middle);
xaxis=repmat(1:101, n, 1);
scatter(xaxis,DATA1middle’,2,’MarkerFaceColor’,"#228b22",’MarkerEdgeColor’,"#228b22", ‘MarkerFaceAlpha’,.3,’MarkerEdgeAlpha’,.3)
[m,n] = size(DATA2middle);
xaxis=repmat(1:101, n, 1);
scatter(xaxis,DATA2middle’,2,’MarkerFaceColor’,"#395dc7",’MarkerEdgeColor’,"#395dc7", ‘MarkerFaceAlpha’,.3,’MarkerEdgeAlpha’,.3)%stdshade(DATA2start’,’0.3′,’b’)
hold on
[m,n] = size(DATA3middle);
xaxis=repmat(1:101, n, 1);
scatter(xaxis,DATA3middle’,2,’MarkerFaceColor’,"#f88f09",’MarkerEdgeColor’,"#f88f09", ‘MarkerFaceAlpha’,.3,’MarkerEdgeAlpha’,.3)
hold on
scatter(1:101,mean(DATA1middle’,’omitnan’),10,’MarkerFaceColor’,"#228b22",’MarkerEdgeColor’,"#228b22")
hold on
scatter(1:101,mean(DATA2middle’,’omitnan’),10,’MarkerFaceColor’,"#395dc7",’MarkerEdgeColor’,"#395dc7")
hold on
scatter(1:101,mean(DATA3middle’,’omitnan’),10,’MarkerFaceColor’,"#f88f09",’MarkerEdgeColor’,"#f88f09")
ylabel([‘Angular Difference’, s])
xlabel([‘Percentage of gait cycle (%)’])
xlim([0 100])
ylim([0 60])
subplot(4,1,3)
title(‘End’)
hold on
[m,n] = size(DATA1last);
xaxis=repmat(1:101, n, 1);
scatter(xaxis,DATA1last’,2,’MarkerFaceColor’,"#228b22",’MarkerEdgeColor’,"#228b22", ‘MarkerFaceAlpha’,.3,’MarkerEdgeAlpha’,.3)
[m,n] = size(DATA2last);
xaxis=repmat(1:101, n, 1);
scatter(xaxis,DATA2last’,2,’MarkerFaceColor’,"#395dc7",’MarkerEdgeColor’,"#395dc7", ‘MarkerFaceAlpha’,.3,’MarkerEdgeAlpha’,.3)%stdshade(DATA2start’,’0.3′,’b’)
hold on
[m,n] = size(DATA3last);
xaxis=repmat(1:101, n, 1);
scatter(xaxis,DATA3last’,2,’MarkerFaceColor’,"#f88f09",’MarkerEdgeColor’,"#f88f09", ‘MarkerFaceAlpha’,.3,’MarkerEdgeAlpha’,.3)
hold on
scatter(1:101,mean(DATA1last’,’omitnan’),10,’MarkerFaceColor’,"#228b22",’MarkerEdgeColor’,"#228b22")
hold on
scatter(1:101,mean(DATA2last’,’omitnan’),10,’MarkerFaceColor’,"#395dc7",’MarkerEdgeColor’,"#395dc7")
hold on
scatter(1:101,mean(DATA3last’,’omitnan’),10,’MarkerFaceColor’,"#f88f09",’MarkerEdgeColor’,"#f88f09")
ylabel([‘Angular Difference’, s])
xlabel([‘Percentage of gait cycle (%)’])
xlim([0 100])
ylim([0 60])
Provides me with the graph shown here. I can’t seem to put the legend in the correct place ( I have moved the block of code around to create the legend before and after each graph, but with no success). I would like the legend to be outside of all the tiles! Any advice would be much appreciated 🙂 I am trying to create some graphs, and I am struggling to put the legend where I want it in my graph. I would like my graph to look like this:
However, the code that i have wrtiien:
%%% plot mean and SD:
s = sprintf(‘[%c]’, char(176)); % degree angle symbol
figure
title(‘Mean and SD’)
ax1=subplot(4,1,1);
fontsize=get(ax1, ‘FontSize’);
title(‘Start’)
hold on
[m,n] = size(DATA1start);
xaxis=repmat(1:101, n, 1);
scatter(xaxis,DATA1start’,2,’MarkerFaceColor’,"#228b22",’MarkerEdgeColor’,"#228b22", ‘MarkerFaceAlpha’,.3,’MarkerEdgeAlpha’,.3)
[m,n] = size(DATA2start);
xaxis=repmat(1:101, n, 1);
scatter(xaxis,DATA2start’,2,’MarkerFaceColor’,"#395dc7",’MarkerEdgeColor’,"#395dc7", ‘MarkerFaceAlpha’,.3,’MarkerEdgeAlpha’,.3)%stdshade(DATA2start’,’0.3′,’b’)
hold on
[m,n] = size(DATA3start);
xaxis=repmat(1:101, n, 1);
scatter(xaxis,DATA3start’,2,’MarkerFaceColor’,"#f88f09",’MarkerEdgeColor’,"#f88f09", ‘MarkerFaceAlpha’,.3,’MarkerEdgeAlpha’,.3)
hold on
scatter(1:101,mean(DATA1start’,’omitnan’),10,’MarkerFaceColor’,"#228b22",’MarkerEdgeColor’,"#228b22")
hold on
scatter(1:101,mean(DATA2start’,’omitnan’),10,’MarkerFaceColor’,"#395dc7",’MarkerEdgeColor’,"#395dc7")
hold on
scatter(1:101,mean(DATA3start’,’omitnan’),10,’MarkerFaceColor’,"#f88f09",’MarkerEdgeColor’,"#f88f09")
ylabel([‘Angular Difference’, s])
xlabel([‘Percentage of gait cycle (%)’])
xlim([0 100])
ylim([0 60])
% Create fake points for the legend
hFakeDATA1 = plot(NaN, NaN, ‘o’, ‘MarkerFaceColor’, "#228b22", ‘MarkerEdgeColor’, "#228b22", ‘MarkerSize’, 5);
hFakeDATA2 = plot(NaN, NaN, ‘o’, ‘MarkerFaceColor’, "#395dc7", ‘MarkerEdgeColor’, "#395dc7", ‘MarkerSize’, 5);
hFakeDATA3 = plot(NaN, NaN, ‘o’, ‘MarkerFaceColor’, "#f88f09", ‘MarkerEdgeColor’, "#f88f09", ‘MarkerSize’, 5);
% Create fake entry for the shaded region
hShadedRegion = plot(NaN, NaN, ‘s’, ‘MarkerFaceColor’, [0.7 0.7 0.7], ‘MarkerEdgeColor’, ‘none’, ‘MarkerSize’, 8);
% Create custom legend with the fake points
legend([hFakeDATA1, hFakeDATA2, hFakeDATA3, hShadedRegion], …
{‘DATA1’, ‘DATA2’, ‘DATA3’, ‘Main effect of group’}, ‘Location’, ‘bestoutside’);
subplot(4,1,2)
title(‘Middle’)
hold on
[m,n] = size(DATA1middle);
xaxis=repmat(1:101, n, 1);
scatter(xaxis,DATA1middle’,2,’MarkerFaceColor’,"#228b22",’MarkerEdgeColor’,"#228b22", ‘MarkerFaceAlpha’,.3,’MarkerEdgeAlpha’,.3)
[m,n] = size(DATA2middle);
xaxis=repmat(1:101, n, 1);
scatter(xaxis,DATA2middle’,2,’MarkerFaceColor’,"#395dc7",’MarkerEdgeColor’,"#395dc7", ‘MarkerFaceAlpha’,.3,’MarkerEdgeAlpha’,.3)%stdshade(DATA2start’,’0.3′,’b’)
hold on
[m,n] = size(DATA3middle);
xaxis=repmat(1:101, n, 1);
scatter(xaxis,DATA3middle’,2,’MarkerFaceColor’,"#f88f09",’MarkerEdgeColor’,"#f88f09", ‘MarkerFaceAlpha’,.3,’MarkerEdgeAlpha’,.3)
hold on
scatter(1:101,mean(DATA1middle’,’omitnan’),10,’MarkerFaceColor’,"#228b22",’MarkerEdgeColor’,"#228b22")
hold on
scatter(1:101,mean(DATA2middle’,’omitnan’),10,’MarkerFaceColor’,"#395dc7",’MarkerEdgeColor’,"#395dc7")
hold on
scatter(1:101,mean(DATA3middle’,’omitnan’),10,’MarkerFaceColor’,"#f88f09",’MarkerEdgeColor’,"#f88f09")
ylabel([‘Angular Difference’, s])
xlabel([‘Percentage of gait cycle (%)’])
xlim([0 100])
ylim([0 60])
subplot(4,1,3)
title(‘End’)
hold on
[m,n] = size(DATA1last);
xaxis=repmat(1:101, n, 1);
scatter(xaxis,DATA1last’,2,’MarkerFaceColor’,"#228b22",’MarkerEdgeColor’,"#228b22", ‘MarkerFaceAlpha’,.3,’MarkerEdgeAlpha’,.3)
[m,n] = size(DATA2last);
xaxis=repmat(1:101, n, 1);
scatter(xaxis,DATA2last’,2,’MarkerFaceColor’,"#395dc7",’MarkerEdgeColor’,"#395dc7", ‘MarkerFaceAlpha’,.3,’MarkerEdgeAlpha’,.3)%stdshade(DATA2start’,’0.3′,’b’)
hold on
[m,n] = size(DATA3last);
xaxis=repmat(1:101, n, 1);
scatter(xaxis,DATA3last’,2,’MarkerFaceColor’,"#f88f09",’MarkerEdgeColor’,"#f88f09", ‘MarkerFaceAlpha’,.3,’MarkerEdgeAlpha’,.3)
hold on
scatter(1:101,mean(DATA1last’,’omitnan’),10,’MarkerFaceColor’,"#228b22",’MarkerEdgeColor’,"#228b22")
hold on
scatter(1:101,mean(DATA2last’,’omitnan’),10,’MarkerFaceColor’,"#395dc7",’MarkerEdgeColor’,"#395dc7")
hold on
scatter(1:101,mean(DATA3last’,’omitnan’),10,’MarkerFaceColor’,"#f88f09",’MarkerEdgeColor’,"#f88f09")
ylabel([‘Angular Difference’, s])
xlabel([‘Percentage of gait cycle (%)’])
xlim([0 100])
ylim([0 60])
Provides me with the graph shown here. I can’t seem to put the legend in the correct place ( I have moved the block of code around to create the legend before and after each graph, but with no success). I would like the legend to be outside of all the tiles! Any advice would be much appreciated 🙂 scatter, legend, tiledlayout, location, bestoutside MATLAB Answers — New Questions
how can I save a variable to an excel file?
Hi,
I have a complex variable (named "ST_normalized") in my MATLAB code. I want to save that file to an Excel file. Can you please help me with that? Thanks for your time.
regardsHi,
I have a complex variable (named "ST_normalized") in my MATLAB code. I want to save that file to an Excel file. Can you please help me with that? Thanks for your time.
regards Hi,
I have a complex variable (named "ST_normalized") in my MATLAB code. I want to save that file to an Excel file. Can you please help me with that? Thanks for your time.
regards matlab, figure, save, variable MATLAB Answers — New Questions
Optimization method based on the Nonlinear least squares as well as fmincon for the defined objective function (Non-linear function).
Hi there,
I am currently working on a Matlab code for my task (optimization task), and I tried two different methods;
Method A: the fmincon was used to minimize the objective function in which different algorithms, such as interior-point, sqp, sqp-legacy, interior-point, and active-set, were applied.
Method B: Nonlinear least squares optimization was combined with three algorithms, levenberg-marquardt, and trust-region-reflective.
The best results I got now are (from the Nonlinear least squares optimization + ‘interior-point’):
RMSE for X, Y, Z Direction(mm) : [1.18, 0.16, 1.33] mm; however, I want to reduce it as far as it is possible.
@ A quick guide for the code, and how it works.
1. I do have 3D data sets, and I used some mathematical methods to convert these 3D data into 2D data (Step 3).
2. The goal is to use some inverse method to get the same 3D datasets; therefore, after defining the objective function, I applied different optimization methods to address this task.
Any assistance or alternative approaches would be greatly appreciated.
Thank you in advance!
% @ Payam Samadi (2025.3.15) NLSP (Nonlinear least squares optimization)
% In step 3, the 2D projection data was extracted from the 3D data at
% different projections.
% In step4, the objective function is defined.
% In step 5, the Nonlinear least squares optimization is used to minimize
% the objective function.
% Algorithm:
% 1. ‘levenberg-marquardt’ : [1.21, 0.17, 1.39] mm,
% 2. ‘trust-region-reflective’ : [1.21, 0.17, 1.39] mm,
% 3. ‘interior-point’ : [1.18, 0.16, 1.33] mm
% Note: It is important to carefully consider the initial guesses for
% target locations, as well as the lower bounds (lb) and upper bounds (ub).
tic;
clc;
clear;
close all;
%% Step 1: Load xls file (3D Tumor position)
Load_Data = xlsread(‘Sample 1.xlsx’); % Data include 12 (sec)
% Load_Data = xlsread(‘Sample 2.xlsx’); % Data include 60 (sec)
Time = Load_Data(:,1); % Time (s)
xt=Load_Data(:,2); % xt for targets
yt=Load_Data(:,3); % yt for targets
zt=Load_Data(:,4); % zt for targets
true_T=[xt,yt,zt]; % target locations
[~,numT]=size(true_T); % number of targets
%% Step 2: Define imaging system parameters
SAD = 100; % source-axis distance (cm)
SID = 150; % source-image plane distance (cm)
num_projections = length(Time); % number of different views
% Generate projection angles
alpha = linspace(0, 360, num_projections);
% alpha=30;
theta_rad = deg2rad(alpha); % view angles (radians)
%% Step 3: Projection Model: Compute 2D projections
Xp=zeros(1,num_projections); % allocate array
Yp=zeros(1,num_projections);
for i=1:num_projections
f_theta = (SAD – (true_T(i,1) .* sin(theta_rad(i)) + true_T(i,3) .* cos(theta_rad(i)))) ./ SID;
Xp(1, i) = (true_T(i,1) .* cos(theta_rad(i)) – true_T(i,3) .* sin(theta_rad(i))) ./ f_theta;
Yp(1, i) = true_T(i,2) ./ f_theta;
end
xp = Xp’;
yp = Yp’;
%% Step 4: Define the objective function
% Define the objective function
objFun = @(T) computeProjectionError(T, xp, yp, theta_rad, SAD, SID, num_projections);
%% Step 5: Minimize the objective function using lsqnonlin
% Algorithm:
% 1. ‘levenberg-marquardt’ : [1.21, 0.17, 1.39] mm,
% 2. ‘trust-region-reflective’ : [1.21, 0.17, 1.39] mm,
% 3. ‘interior-point’ : [1.18, 0.16, 1.33] mm
% Define bounds
lb = []; % Lower bounds
ub = []; % Upper bounds
% Define optimization options
options = optimoptions(‘lsqnonlin’, …
‘Algorithm’, ‘interior-point’, …
‘Display’, ‘iter’, …
‘MaxIterations’, 300, …
‘MaxFunctionEvaluations’, 20000, …
‘TolFun’, 1e-10, …
‘TolX’, 1e-10, …
‘StepTolerance’, 1e-8, …
‘FiniteDifferenceStepSize’, 1e-3, …
‘UseParallel’, true);
% Generate a better initial guess
T0 = ones(3, num_projections);
% Run optimization for each projection
estimated_T = zeros(3, num_projections);
for i = 1:num_projections
objFun_i = @(T) computeProjectionError(T, xp(i), yp(i), theta_rad(i), SAD, SID, 1);
estimated_T(:, i) = lsqnonlin(objFun_i, T0(:, i), lb, ub, options);
end
%% Step 6: Calculate RMSE value
% Estimated Tumor Position in X, Y, and Z Direction
Estimate_3D_X = estimated_T(1,:);
Estimate_3D_Y = estimated_T(2,:);
Estimate_3D_Z = estimated_T(3,:);
RMSE_x = Calculate_RMSR (xt,Estimate_3D_X);
RMSE_y = Calculate_RMSR (yt,Estimate_3D_Y);
RMSE_z = Calculate_RMSR (zt,Estimate_3D_Z);
fprintf([‘RMSE for X, Y, Z Direction(mm): ‘ …
‘[%.2f, %.2f, %.2f] mmn’], RMSE_x, RMSE_y, RMSE_z);
%% Step 7: Plot Estimated vs Real Data
Plot_results (Time, xt, yt, zt, Estimate_3D_X, Estimate_3D_Y, Estimate_3D_Z);
toc;
%% Objective function: Computes error between observed and estimated projections
function error = computeProjectionError(T, xp, yp, theta_rad, SAD, SID, num_projections)
for i=1:num_projections
x_est = T(1,:);
y_est = T(2,:);
z_est = T(3,:);
% Compute estimated projection using the perspective transformation
f_theta = (SAD – (x_est(i) .* sin(theta_rad(i)) + z_est(i) .* cos(theta_rad(i))))./ SID;
xp_est(i) = (x_est(i) .* cos(theta_rad(i)) – z_est(i) .* sin(theta_rad(i))) ./ f_theta;
yp_est(i) = y_est(i) ./ f_theta;
end
%% Compute residual error (Method 1)
% Compute the residual error
error_x = xp – xp_est;
error_y = yp – yp_est;
% Return residuals for least squares minimization
error = [error_x; error_y];
end
function RMSE = Calculate_RMSR (True_value,Estimated_value)
% Calculate RMSE
e1 = (True_value(:)-Estimated_value(:)).^2;
RMSE = sqrt(mean(e1,’omitnan’));
end
function Plot_results (Time, xt, yt, zt, Estimate_3D_X, Estimate_3D_Y, Estimate_3D_Z)
figure(‘WindowState’, ‘maximized’)
subplot(3,1,1);
plot(Time, Estimate_3D_X,’r’);
hold on;
plot(Time, xt,’b’);
legend (‘Estimate’, ‘Real’);
title (‘X Dierction’)
xlabel (‘Time (s)’);
ylabel (‘Motion (mm)’)
hold off;
subplot(3,1,2);
plot(Time, Estimate_3D_Y,’r’);
hold on;
plot(Time, yt,’b’);
legend (‘Estimate’, ‘Real’);
title (‘Y Dierction’)
xlabel (‘Time (s)’);
ylabel (‘Motion (mm)’)
hold off;
subplot(3,1,3);
plot(Time, Estimate_3D_Z,’r’);
hold on;
plot(Time, zt,’b’);
legend (‘Estimate’, ‘Real’);
title (‘Z Dierction’)
xlabel (‘Time (s)’);
ylabel (‘Motion (mm)’)
hold off;
endHi there,
I am currently working on a Matlab code for my task (optimization task), and I tried two different methods;
Method A: the fmincon was used to minimize the objective function in which different algorithms, such as interior-point, sqp, sqp-legacy, interior-point, and active-set, were applied.
Method B: Nonlinear least squares optimization was combined with three algorithms, levenberg-marquardt, and trust-region-reflective.
The best results I got now are (from the Nonlinear least squares optimization + ‘interior-point’):
RMSE for X, Y, Z Direction(mm) : [1.18, 0.16, 1.33] mm; however, I want to reduce it as far as it is possible.
@ A quick guide for the code, and how it works.
1. I do have 3D data sets, and I used some mathematical methods to convert these 3D data into 2D data (Step 3).
2. The goal is to use some inverse method to get the same 3D datasets; therefore, after defining the objective function, I applied different optimization methods to address this task.
Any assistance or alternative approaches would be greatly appreciated.
Thank you in advance!
% @ Payam Samadi (2025.3.15) NLSP (Nonlinear least squares optimization)
% In step 3, the 2D projection data was extracted from the 3D data at
% different projections.
% In step4, the objective function is defined.
% In step 5, the Nonlinear least squares optimization is used to minimize
% the objective function.
% Algorithm:
% 1. ‘levenberg-marquardt’ : [1.21, 0.17, 1.39] mm,
% 2. ‘trust-region-reflective’ : [1.21, 0.17, 1.39] mm,
% 3. ‘interior-point’ : [1.18, 0.16, 1.33] mm
% Note: It is important to carefully consider the initial guesses for
% target locations, as well as the lower bounds (lb) and upper bounds (ub).
tic;
clc;
clear;
close all;
%% Step 1: Load xls file (3D Tumor position)
Load_Data = xlsread(‘Sample 1.xlsx’); % Data include 12 (sec)
% Load_Data = xlsread(‘Sample 2.xlsx’); % Data include 60 (sec)
Time = Load_Data(:,1); % Time (s)
xt=Load_Data(:,2); % xt for targets
yt=Load_Data(:,3); % yt for targets
zt=Load_Data(:,4); % zt for targets
true_T=[xt,yt,zt]; % target locations
[~,numT]=size(true_T); % number of targets
%% Step 2: Define imaging system parameters
SAD = 100; % source-axis distance (cm)
SID = 150; % source-image plane distance (cm)
num_projections = length(Time); % number of different views
% Generate projection angles
alpha = linspace(0, 360, num_projections);
% alpha=30;
theta_rad = deg2rad(alpha); % view angles (radians)
%% Step 3: Projection Model: Compute 2D projections
Xp=zeros(1,num_projections); % allocate array
Yp=zeros(1,num_projections);
for i=1:num_projections
f_theta = (SAD – (true_T(i,1) .* sin(theta_rad(i)) + true_T(i,3) .* cos(theta_rad(i)))) ./ SID;
Xp(1, i) = (true_T(i,1) .* cos(theta_rad(i)) – true_T(i,3) .* sin(theta_rad(i))) ./ f_theta;
Yp(1, i) = true_T(i,2) ./ f_theta;
end
xp = Xp’;
yp = Yp’;
%% Step 4: Define the objective function
% Define the objective function
objFun = @(T) computeProjectionError(T, xp, yp, theta_rad, SAD, SID, num_projections);
%% Step 5: Minimize the objective function using lsqnonlin
% Algorithm:
% 1. ‘levenberg-marquardt’ : [1.21, 0.17, 1.39] mm,
% 2. ‘trust-region-reflective’ : [1.21, 0.17, 1.39] mm,
% 3. ‘interior-point’ : [1.18, 0.16, 1.33] mm
% Define bounds
lb = []; % Lower bounds
ub = []; % Upper bounds
% Define optimization options
options = optimoptions(‘lsqnonlin’, …
‘Algorithm’, ‘interior-point’, …
‘Display’, ‘iter’, …
‘MaxIterations’, 300, …
‘MaxFunctionEvaluations’, 20000, …
‘TolFun’, 1e-10, …
‘TolX’, 1e-10, …
‘StepTolerance’, 1e-8, …
‘FiniteDifferenceStepSize’, 1e-3, …
‘UseParallel’, true);
% Generate a better initial guess
T0 = ones(3, num_projections);
% Run optimization for each projection
estimated_T = zeros(3, num_projections);
for i = 1:num_projections
objFun_i = @(T) computeProjectionError(T, xp(i), yp(i), theta_rad(i), SAD, SID, 1);
estimated_T(:, i) = lsqnonlin(objFun_i, T0(:, i), lb, ub, options);
end
%% Step 6: Calculate RMSE value
% Estimated Tumor Position in X, Y, and Z Direction
Estimate_3D_X = estimated_T(1,:);
Estimate_3D_Y = estimated_T(2,:);
Estimate_3D_Z = estimated_T(3,:);
RMSE_x = Calculate_RMSR (xt,Estimate_3D_X);
RMSE_y = Calculate_RMSR (yt,Estimate_3D_Y);
RMSE_z = Calculate_RMSR (zt,Estimate_3D_Z);
fprintf([‘RMSE for X, Y, Z Direction(mm): ‘ …
‘[%.2f, %.2f, %.2f] mmn’], RMSE_x, RMSE_y, RMSE_z);
%% Step 7: Plot Estimated vs Real Data
Plot_results (Time, xt, yt, zt, Estimate_3D_X, Estimate_3D_Y, Estimate_3D_Z);
toc;
%% Objective function: Computes error between observed and estimated projections
function error = computeProjectionError(T, xp, yp, theta_rad, SAD, SID, num_projections)
for i=1:num_projections
x_est = T(1,:);
y_est = T(2,:);
z_est = T(3,:);
% Compute estimated projection using the perspective transformation
f_theta = (SAD – (x_est(i) .* sin(theta_rad(i)) + z_est(i) .* cos(theta_rad(i))))./ SID;
xp_est(i) = (x_est(i) .* cos(theta_rad(i)) – z_est(i) .* sin(theta_rad(i))) ./ f_theta;
yp_est(i) = y_est(i) ./ f_theta;
end
%% Compute residual error (Method 1)
% Compute the residual error
error_x = xp – xp_est;
error_y = yp – yp_est;
% Return residuals for least squares minimization
error = [error_x; error_y];
end
function RMSE = Calculate_RMSR (True_value,Estimated_value)
% Calculate RMSE
e1 = (True_value(:)-Estimated_value(:)).^2;
RMSE = sqrt(mean(e1,’omitnan’));
end
function Plot_results (Time, xt, yt, zt, Estimate_3D_X, Estimate_3D_Y, Estimate_3D_Z)
figure(‘WindowState’, ‘maximized’)
subplot(3,1,1);
plot(Time, Estimate_3D_X,’r’);
hold on;
plot(Time, xt,’b’);
legend (‘Estimate’, ‘Real’);
title (‘X Dierction’)
xlabel (‘Time (s)’);
ylabel (‘Motion (mm)’)
hold off;
subplot(3,1,2);
plot(Time, Estimate_3D_Y,’r’);
hold on;
plot(Time, yt,’b’);
legend (‘Estimate’, ‘Real’);
title (‘Y Dierction’)
xlabel (‘Time (s)’);
ylabel (‘Motion (mm)’)
hold off;
subplot(3,1,3);
plot(Time, Estimate_3D_Z,’r’);
hold on;
plot(Time, zt,’b’);
legend (‘Estimate’, ‘Real’);
title (‘Z Dierction’)
xlabel (‘Time (s)’);
ylabel (‘Motion (mm)’)
hold off;
end Hi there,
I am currently working on a Matlab code for my task (optimization task), and I tried two different methods;
Method A: the fmincon was used to minimize the objective function in which different algorithms, such as interior-point, sqp, sqp-legacy, interior-point, and active-set, were applied.
Method B: Nonlinear least squares optimization was combined with three algorithms, levenberg-marquardt, and trust-region-reflective.
The best results I got now are (from the Nonlinear least squares optimization + ‘interior-point’):
RMSE for X, Y, Z Direction(mm) : [1.18, 0.16, 1.33] mm; however, I want to reduce it as far as it is possible.
@ A quick guide for the code, and how it works.
1. I do have 3D data sets, and I used some mathematical methods to convert these 3D data into 2D data (Step 3).
2. The goal is to use some inverse method to get the same 3D datasets; therefore, after defining the objective function, I applied different optimization methods to address this task.
Any assistance or alternative approaches would be greatly appreciated.
Thank you in advance!
% @ Payam Samadi (2025.3.15) NLSP (Nonlinear least squares optimization)
% In step 3, the 2D projection data was extracted from the 3D data at
% different projections.
% In step4, the objective function is defined.
% In step 5, the Nonlinear least squares optimization is used to minimize
% the objective function.
% Algorithm:
% 1. ‘levenberg-marquardt’ : [1.21, 0.17, 1.39] mm,
% 2. ‘trust-region-reflective’ : [1.21, 0.17, 1.39] mm,
% 3. ‘interior-point’ : [1.18, 0.16, 1.33] mm
% Note: It is important to carefully consider the initial guesses for
% target locations, as well as the lower bounds (lb) and upper bounds (ub).
tic;
clc;
clear;
close all;
%% Step 1: Load xls file (3D Tumor position)
Load_Data = xlsread(‘Sample 1.xlsx’); % Data include 12 (sec)
% Load_Data = xlsread(‘Sample 2.xlsx’); % Data include 60 (sec)
Time = Load_Data(:,1); % Time (s)
xt=Load_Data(:,2); % xt for targets
yt=Load_Data(:,3); % yt for targets
zt=Load_Data(:,4); % zt for targets
true_T=[xt,yt,zt]; % target locations
[~,numT]=size(true_T); % number of targets
%% Step 2: Define imaging system parameters
SAD = 100; % source-axis distance (cm)
SID = 150; % source-image plane distance (cm)
num_projections = length(Time); % number of different views
% Generate projection angles
alpha = linspace(0, 360, num_projections);
% alpha=30;
theta_rad = deg2rad(alpha); % view angles (radians)
%% Step 3: Projection Model: Compute 2D projections
Xp=zeros(1,num_projections); % allocate array
Yp=zeros(1,num_projections);
for i=1:num_projections
f_theta = (SAD – (true_T(i,1) .* sin(theta_rad(i)) + true_T(i,3) .* cos(theta_rad(i)))) ./ SID;
Xp(1, i) = (true_T(i,1) .* cos(theta_rad(i)) – true_T(i,3) .* sin(theta_rad(i))) ./ f_theta;
Yp(1, i) = true_T(i,2) ./ f_theta;
end
xp = Xp’;
yp = Yp’;
%% Step 4: Define the objective function
% Define the objective function
objFun = @(T) computeProjectionError(T, xp, yp, theta_rad, SAD, SID, num_projections);
%% Step 5: Minimize the objective function using lsqnonlin
% Algorithm:
% 1. ‘levenberg-marquardt’ : [1.21, 0.17, 1.39] mm,
% 2. ‘trust-region-reflective’ : [1.21, 0.17, 1.39] mm,
% 3. ‘interior-point’ : [1.18, 0.16, 1.33] mm
% Define bounds
lb = []; % Lower bounds
ub = []; % Upper bounds
% Define optimization options
options = optimoptions(‘lsqnonlin’, …
‘Algorithm’, ‘interior-point’, …
‘Display’, ‘iter’, …
‘MaxIterations’, 300, …
‘MaxFunctionEvaluations’, 20000, …
‘TolFun’, 1e-10, …
‘TolX’, 1e-10, …
‘StepTolerance’, 1e-8, …
‘FiniteDifferenceStepSize’, 1e-3, …
‘UseParallel’, true);
% Generate a better initial guess
T0 = ones(3, num_projections);
% Run optimization for each projection
estimated_T = zeros(3, num_projections);
for i = 1:num_projections
objFun_i = @(T) computeProjectionError(T, xp(i), yp(i), theta_rad(i), SAD, SID, 1);
estimated_T(:, i) = lsqnonlin(objFun_i, T0(:, i), lb, ub, options);
end
%% Step 6: Calculate RMSE value
% Estimated Tumor Position in X, Y, and Z Direction
Estimate_3D_X = estimated_T(1,:);
Estimate_3D_Y = estimated_T(2,:);
Estimate_3D_Z = estimated_T(3,:);
RMSE_x = Calculate_RMSR (xt,Estimate_3D_X);
RMSE_y = Calculate_RMSR (yt,Estimate_3D_Y);
RMSE_z = Calculate_RMSR (zt,Estimate_3D_Z);
fprintf([‘RMSE for X, Y, Z Direction(mm): ‘ …
‘[%.2f, %.2f, %.2f] mmn’], RMSE_x, RMSE_y, RMSE_z);
%% Step 7: Plot Estimated vs Real Data
Plot_results (Time, xt, yt, zt, Estimate_3D_X, Estimate_3D_Y, Estimate_3D_Z);
toc;
%% Objective function: Computes error between observed and estimated projections
function error = computeProjectionError(T, xp, yp, theta_rad, SAD, SID, num_projections)
for i=1:num_projections
x_est = T(1,:);
y_est = T(2,:);
z_est = T(3,:);
% Compute estimated projection using the perspective transformation
f_theta = (SAD – (x_est(i) .* sin(theta_rad(i)) + z_est(i) .* cos(theta_rad(i))))./ SID;
xp_est(i) = (x_est(i) .* cos(theta_rad(i)) – z_est(i) .* sin(theta_rad(i))) ./ f_theta;
yp_est(i) = y_est(i) ./ f_theta;
end
%% Compute residual error (Method 1)
% Compute the residual error
error_x = xp – xp_est;
error_y = yp – yp_est;
% Return residuals for least squares minimization
error = [error_x; error_y];
end
function RMSE = Calculate_RMSR (True_value,Estimated_value)
% Calculate RMSE
e1 = (True_value(:)-Estimated_value(:)).^2;
RMSE = sqrt(mean(e1,’omitnan’));
end
function Plot_results (Time, xt, yt, zt, Estimate_3D_X, Estimate_3D_Y, Estimate_3D_Z)
figure(‘WindowState’, ‘maximized’)
subplot(3,1,1);
plot(Time, Estimate_3D_X,’r’);
hold on;
plot(Time, xt,’b’);
legend (‘Estimate’, ‘Real’);
title (‘X Dierction’)
xlabel (‘Time (s)’);
ylabel (‘Motion (mm)’)
hold off;
subplot(3,1,2);
plot(Time, Estimate_3D_Y,’r’);
hold on;
plot(Time, yt,’b’);
legend (‘Estimate’, ‘Real’);
title (‘Y Dierction’)
xlabel (‘Time (s)’);
ylabel (‘Motion (mm)’)
hold off;
subplot(3,1,3);
plot(Time, Estimate_3D_Z,’r’);
hold on;
plot(Time, zt,’b’);
legend (‘Estimate’, ‘Real’);
title (‘Z Dierction’)
xlabel (‘Time (s)’);
ylabel (‘Motion (mm)’)
hold off;
end optimization, fmincon, nonlinear least squares, objective function MATLAB Answers — New Questions
Microsoft’s Attempts to Improve the Teams UI Are Not Always Successful
Auto-Hide Inactive Channels and the New Chat and Channels Interface Just Don’t Work for Some People
It’s hard to create a client user interface that works well on Windows, Mac, and browsers that satisfies the often very different demands which exist in a very large user base (320 million or so, in what’s now a very old official figure). Yet that’s the task that the Teams development group sets itself as it rolls out interface changes. Sometimes, things don’t go to plan.
Solving the Auto-Hide Inactive Channels Mess
Take the plan to auto-hide inactive channels so that old and potentially obsolete channels wouldn’t get in the way of real work. On paper, it sounds like a wonderful idea. Channels do age over time and people do lose interest in what happens in some channels. Manually hiding a bunch of old channels could occupy a rainy Sunday afternoon, but who wants to do that.
The original intention is explained in Microsoft 365 roadmap item 325780, where we discover that “Teams will automatically detect inactive channels you haven’t interacted with in a while, and automatically hide them for you.” Soon after the launch of the feature in July 2024, Microsoft ran into user discontent.
The important word in Microsoft’s description is “automatically.” When software performs an action without human prompting, the results of the processing can be overlooked. In the case of Teams, people reported that important channels disappeared from the Teams and channels list. According to the unexplained algorithm used by Teams, the now-hidden channels appeared inactive and unused, and so liable for hiding. Users could find and unhide channels (Figure 1), but the extra work is a hassle.

The upshot is that Microsoft announced in MC804771 (March 21, 2025) that “Teams will offer users suggestions on channels that are inactive, and the user is prompted to review their inactive channels and hide them only if they choose.” The change to an opt-in model is expected to roll out to general availability “later in 2025.” Let’s hope that Microsoft does a better job this time around.
Moving Away from The New Chat and Channels Experience
Which brings me neatly to the new Teams Chat and Channel experience, trumpeted by Microsoft as being streamlined to help you collaborate more effectively. I’ve used the new interface since its earliest beta release as a new take on how to use channels. After Microsoft released the full version in October 2024, my review led off with “Microsoft’s waffle about the new experience is pure marketing spin.” That note reflected some of my frustration with trying to make the new experience work for me, despite having the opportunity to discuss the matter in depth with some of those responsible for the new interface.
After a further six months of trying, I’ve concluded that I work better with the old experience. I like the separation between chats and Teams. I find it easier to stay on top of current activities and find that I don’t overlook things the way that I do when chats and teams are comingled.
I know others share the same opinion, even if Microsoft’s fabled telemetry tells a different story (but those who construct and control the telemetry get to decide what the story is). I do know of people who love working in the new way, even if it doesn’t work for me. I suspect that the reaction to the new interface is highly individual and greatly influenced by how people work with Teams. As I noted in my review, in some tenants I use chat mostly. In others, it’s channel-based, and in others it’s a combination. I find that chat-centric activities are best in the new experience, but I still decided to revert to the old interface everywhere.
Both the Old and the New
The nice thing is that Teams supports both the old and new experience. In other words, the software respects user choice and doesn’t attempt to force people to do things in the one true way. It’s always better when user choice is respected, especially when changes are introduced in user interfaces. Maybe those responsible for the auto-hide inactive channels feature might have learned that lesson.
Support the work of the Office 365 for IT Pros team by subscribing to the Office 365 for IT Pros eBook. Your support pays for the time we need to track, analyze, and document the changing world of Microsoft 365 and Office 365.
trouver un angle avec l’equation de trajectoire d’un projectile
Bonjour, j’ai un probleme avec ma conception d’un projet de cours j’aimerais calculé l’angle adequat pour mon projectile avec un x0 et y0 en fonction de x mais matlab me donne aucune reponse. voici ce que je recois comme resultat. merciBonjour, j’ai un probleme avec ma conception d’un projet de cours j’aimerais calculé l’angle adequat pour mon projectile avec un x0 et y0 en fonction de x mais matlab me donne aucune reponse. voici ce que je recois comme resultat. merci Bonjour, j’ai un probleme avec ma conception d’un projet de cours j’aimerais calculé l’angle adequat pour mon projectile avec un x0 et y0 en fonction de x mais matlab me donne aucune reponse. voici ce que je recois comme resultat. merci symbolic, trigonometric MATLAB Answers — New Questions
GPU code generation failed with the error ’emlc:compilationError’
When using GPU Coder, I encountered issues with the following environment configuration:
– **GPU Version**: NVIDIA RTX A2000 (Compute Capability 8.6, Ampere Architecture).
– **MATLAB Version**: R2023b.
– **CUDA Toolkit Version**: 11.8.
– **Visual Studio Version**: 2022 (with "Desktop Development with C++" component installed).
When I test
gpuDevice
ans =
CUDADevice – 属性:
Name: ‘NVIDIA RTX A2000’
Index: 1
ComputeCapability: ‘8.6’
SupportsDouble: 1
GraphicsDriverVersion: ‘572.83’
DriverModel: ‘WDDM’
ToolkitVersion: 11.8000
MaxThreadsPerBlock: 1024
MaxShmemPerBlock: 49152 (49.15 KB)
MaxThreadBlockSize: [1024 1024 64]
MaxGridSize: [2.1475e+09 65535 65535]
SIMDWidth: 32
TotalMemory: 6435504128 (6.44 GB)
AvailableMemory: 5375778816 (5.38 GB)
CachePolicy: ‘balanced’
MultiprocessorCount: 26
ClockRateKHz: 1200000
ComputeMode: ‘Default’
GPUOverlapsTransfers: 1
KernelExecutionTimeout: 1
CanMapHostMemory: 1
DeviceSupported: 1
DeviceAvailable: 1
DeviceSelected: 1
If I test coder.checkGpuInstall
coder.checkGpuInstall:
Compatible GPU : PASSED
CUDA Environment : PASSED
Runtime : PASSED
cuFFT : PASSED
cuSOLVER : PASSED
cuBLAS : PASSED
cuDNN Environment : FAILED (Error generated while determining cuDNN library version ‘Embedding metadata in the MEX file failed.
‘.)
Host Compiler : PASSED
Basic Code Generation : FAILED (GPU code generation failed with the error ’emlc:compilationError’. View report for further information: View report)
ans =
包含以下字段的 struct:
gpu: 1
cuda: 1
cudnn: 0
tensorrt: 0
hostcompiler: 1
basiccodegen: 0
basiccodeexec: 0
deepcodegen: 0
deepcodeexec: 0
tensorrtdatatype: 0
profiling: 0
test mex -setup
mex -setup
MEX 配置为使用 ‘MinGW64 Compiler (C)’ 以进行 C 语言编译。
要选择不同的 C 编译器,请从以下选项中选择一种命令:
MinGW64 Compiler (C) mex -setup:C:Users石海洋AppDataRoamingMathWorksMATLABR2023bmex_C_win64.xml C
Microsoft Visual C++ 2022 (C) mex -setup:’D:Program FilesMathWorksR2023Bbinwin64mexoptsmsvc2022.xml’ C
要选择不同的语言,请从以下选项中选择一种命令:
mex -setup C++
mex -setup FORTRAN
I looked throught the answers about ’emlc:compilationError’ and "Invalid CUDA device", and see the answer in GPU coder :basic Code Generation failed – MATLAB Answers – MATLAB Central, its issue is caused by a MATLAB version that is too low. However, after reviewing the relevant settings, my MATLAB version should support CUDA 11.8 and VS2022. So, what could be the problem?
PS: I installed cuDNN 8.9 (cudnn-windows-x86_64-8.9.7.29_cuda11-archive) and set the system environment variable `NVIDIA_CUDNN` to: `C:Program FilesNVIDIA GPU Computing ToolkitCUDAv11.8`. Why does the cuDNN Environment still show as failed here?When using GPU Coder, I encountered issues with the following environment configuration:
– **GPU Version**: NVIDIA RTX A2000 (Compute Capability 8.6, Ampere Architecture).
– **MATLAB Version**: R2023b.
– **CUDA Toolkit Version**: 11.8.
– **Visual Studio Version**: 2022 (with "Desktop Development with C++" component installed).
When I test
gpuDevice
ans =
CUDADevice – 属性:
Name: ‘NVIDIA RTX A2000’
Index: 1
ComputeCapability: ‘8.6’
SupportsDouble: 1
GraphicsDriverVersion: ‘572.83’
DriverModel: ‘WDDM’
ToolkitVersion: 11.8000
MaxThreadsPerBlock: 1024
MaxShmemPerBlock: 49152 (49.15 KB)
MaxThreadBlockSize: [1024 1024 64]
MaxGridSize: [2.1475e+09 65535 65535]
SIMDWidth: 32
TotalMemory: 6435504128 (6.44 GB)
AvailableMemory: 5375778816 (5.38 GB)
CachePolicy: ‘balanced’
MultiprocessorCount: 26
ClockRateKHz: 1200000
ComputeMode: ‘Default’
GPUOverlapsTransfers: 1
KernelExecutionTimeout: 1
CanMapHostMemory: 1
DeviceSupported: 1
DeviceAvailable: 1
DeviceSelected: 1
If I test coder.checkGpuInstall
coder.checkGpuInstall:
Compatible GPU : PASSED
CUDA Environment : PASSED
Runtime : PASSED
cuFFT : PASSED
cuSOLVER : PASSED
cuBLAS : PASSED
cuDNN Environment : FAILED (Error generated while determining cuDNN library version ‘Embedding metadata in the MEX file failed.
‘.)
Host Compiler : PASSED
Basic Code Generation : FAILED (GPU code generation failed with the error ’emlc:compilationError’. View report for further information: View report)
ans =
包含以下字段的 struct:
gpu: 1
cuda: 1
cudnn: 0
tensorrt: 0
hostcompiler: 1
basiccodegen: 0
basiccodeexec: 0
deepcodegen: 0
deepcodeexec: 0
tensorrtdatatype: 0
profiling: 0
test mex -setup
mex -setup
MEX 配置为使用 ‘MinGW64 Compiler (C)’ 以进行 C 语言编译。
要选择不同的 C 编译器,请从以下选项中选择一种命令:
MinGW64 Compiler (C) mex -setup:C:Users石海洋AppDataRoamingMathWorksMATLABR2023bmex_C_win64.xml C
Microsoft Visual C++ 2022 (C) mex -setup:’D:Program FilesMathWorksR2023Bbinwin64mexoptsmsvc2022.xml’ C
要选择不同的语言,请从以下选项中选择一种命令:
mex -setup C++
mex -setup FORTRAN
I looked throught the answers about ’emlc:compilationError’ and "Invalid CUDA device", and see the answer in GPU coder :basic Code Generation failed – MATLAB Answers – MATLAB Central, its issue is caused by a MATLAB version that is too low. However, after reviewing the relevant settings, my MATLAB version should support CUDA 11.8 and VS2022. So, what could be the problem?
PS: I installed cuDNN 8.9 (cudnn-windows-x86_64-8.9.7.29_cuda11-archive) and set the system environment variable `NVIDIA_CUDNN` to: `C:Program FilesNVIDIA GPU Computing ToolkitCUDAv11.8`. Why does the cuDNN Environment still show as failed here? When using GPU Coder, I encountered issues with the following environment configuration:
– **GPU Version**: NVIDIA RTX A2000 (Compute Capability 8.6, Ampere Architecture).
– **MATLAB Version**: R2023b.
– **CUDA Toolkit Version**: 11.8.
– **Visual Studio Version**: 2022 (with "Desktop Development with C++" component installed).
When I test
gpuDevice
ans =
CUDADevice – 属性:
Name: ‘NVIDIA RTX A2000’
Index: 1
ComputeCapability: ‘8.6’
SupportsDouble: 1
GraphicsDriverVersion: ‘572.83’
DriverModel: ‘WDDM’
ToolkitVersion: 11.8000
MaxThreadsPerBlock: 1024
MaxShmemPerBlock: 49152 (49.15 KB)
MaxThreadBlockSize: [1024 1024 64]
MaxGridSize: [2.1475e+09 65535 65535]
SIMDWidth: 32
TotalMemory: 6435504128 (6.44 GB)
AvailableMemory: 5375778816 (5.38 GB)
CachePolicy: ‘balanced’
MultiprocessorCount: 26
ClockRateKHz: 1200000
ComputeMode: ‘Default’
GPUOverlapsTransfers: 1
KernelExecutionTimeout: 1
CanMapHostMemory: 1
DeviceSupported: 1
DeviceAvailable: 1
DeviceSelected: 1
If I test coder.checkGpuInstall
coder.checkGpuInstall:
Compatible GPU : PASSED
CUDA Environment : PASSED
Runtime : PASSED
cuFFT : PASSED
cuSOLVER : PASSED
cuBLAS : PASSED
cuDNN Environment : FAILED (Error generated while determining cuDNN library version ‘Embedding metadata in the MEX file failed.
‘.)
Host Compiler : PASSED
Basic Code Generation : FAILED (GPU code generation failed with the error ’emlc:compilationError’. View report for further information: View report)
ans =
包含以下字段的 struct:
gpu: 1
cuda: 1
cudnn: 0
tensorrt: 0
hostcompiler: 1
basiccodegen: 0
basiccodeexec: 0
deepcodegen: 0
deepcodeexec: 0
tensorrtdatatype: 0
profiling: 0
test mex -setup
mex -setup
MEX 配置为使用 ‘MinGW64 Compiler (C)’ 以进行 C 语言编译。
要选择不同的 C 编译器,请从以下选项中选择一种命令:
MinGW64 Compiler (C) mex -setup:C:Users石海洋AppDataRoamingMathWorksMATLABR2023bmex_C_win64.xml C
Microsoft Visual C++ 2022 (C) mex -setup:’D:Program FilesMathWorksR2023Bbinwin64mexoptsmsvc2022.xml’ C
要选择不同的语言,请从以下选项中选择一种命令:
mex -setup C++
mex -setup FORTRAN
I looked throught the answers about ’emlc:compilationError’ and "Invalid CUDA device", and see the answer in GPU coder :basic Code Generation failed – MATLAB Answers – MATLAB Central, its issue is caused by a MATLAB version that is too low. However, after reviewing the relevant settings, my MATLAB version should support CUDA 11.8 and VS2022. So, what could be the problem?
PS: I installed cuDNN 8.9 (cudnn-windows-x86_64-8.9.7.29_cuda11-archive) and set the system environment variable `NVIDIA_CUDNN` to: `C:Program FilesNVIDIA GPU Computing ToolkitCUDAv11.8`. Why does the cuDNN Environment still show as failed here? gpu coder, basic code generation MATLAB Answers — New Questions
How can I generate trajectory and INS data from the GPS data I have?
I want to generate the trajectory using the GPS data I have in LLA (deg deg m).
Then I want to generate the IMU data from that trajectory.
My end goal is to apply insmargfilter to pose the Estimation and Orientation for a UAV in MATLAB.I want to generate the trajectory using the GPS data I have in LLA (deg deg m).
Then I want to generate the IMU data from that trajectory.
My end goal is to apply insmargfilter to pose the Estimation and Orientation for a UAV in MATLAB. I want to generate the trajectory using the GPS data I have in LLA (deg deg m).
Then I want to generate the IMU data from that trajectory.
My end goal is to apply insmargfilter to pose the Estimation and Orientation for a UAV in MATLAB. inertial navigation, gps, localisation, ins MATLAB Answers — New Questions
How do I check which universities has a campus wide license
I wanted to check if my university has a license for it login into the account does not seem like it. But surely I am doing something wrong because my mail works with almost everything that has a student plan. How can I check if my university is on the list or if not how can I get my university on itI wanted to check if my university has a license for it login into the account does not seem like it. But surely I am doing something wrong because my mail works with almost everything that has a student plan. How can I check if my university is on the list or if not how can I get my university on it I wanted to check if my university has a license for it login into the account does not seem like it. But surely I am doing something wrong because my mail works with almost everything that has a student plan. How can I check if my university is on the list or if not how can I get my university on it license MATLAB Answers — New Questions
sine wave measure differ
function y = generate_sine()
persistent t
Ts = 0.0001;
if isempty(t)
t = 0;
end
y = sin(377 * t);
t = t + Ts;
This is sine wave generator of 60 Hz.
when the scope set up is below, that isnt 60 Hz.
but same code, that is same function block and measure with sine wave block of 60 Hz , then measure 60 Hz
why?function y = generate_sine()
persistent t
Ts = 0.0001;
if isempty(t)
t = 0;
end
y = sin(377 * t);
t = t + Ts;
This is sine wave generator of 60 Hz.
when the scope set up is below, that isnt 60 Hz.
but same code, that is same function block and measure with sine wave block of 60 Hz , then measure 60 Hz
why? function y = generate_sine()
persistent t
Ts = 0.0001;
if isempty(t)
t = 0;
end
y = sin(377 * t);
t = t + Ts;
This is sine wave generator of 60 Hz.
when the scope set up is below, that isnt 60 Hz.
but same code, that is same function block and measure with sine wave block of 60 Hz , then measure 60 Hz
why? sine, simulink MATLAB Answers — New Questions
matlab simulink 대수루프 해결방법 문의
수소 탱크를 충전할 때 압력이 상승하여 탱크 내 온도가 상승하는데 외부로 열전달 현상을 통해서 열이 빠져나간다.
수소 탱크에 수소가 유입이 될 때 압력, 온도, 질량유량에 따라 내부 열전달 계수를 계산하고 반영해서 탱크에서의 온도를 예측하는 모델을 만들고 있는데 루프가 걸려서
블록 다이어그램 ‘Internal_Heat_Trasfer_Coefficient_Test_ver1_2023b’에 1개의 대수 루프가 있습니다. 루프에 대한 자세한 내용을 보려면 명령 Simulink.BlockDiagram.getAlgebraicLoops(‘Internal_Heat_Trasfer_Coefficient_Test_ver1_2023b’)을(를) 사용하거나 MATLAB 명령 창에 sldebug(‘Internal_Heat_Trasfer_Coefficient_Test_ver1_2023b’)을(를) 입력하여 명령줄 Simulink 디버거를 사용하십시오. 이 메시지를 제거하려면 대수 루프를 "안 함"으로 설정하십시오.
구성요소:Simulink | 범주:Block diagram 경고
다음이 포함된 대수 루프가 발견됨: Internal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/ /Power1Internal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/ /Sum1 (algebraic variable) Internal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/ /PowerInternal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/ /Product2Internal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/ /Sum2Internal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/ /Subsystem/Product5Internal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/ /Subsystem/PowerInternal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/ /Subsystem/LogInternal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/ /Subsystem/Product1Internal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/ /Subsystem/Log1Internal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/ /Subsystem/Product2Internal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/ /Subsystem/Product3Internal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/ /Subsystem/SquareInternal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/ /Subsystem/GainInternal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/ /Product (algebraic variable) Internal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/ /SumInternal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/ /Product1Internal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/ /Product3Internal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/ProductInternal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/Solver Configuration/EVAL_KEY/INPUT_1_1_1Internal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/Solver Configuration/EVAL_KEY/STATE_1 (discontinuity) Internal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/Solver Configuration/EVAL_KEY/OUTPUT_1_0Internal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/ /Math FunctionInternal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/GainInternal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/ /Math Function1Internal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/ /k/Product7 (algebraic variable) Internal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/ /Cp/Product7 (algebraic variable) Internal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/ /Cp/ProductInternal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/ /mu/Gain1Internal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/ /Product6 (algebraic variable) Internal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/ /mu/Product7 (algebraic variable) Internal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/ /rho/Product7 (algebraic variable) Internal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/ /rho/Gain1Internal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/ /Product4Internal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/ /Product5 (algebraic variable)
구성요소:Simulink | 범주:Model
대수 루프 내에서 불연속이 감지되었습니다. 해를 구하는 데 어려움이 있을 수 있습니다.
구성요소:Simulink | 범주:Model 경고
‘Internal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/ /Subsystem/Product5’에 0으로 나누기 발생
구성요소:Simulink | 범주:Block 경고
표시 안 함
‘Internal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/ /Subsystem/Power’에 거듭제곱 결과가 정의되어 있지 않습니다.
구성요소:Simulink | 범주:Block 경고
‘Internal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/ /Subsystem/Product1’에 0으로 나누기 발생
구성요소:Simulink | 범주:Block 경고
표시 안 함
‘Internal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/ /Subsystem/Log1’에 음수의 로그가 있습니다. ‘출력 신호 유형’을 복소수로 설정해 보십시오.
구성요소:Simulink | 범주:Block 경고
시뮬레이션을 실행하는 동안 오류가 발생하여 시뮬레이션이 종료되었습니다
원인:
시간 0.0에 계산된 ‘Internal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/ /Product’을(를) 포함하는 대수 루프의 대수 상태가 Inf 또는 NaN입니다. 해에 특이점이 있을 수 있습니다. 모델이 올바른 경우 고정 스텝 크기를 줄이거나 오차 허용오차를 좁혀 스텝 크기를 줄여 보십시오. 또는 대수 루프 변수 값의 초기 추측값을 조금 수정하십시오.
다음과 같은 오류가 뜬다.
압력과 온도는 물성값 구하기 위해 필요하고 질량유량은 Renolds number를 구하기 위해 필요하다.
Liner Thermal Mass, CFRP Thermal Mass, External Convective Heat Transfer, CFRP Conductive Heat Transfer 등등 블럭은 고정된 값을 사용해서 신경 안써도될 것 같다.
아래 사진은 simulink 설계도이다.수소 탱크를 충전할 때 압력이 상승하여 탱크 내 온도가 상승하는데 외부로 열전달 현상을 통해서 열이 빠져나간다.
수소 탱크에 수소가 유입이 될 때 압력, 온도, 질량유량에 따라 내부 열전달 계수를 계산하고 반영해서 탱크에서의 온도를 예측하는 모델을 만들고 있는데 루프가 걸려서
블록 다이어그램 ‘Internal_Heat_Trasfer_Coefficient_Test_ver1_2023b’에 1개의 대수 루프가 있습니다. 루프에 대한 자세한 내용을 보려면 명령 Simulink.BlockDiagram.getAlgebraicLoops(‘Internal_Heat_Trasfer_Coefficient_Test_ver1_2023b’)을(를) 사용하거나 MATLAB 명령 창에 sldebug(‘Internal_Heat_Trasfer_Coefficient_Test_ver1_2023b’)을(를) 입력하여 명령줄 Simulink 디버거를 사용하십시오. 이 메시지를 제거하려면 대수 루프를 "안 함"으로 설정하십시오.
구성요소:Simulink | 범주:Block diagram 경고
다음이 포함된 대수 루프가 발견됨: Internal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/ /Power1Internal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/ /Sum1 (algebraic variable) Internal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/ /PowerInternal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/ /Product2Internal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/ /Sum2Internal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/ /Subsystem/Product5Internal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/ /Subsystem/PowerInternal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/ /Subsystem/LogInternal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/ /Subsystem/Product1Internal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/ /Subsystem/Log1Internal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/ /Subsystem/Product2Internal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/ /Subsystem/Product3Internal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/ /Subsystem/SquareInternal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/ /Subsystem/GainInternal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/ /Product (algebraic variable) Internal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/ /SumInternal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/ /Product1Internal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/ /Product3Internal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/ProductInternal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/Solver Configuration/EVAL_KEY/INPUT_1_1_1Internal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/Solver Configuration/EVAL_KEY/STATE_1 (discontinuity) Internal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/Solver Configuration/EVAL_KEY/OUTPUT_1_0Internal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/ /Math FunctionInternal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/GainInternal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/ /Math Function1Internal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/ /k/Product7 (algebraic variable) Internal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/ /Cp/Product7 (algebraic variable) Internal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/ /Cp/ProductInternal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/ /mu/Gain1Internal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/ /Product6 (algebraic variable) Internal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/ /mu/Product7 (algebraic variable) Internal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/ /rho/Product7 (algebraic variable) Internal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/ /rho/Gain1Internal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/ /Product4Internal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/ /Product5 (algebraic variable)
구성요소:Simulink | 범주:Model
대수 루프 내에서 불연속이 감지되었습니다. 해를 구하는 데 어려움이 있을 수 있습니다.
구성요소:Simulink | 범주:Model 경고
‘Internal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/ /Subsystem/Product5’에 0으로 나누기 발생
구성요소:Simulink | 범주:Block 경고
표시 안 함
‘Internal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/ /Subsystem/Power’에 거듭제곱 결과가 정의되어 있지 않습니다.
구성요소:Simulink | 범주:Block 경고
‘Internal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/ /Subsystem/Product1’에 0으로 나누기 발생
구성요소:Simulink | 범주:Block 경고
표시 안 함
‘Internal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/ /Subsystem/Log1’에 음수의 로그가 있습니다. ‘출력 신호 유형’을 복소수로 설정해 보십시오.
구성요소:Simulink | 범주:Block 경고
시뮬레이션을 실행하는 동안 오류가 발생하여 시뮬레이션이 종료되었습니다
원인:
시간 0.0에 계산된 ‘Internal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/ /Product’을(를) 포함하는 대수 루프의 대수 상태가 Inf 또는 NaN입니다. 해에 특이점이 있을 수 있습니다. 모델이 올바른 경우 고정 스텝 크기를 줄이거나 오차 허용오차를 좁혀 스텝 크기를 줄여 보십시오. 또는 대수 루프 변수 값의 초기 추측값을 조금 수정하십시오.
다음과 같은 오류가 뜬다.
압력과 온도는 물성값 구하기 위해 필요하고 질량유량은 Renolds number를 구하기 위해 필요하다.
Liner Thermal Mass, CFRP Thermal Mass, External Convective Heat Transfer, CFRP Conductive Heat Transfer 등등 블럭은 고정된 값을 사용해서 신경 안써도될 것 같다.
아래 사진은 simulink 설계도이다. 수소 탱크를 충전할 때 압력이 상승하여 탱크 내 온도가 상승하는데 외부로 열전달 현상을 통해서 열이 빠져나간다.
수소 탱크에 수소가 유입이 될 때 압력, 온도, 질량유량에 따라 내부 열전달 계수를 계산하고 반영해서 탱크에서의 온도를 예측하는 모델을 만들고 있는데 루프가 걸려서
블록 다이어그램 ‘Internal_Heat_Trasfer_Coefficient_Test_ver1_2023b’에 1개의 대수 루프가 있습니다. 루프에 대한 자세한 내용을 보려면 명령 Simulink.BlockDiagram.getAlgebraicLoops(‘Internal_Heat_Trasfer_Coefficient_Test_ver1_2023b’)을(를) 사용하거나 MATLAB 명령 창에 sldebug(‘Internal_Heat_Trasfer_Coefficient_Test_ver1_2023b’)을(를) 입력하여 명령줄 Simulink 디버거를 사용하십시오. 이 메시지를 제거하려면 대수 루프를 "안 함"으로 설정하십시오.
구성요소:Simulink | 범주:Block diagram 경고
다음이 포함된 대수 루프가 발견됨: Internal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/ /Power1Internal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/ /Sum1 (algebraic variable) Internal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/ /PowerInternal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/ /Product2Internal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/ /Sum2Internal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/ /Subsystem/Product5Internal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/ /Subsystem/PowerInternal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/ /Subsystem/LogInternal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/ /Subsystem/Product1Internal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/ /Subsystem/Log1Internal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/ /Subsystem/Product2Internal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/ /Subsystem/Product3Internal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/ /Subsystem/SquareInternal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/ /Subsystem/GainInternal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/ /Product (algebraic variable) Internal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/ /SumInternal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/ /Product1Internal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/ /Product3Internal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/ProductInternal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/Solver Configuration/EVAL_KEY/INPUT_1_1_1Internal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/Solver Configuration/EVAL_KEY/STATE_1 (discontinuity) Internal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/Solver Configuration/EVAL_KEY/OUTPUT_1_0Internal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/ /Math FunctionInternal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/GainInternal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/ /Math Function1Internal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/ /k/Product7 (algebraic variable) Internal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/ /Cp/Product7 (algebraic variable) Internal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/ /Cp/ProductInternal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/ /mu/Gain1Internal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/ /Product6 (algebraic variable) Internal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/ /mu/Product7 (algebraic variable) Internal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/ /rho/Product7 (algebraic variable) Internal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/ /rho/Gain1Internal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/ /Product4Internal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/ /Product5 (algebraic variable)
구성요소:Simulink | 범주:Model
대수 루프 내에서 불연속이 감지되었습니다. 해를 구하는 데 어려움이 있을 수 있습니다.
구성요소:Simulink | 범주:Model 경고
‘Internal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/ /Subsystem/Product5’에 0으로 나누기 발생
구성요소:Simulink | 범주:Block 경고
표시 안 함
‘Internal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/ /Subsystem/Power’에 거듭제곱 결과가 정의되어 있지 않습니다.
구성요소:Simulink | 범주:Block 경고
‘Internal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/ /Subsystem/Product1’에 0으로 나누기 발생
구성요소:Simulink | 범주:Block 경고
표시 안 함
‘Internal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/ /Subsystem/Log1’에 음수의 로그가 있습니다. ‘출력 신호 유형’을 복소수로 설정해 보십시오.
구성요소:Simulink | 범주:Block 경고
시뮬레이션을 실행하는 동안 오류가 발생하여 시뮬레이션이 종료되었습니다
원인:
시간 0.0에 계산된 ‘Internal_Heat_Trasfer_Coefficient_Test_ver1_2023b/Subsystem/ /Product’을(를) 포함하는 대수 루프의 대수 상태가 Inf 또는 NaN입니다. 해에 특이점이 있을 수 있습니다. 모델이 올바른 경우 고정 스텝 크기를 줄이거나 오차 허용오차를 좁혀 스텝 크기를 줄여 보십시오. 또는 대수 루프 변수 값의 초기 추측값을 조금 수정하십시오.
다음과 같은 오류가 뜬다.
압력과 온도는 물성값 구하기 위해 필요하고 질량유량은 Renolds number를 구하기 위해 필요하다.
Liner Thermal Mass, CFRP Thermal Mass, External Convective Heat Transfer, CFRP Conductive Heat Transfer 등등 블럭은 고정된 값을 사용해서 신경 안써도될 것 같다.
아래 사진은 simulink 설계도이다. 수소충전, simulink, 대수루프 MATLAB Answers — New Questions
Debugging: Changing ode equation during integration
Hello everyone,
I’m imprementing an adjustment to my chemical reactor design regarding physical limitation, due to the kinetics the value of one specie goes negative (comuptationally correct, but not physically) to account for the "no more fuel no more reaction" scenario i introduced a if:
ReactionRate(2*ovr) = ReactionK(2)*C(4)* 1e6 /CatalystDensity; % kmol/kgcat/h
if y(ovr) < 0
ReactionRate(2*ovr) = 0; % kmol/kgcat/h
end
dydt(i) = NetRateProduction(i)*(1-VoidFraction)*CatalystDensity*mw(i)/G;
in this way the dydt=0 and the value after reaching 0 (or a small negligible negative value) should stay constant, but after integration i still see a trend that goes way past 0
-0.0978571895684889
-0.0978554762967198
-0.0978537439506636
-0.0978519924638089
since the Ode for this specie depends only on the ReactionRate if dydt+0 it should stay constant, or is an error due to the fact that to evaluate if the rate should be 0 or not i use y? i tried with the last value of y using the persistent variable
persistent y_prev
.
if y_prev(ovr) < 0
ReactionRate(2*ovr) = 0; % kmol/kgcat/h
end
%after the system of ODE
y_prev(ovr) = y(ovr)
how this happens? i tested with de-bugging to see if the Ode=0 if the condition on y is satisfied and eas zero, so a constant behaviour, but in the results the diminishing trend is still present.
Thank you so much for your helpHello everyone,
I’m imprementing an adjustment to my chemical reactor design regarding physical limitation, due to the kinetics the value of one specie goes negative (comuptationally correct, but not physically) to account for the "no more fuel no more reaction" scenario i introduced a if:
ReactionRate(2*ovr) = ReactionK(2)*C(4)* 1e6 /CatalystDensity; % kmol/kgcat/h
if y(ovr) < 0
ReactionRate(2*ovr) = 0; % kmol/kgcat/h
end
dydt(i) = NetRateProduction(i)*(1-VoidFraction)*CatalystDensity*mw(i)/G;
in this way the dydt=0 and the value after reaching 0 (or a small negligible negative value) should stay constant, but after integration i still see a trend that goes way past 0
-0.0978571895684889
-0.0978554762967198
-0.0978537439506636
-0.0978519924638089
since the Ode for this specie depends only on the ReactionRate if dydt+0 it should stay constant, or is an error due to the fact that to evaluate if the rate should be 0 or not i use y? i tried with the last value of y using the persistent variable
persistent y_prev
.
if y_prev(ovr) < 0
ReactionRate(2*ovr) = 0; % kmol/kgcat/h
end
%after the system of ODE
y_prev(ovr) = y(ovr)
how this happens? i tested with de-bugging to see if the Ode=0 if the condition on y is satisfied and eas zero, so a constant behaviour, but in the results the diminishing trend is still present.
Thank you so much for your help Hello everyone,
I’m imprementing an adjustment to my chemical reactor design regarding physical limitation, due to the kinetics the value of one specie goes negative (comuptationally correct, but not physically) to account for the "no more fuel no more reaction" scenario i introduced a if:
ReactionRate(2*ovr) = ReactionK(2)*C(4)* 1e6 /CatalystDensity; % kmol/kgcat/h
if y(ovr) < 0
ReactionRate(2*ovr) = 0; % kmol/kgcat/h
end
dydt(i) = NetRateProduction(i)*(1-VoidFraction)*CatalystDensity*mw(i)/G;
in this way the dydt=0 and the value after reaching 0 (or a small negligible negative value) should stay constant, but after integration i still see a trend that goes way past 0
-0.0978571895684889
-0.0978554762967198
-0.0978537439506636
-0.0978519924638089
since the Ode for this specie depends only on the ReactionRate if dydt+0 it should stay constant, or is an error due to the fact that to evaluate if the rate should be 0 or not i use y? i tried with the last value of y using the persistent variable
persistent y_prev
.
if y_prev(ovr) < 0
ReactionRate(2*ovr) = 0; % kmol/kgcat/h
end
%after the system of ODE
y_prev(ovr) = y(ovr)
how this happens? i tested with de-bugging to see if the Ode=0 if the condition on y is satisfied and eas zero, so a constant behaviour, but in the results the diminishing trend is still present.
Thank you so much for your help ode, if statement MATLAB Answers — New Questions