Category: News
Files Panel looks strange and path line is searching
Hello, I just installed Matlab R2025b
Its takes about 55 sec to open (bare Matlab, no addons), which is pretty long.
After opening there is a rotating "search ring" in the path at the upper line and no files in the File Panel. The searching ring runs forever. Also "open" button is not working, as no folder explorer appears. Please have a look in the enclosed picture. After reinstall the problem remains. Does Matlab needs any permissions? How to grant them under Windows10?Hello, I just installed Matlab R2025b
Its takes about 55 sec to open (bare Matlab, no addons), which is pretty long.
After opening there is a rotating "search ring" in the path at the upper line and no files in the File Panel. The searching ring runs forever. Also "open" button is not working, as no folder explorer appears. Please have a look in the enclosed picture. After reinstall the problem remains. Does Matlab needs any permissions? How to grant them under Windows10? Hello, I just installed Matlab R2025b
Its takes about 55 sec to open (bare Matlab, no addons), which is pretty long.
After opening there is a rotating "search ring" in the path at the upper line and no files in the File Panel. The searching ring runs forever. Also "open" button is not working, as no folder explorer appears. Please have a look in the enclosed picture. After reinstall the problem remains. Does Matlab needs any permissions? How to grant them under Windows10? startup time, file panel, new installation MATLAB Answers — New Questions
exportToFMU function in docker container error
I’m using Docker with mathworks/matlab-deps as a base image and I created the dockerfile following instructions at this site to create my custom dockerfile that installs necessary toolboxes and packages. I installed into the image the FMU_Builder_For_Simulink support package and also MATLAB_Coder, Simulink_Coder, MATLAB_Compiler, Simulink_Compiler and Simulink_Report_Generator.
The dockerfile is here:
FROM mathworks/matlab-deps:${MATLAB_RELEASE}
# Declare build arguments to use at the current build stage.
ARG MATLAB_RELEASE
ARG MATLAB_PRODUCT_LIST
ARG MATLAB_INSTALL_LOCATION
ARG LICENSE_SERVER
ARG INSTALLATION_USER
# Install mpm dependencies.
RUN export DEBIAN_FRONTEND=noninteractive
&& apt-get update
&& apt-get install –no-install-recommends –yes
gcc g++
wget
ca-certificates
&& apt-get clean
&& apt-get autoremove
&& rm -rf /var/lib/apt/lists/*
# Add "matlab" user and grant sudo permission.
RUN adduser –shell /bin/bash –disabled-password –gecos "" ${INSTALLATION_USER}
&& echo "${INSTALLATION_USER} ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/${INSTALLATION_USER}
&& chmod 0440 /etc/sudoers.d/${INSTALLATION_USER}
# Set user and work directory.
USER ${INSTALLATION_USER}
WORKDIR /home/${INSTALLATION_USER}
# Run mpm to install MATLAB in the target location and delete the mpm installation afterwards.
# If mpm fails to install successfully, then print the logfile in the terminal, otherwise clean up.
# Pass in $HOME variable to install support packages into the user’s HOME folder.
RUN wget -q https://www.mathworks.com/mpm/glnxa64/mpm
&& chmod +x mpm
&& sudo HOME=${HOME} ./mpm install
–release=${MATLAB_RELEASE}
–destination=${MATLAB_INSTALL_LOCATION}
–products ${MATLAB_PRODUCT_LIST}
|| (echo "MPM Installation Failure. See below for more information:" && cat /tmp/mathworks_root.log && false)
&& sudo rm -rf mpm /tmp/mathworks_root.log
&& sudo ln -s ${MATLAB_INSTALL_LOCATION}/bin/matlab /usr/local/bin/matlab
# Note: Uncomment one of the following two ways to configure the license server.
# Option 1. Specify the host and port of the machine that serves the network licenses
# if you want to store the license information in an environment variable. This
# is the preferred option. You can either use a build variable, like this:
# –build-arg LICENSE_SERVER=27000@MyServerName or you can specify the license server
# directly using: ENV MLM_LICENSE_FILE=27000@flexlm-server-name
ENV MLM_LICENSE_FILE=$LICENSE_SERVER
# Option 2. Alternatively, you can put a license file into the container.
# Enter the details of the license server in this file and uncomment the following line.
# COPY network.lic ${MATLAB_INSTALL_LOCATION}/licenses/
# The following environment variables allow MathWorks to understand how this MathWorks
# product (MATLAB Dockerfile) is being used. This information helps us make MATLAB even better.
# Your content, and information about the content within your files, is not shared with MathWorks.
# To opt out of this service, delete the environment variables defined in the following line.
# To learn more, see the Help Make MATLAB Even Better section in the accompanying README:
# https://github.com/mathworks-ref-arch/matlab-dockerfile#help-make-matlab-even-better
# ENV MW_DDUX_FORCE_ENABLE=true MW_CONTEXT_TAGS=MATLAB:DOCKERFILE:V1
ENTRYPOINT ["matlab"]
CMD [""]
I built the image. Then I wanted to use the function exportToFMU to build FMU for Linux inside the container, so inside the container in the matlab terminal I ran the command:
exportToFMU(‘model’, ‘FMIVersion’, ‘2.0’, ‘FMUType’, ‘CS’, ‘CreateModelAfterGeneratingFMU’, ‘off’);
The output looked like this:
Setting System Target to FMU Co-Simulation for model ‘model’.
Setting Hardware Implementation > Device Type to ‘MATLAB Host’ for model ‘model’.
### ‘GenerateComments’ is disabled for Co-Simulation Standalone FMU Export.
Fontconfig warning: "/usr/share/fontconfig/conf.avail/05-reset-dirs-sample.conf", line 6: unknown element "reset-dirs"
Fontconfig warning: "/usr/share/fontconfig/conf.avail/05-reset-dirs-sample.conf", line 6: unknown element "reset-dirs"
Build Summary
Top model targets built:
Model Action Rebuild Reason
=================================================================
model Failed Code generation information file does not exist.
0 of 1 models built (0 models already up to date)
Build duration: 0h 0m 25.552s
Error using script
Printing is not supported in -nodisplay mode.
It looks like there is a problem with the exportToFMU function when using -nodisplay mode of matlab. How can I make this work?
Thank you for your help!I’m using Docker with mathworks/matlab-deps as a base image and I created the dockerfile following instructions at this site to create my custom dockerfile that installs necessary toolboxes and packages. I installed into the image the FMU_Builder_For_Simulink support package and also MATLAB_Coder, Simulink_Coder, MATLAB_Compiler, Simulink_Compiler and Simulink_Report_Generator.
The dockerfile is here:
FROM mathworks/matlab-deps:${MATLAB_RELEASE}
# Declare build arguments to use at the current build stage.
ARG MATLAB_RELEASE
ARG MATLAB_PRODUCT_LIST
ARG MATLAB_INSTALL_LOCATION
ARG LICENSE_SERVER
ARG INSTALLATION_USER
# Install mpm dependencies.
RUN export DEBIAN_FRONTEND=noninteractive
&& apt-get update
&& apt-get install –no-install-recommends –yes
gcc g++
wget
ca-certificates
&& apt-get clean
&& apt-get autoremove
&& rm -rf /var/lib/apt/lists/*
# Add "matlab" user and grant sudo permission.
RUN adduser –shell /bin/bash –disabled-password –gecos "" ${INSTALLATION_USER}
&& echo "${INSTALLATION_USER} ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/${INSTALLATION_USER}
&& chmod 0440 /etc/sudoers.d/${INSTALLATION_USER}
# Set user and work directory.
USER ${INSTALLATION_USER}
WORKDIR /home/${INSTALLATION_USER}
# Run mpm to install MATLAB in the target location and delete the mpm installation afterwards.
# If mpm fails to install successfully, then print the logfile in the terminal, otherwise clean up.
# Pass in $HOME variable to install support packages into the user’s HOME folder.
RUN wget -q https://www.mathworks.com/mpm/glnxa64/mpm
&& chmod +x mpm
&& sudo HOME=${HOME} ./mpm install
–release=${MATLAB_RELEASE}
–destination=${MATLAB_INSTALL_LOCATION}
–products ${MATLAB_PRODUCT_LIST}
|| (echo "MPM Installation Failure. See below for more information:" && cat /tmp/mathworks_root.log && false)
&& sudo rm -rf mpm /tmp/mathworks_root.log
&& sudo ln -s ${MATLAB_INSTALL_LOCATION}/bin/matlab /usr/local/bin/matlab
# Note: Uncomment one of the following two ways to configure the license server.
# Option 1. Specify the host and port of the machine that serves the network licenses
# if you want to store the license information in an environment variable. This
# is the preferred option. You can either use a build variable, like this:
# –build-arg LICENSE_SERVER=27000@MyServerName or you can specify the license server
# directly using: ENV MLM_LICENSE_FILE=27000@flexlm-server-name
ENV MLM_LICENSE_FILE=$LICENSE_SERVER
# Option 2. Alternatively, you can put a license file into the container.
# Enter the details of the license server in this file and uncomment the following line.
# COPY network.lic ${MATLAB_INSTALL_LOCATION}/licenses/
# The following environment variables allow MathWorks to understand how this MathWorks
# product (MATLAB Dockerfile) is being used. This information helps us make MATLAB even better.
# Your content, and information about the content within your files, is not shared with MathWorks.
# To opt out of this service, delete the environment variables defined in the following line.
# To learn more, see the Help Make MATLAB Even Better section in the accompanying README:
# https://github.com/mathworks-ref-arch/matlab-dockerfile#help-make-matlab-even-better
# ENV MW_DDUX_FORCE_ENABLE=true MW_CONTEXT_TAGS=MATLAB:DOCKERFILE:V1
ENTRYPOINT ["matlab"]
CMD [""]
I built the image. Then I wanted to use the function exportToFMU to build FMU for Linux inside the container, so inside the container in the matlab terminal I ran the command:
exportToFMU(‘model’, ‘FMIVersion’, ‘2.0’, ‘FMUType’, ‘CS’, ‘CreateModelAfterGeneratingFMU’, ‘off’);
The output looked like this:
Setting System Target to FMU Co-Simulation for model ‘model’.
Setting Hardware Implementation > Device Type to ‘MATLAB Host’ for model ‘model’.
### ‘GenerateComments’ is disabled for Co-Simulation Standalone FMU Export.
Fontconfig warning: "/usr/share/fontconfig/conf.avail/05-reset-dirs-sample.conf", line 6: unknown element "reset-dirs"
Fontconfig warning: "/usr/share/fontconfig/conf.avail/05-reset-dirs-sample.conf", line 6: unknown element "reset-dirs"
Build Summary
Top model targets built:
Model Action Rebuild Reason
=================================================================
model Failed Code generation information file does not exist.
0 of 1 models built (0 models already up to date)
Build duration: 0h 0m 25.552s
Error using script
Printing is not supported in -nodisplay mode.
It looks like there is a problem with the exportToFMU function when using -nodisplay mode of matlab. How can I make this work?
Thank you for your help! I’m using Docker with mathworks/matlab-deps as a base image and I created the dockerfile following instructions at this site to create my custom dockerfile that installs necessary toolboxes and packages. I installed into the image the FMU_Builder_For_Simulink support package and also MATLAB_Coder, Simulink_Coder, MATLAB_Compiler, Simulink_Compiler and Simulink_Report_Generator.
The dockerfile is here:
FROM mathworks/matlab-deps:${MATLAB_RELEASE}
# Declare build arguments to use at the current build stage.
ARG MATLAB_RELEASE
ARG MATLAB_PRODUCT_LIST
ARG MATLAB_INSTALL_LOCATION
ARG LICENSE_SERVER
ARG INSTALLATION_USER
# Install mpm dependencies.
RUN export DEBIAN_FRONTEND=noninteractive
&& apt-get update
&& apt-get install –no-install-recommends –yes
gcc g++
wget
ca-certificates
&& apt-get clean
&& apt-get autoremove
&& rm -rf /var/lib/apt/lists/*
# Add "matlab" user and grant sudo permission.
RUN adduser –shell /bin/bash –disabled-password –gecos "" ${INSTALLATION_USER}
&& echo "${INSTALLATION_USER} ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/${INSTALLATION_USER}
&& chmod 0440 /etc/sudoers.d/${INSTALLATION_USER}
# Set user and work directory.
USER ${INSTALLATION_USER}
WORKDIR /home/${INSTALLATION_USER}
# Run mpm to install MATLAB in the target location and delete the mpm installation afterwards.
# If mpm fails to install successfully, then print the logfile in the terminal, otherwise clean up.
# Pass in $HOME variable to install support packages into the user’s HOME folder.
RUN wget -q https://www.mathworks.com/mpm/glnxa64/mpm
&& chmod +x mpm
&& sudo HOME=${HOME} ./mpm install
–release=${MATLAB_RELEASE}
–destination=${MATLAB_INSTALL_LOCATION}
–products ${MATLAB_PRODUCT_LIST}
|| (echo "MPM Installation Failure. See below for more information:" && cat /tmp/mathworks_root.log && false)
&& sudo rm -rf mpm /tmp/mathworks_root.log
&& sudo ln -s ${MATLAB_INSTALL_LOCATION}/bin/matlab /usr/local/bin/matlab
# Note: Uncomment one of the following two ways to configure the license server.
# Option 1. Specify the host and port of the machine that serves the network licenses
# if you want to store the license information in an environment variable. This
# is the preferred option. You can either use a build variable, like this:
# –build-arg LICENSE_SERVER=27000@MyServerName or you can specify the license server
# directly using: ENV MLM_LICENSE_FILE=27000@flexlm-server-name
ENV MLM_LICENSE_FILE=$LICENSE_SERVER
# Option 2. Alternatively, you can put a license file into the container.
# Enter the details of the license server in this file and uncomment the following line.
# COPY network.lic ${MATLAB_INSTALL_LOCATION}/licenses/
# The following environment variables allow MathWorks to understand how this MathWorks
# product (MATLAB Dockerfile) is being used. This information helps us make MATLAB even better.
# Your content, and information about the content within your files, is not shared with MathWorks.
# To opt out of this service, delete the environment variables defined in the following line.
# To learn more, see the Help Make MATLAB Even Better section in the accompanying README:
# https://github.com/mathworks-ref-arch/matlab-dockerfile#help-make-matlab-even-better
# ENV MW_DDUX_FORCE_ENABLE=true MW_CONTEXT_TAGS=MATLAB:DOCKERFILE:V1
ENTRYPOINT ["matlab"]
CMD [""]
I built the image. Then I wanted to use the function exportToFMU to build FMU for Linux inside the container, so inside the container in the matlab terminal I ran the command:
exportToFMU(‘model’, ‘FMIVersion’, ‘2.0’, ‘FMUType’, ‘CS’, ‘CreateModelAfterGeneratingFMU’, ‘off’);
The output looked like this:
Setting System Target to FMU Co-Simulation for model ‘model’.
Setting Hardware Implementation > Device Type to ‘MATLAB Host’ for model ‘model’.
### ‘GenerateComments’ is disabled for Co-Simulation Standalone FMU Export.
Fontconfig warning: "/usr/share/fontconfig/conf.avail/05-reset-dirs-sample.conf", line 6: unknown element "reset-dirs"
Fontconfig warning: "/usr/share/fontconfig/conf.avail/05-reset-dirs-sample.conf", line 6: unknown element "reset-dirs"
Build Summary
Top model targets built:
Model Action Rebuild Reason
=================================================================
model Failed Code generation information file does not exist.
0 of 1 models built (0 models already up to date)
Build duration: 0h 0m 25.552s
Error using script
Printing is not supported in -nodisplay mode.
It looks like there is a problem with the exportToFMU function when using -nodisplay mode of matlab. How can I make this work?
Thank you for your help! exporttofmu, docker, -nodisplay mode MATLAB Answers — New Questions
Why the optimization results of lsqnonlin are different in R2026a and R2025a?
I used the following code to solve a nonlinear optimization problem. All random seeds and optimization options are the same, but the result in the R2026a pre-release is complex-valued, whereas in R2025a or older releases the result is real-valued. All code and data are attached.
% R2025b or earier is real-base solution
% R2026a is complex-base solution?
R2025b:
load temp.mat
rng default;
options = optimoptions(‘lsqnonlin’, ‘Algorithm’,’levenberg-marquardt’, ‘Display’,’final’,…
‘MaxFunEvals’,2000, ‘MaxIter’,1e3, ‘TolFun’,1e-6, ‘TolX’,1e-6, ‘Jacobian’,’off’);
[x,resnorm,~,exitflag,output] = lsqnonlin(@(p)residual_KR_robust(double(X1_ok), double(X2_ok), imsize1, imsize2, p, 1000), [1000 1000 0 0 0],…
[],[])
R2026a:I used the following code to solve a nonlinear optimization problem. All random seeds and optimization options are the same, but the result in the R2026a pre-release is complex-valued, whereas in R2025a or older releases the result is real-valued. All code and data are attached.
% R2025b or earier is real-base solution
% R2026a is complex-base solution?
R2025b:
load temp.mat
rng default;
options = optimoptions(‘lsqnonlin’, ‘Algorithm’,’levenberg-marquardt’, ‘Display’,’final’,…
‘MaxFunEvals’,2000, ‘MaxIter’,1e3, ‘TolFun’,1e-6, ‘TolX’,1e-6, ‘Jacobian’,’off’);
[x,resnorm,~,exitflag,output] = lsqnonlin(@(p)residual_KR_robust(double(X1_ok), double(X2_ok), imsize1, imsize2, p, 1000), [1000 1000 0 0 0],…
[],[])
R2026a: I used the following code to solve a nonlinear optimization problem. All random seeds and optimization options are the same, but the result in the R2026a pre-release is complex-valued, whereas in R2025a or older releases the result is real-valued. All code and data are attached.
% R2025b or earier is real-base solution
% R2026a is complex-base solution?
R2025b:
load temp.mat
rng default;
options = optimoptions(‘lsqnonlin’, ‘Algorithm’,’levenberg-marquardt’, ‘Display’,’final’,…
‘MaxFunEvals’,2000, ‘MaxIter’,1e3, ‘TolFun’,1e-6, ‘TolX’,1e-6, ‘Jacobian’,’off’);
[x,resnorm,~,exitflag,output] = lsqnonlin(@(p)residual_KR_robust(double(X1_ok), double(X2_ok), imsize1, imsize2, p, 1000), [1000 1000 0 0 0],…
[],[])
R2026a: optimization MATLAB Answers — New Questions
print hexadecimal representation of 16 bit word
I keep messing it up
I’ve got a 16 bit word that’s supposed to be the hexadecimal representation of a number.
How do I print that hexadecimal representation?I keep messing it up
I’ve got a 16 bit word that’s supposed to be the hexadecimal representation of a number.
How do I print that hexadecimal representation? I keep messing it up
I’ve got a 16 bit word that’s supposed to be the hexadecimal representation of a number.
How do I print that hexadecimal representation? fprintf, hexidecimal MATLAB Answers — New Questions
Teams Gains Ability to Start Chat with Email Address
Chat with Email Addresses Causes Security Community Some Heartburn
Microsoft published message center notification MC1182004 on Halloween (Microsoft 365 roadmap item 513271) and announced that any Teams user will be able to start a chat with an external user by using their email address to add the external person to the chat. Essentially, this is a variant on federated chat with the big difference being that the external person doesn’t need to be a Teams user AND the external person is added to the host tenant as a guest account.
A reasonable amount of heat has been generated within the security community with most commentators agreeing that this is a bad idea because allowing Teams users to set up chats with external people using email addresses exposes another potential vector for infection to bring malware into the tenant. In fact, chatting through Teams is no more serious than allowing users to send email to remote addressees. It would be better if the feature was opt-in rather than opt-out, and even better if Microsoft provided some guidance about how to secure tenants against potential infection via Teams.
Initiating Chat with Email Addresses
To set up a chat with an email address, create a new chat and enter the email address of the user to chat with. Teams recognizes that the email address is not present in the tenant directory, so it creates a new guest account and stamps the external user with the external trust indicator (Figure 1).

While you can go ahead and add messages to the chat, the external user must accept the invitation before they can join the chat to respond. Charmingly, after sending a message, Teams informs the user that the invitation is on its way and might take a few minutes. This covers the time required for the email recipient to receive the message and then confirm details of their guest account, including going through multifactor authentication if mandated by conditional access policies.
After the guest account is confirmed, the chat proceeds just like any other chat with a guest, with all the normal restrictions on guests. For instance, while the guest can send URLs in messages, they can’t send file attachments. The only new thing that’s been added is the process to initiate creation of the guest account from chat.
It’s important to realize that after a guest account is added using this method, that account functions in the same way as any other guest. It can be added to the membership of Teams, Outlook groups, or even Exchange Online distribution lists, join group chats, and so on.
Managing the Chat with Email Address Feature
Although Microsoft enables the invite user to chat via email feature by default, it is subject to many controls. First, the feature can be disabled for some or all users by updating the Teams messaging policy assigned to user accounts. This isn’t possible yet in the Teams admin center, so it must be done in PowerShell. If your PC has the latest version of the Teams PowerShell module, you can update the policy today in advance of the feature’s arrival:
To find what messaging policies support external chat with email users, run:
Get-CsTeamsMessagingPolicy | Format-Table identity, UseB2BInvitesToAddExternalUsers
To block the feature for accounts assigned a specific policy, run the Set-CsTeamsMessagingPolicy cmdlet. Here’s an example:
Set-CsTeamsMessagingPolicy -Identity 'Restricted - No Chat' -UseB2BInvitesToAddExternalUsers $false
Second, because the user invited to the chat becomes a guest in the tenant, the user must be able to invite new guests (Figure 2). Normally, team owners can add new guests to team membership and users can add guests to share documents with SharePoint Online and OneDrive for Business, but the ability to invite guests can be restricted.

Third, the tenant B2B collaboration policy must allow users from the target email domain to be invited as guests. It’s quite common to block invitations from consumer email domains, for instance. If Teams cannot create a guest account for the external user, federated chat can’t happen.
Fourth, as mentioned above, guest accounts are subject to controls like multifactor authentication policies that might, for instance, require the new guest to use the Microsoft authenticator app as a secondary authentication method.
Last, consider using Microsoft Defender for Office 365 to protect Teams communications, including blocking malicious URLs sent in chat messages.
Like all other guest- and chat-related activities, the actions to create the new guest from the email address and their participation in the chat are captured in audit records in the Microsoft 365 audit log.
Chat with Email Addresses Causes Understandable Concern But Really Not That Bad
I understand why the security community think that adding the ability to chat with someone using their email address is a bad idea. However, some of the commentary that I have seen has been over the top and displays a lack of knowledge about how Teams and Entra ID B2B Collaboration work. The controls listed above are enough to keep everything in check. In security terms, the exposure through adding a guest to chat via an email address is no more than adding a guest to share a SharePoint Online or OneDrive for Business document.
Microsoft should have made chat with an email address an opt-in feature, but they probably think of this as simply an extension of existing functionality, and there’s some truth in that.
Insight like this doesn’t come easily. You’ve got to know the technology and understand how to look behind the scenes. Benefit from the knowledge and experience of the Office 365 for IT Pros team by subscribing to the best eBook covering Office 365 and the wider Microsoft 365 ecosystem.
How to plot multiple lines in a graph?
I have a matrix with several 5 layers. I want to plot the numbers at a specific gridpoint for layers 2,3, and 4. How would I go about doing this?
Thanks for the help!I have a matrix with several 5 layers. I want to plot the numbers at a specific gridpoint for layers 2,3, and 4. How would I go about doing this?
Thanks for the help! I have a matrix with several 5 layers. I want to plot the numbers at a specific gridpoint for layers 2,3, and 4. How would I go about doing this?
Thanks for the help! graph, plot, layers, i, j, k, matrix MATLAB Answers — New Questions
whats wrong in this function?
Hi:)
When I call the attached function with for instance best_salt_1=’ZnBr2′ and best_salt_2=’MgCl2′ and temperatur_1 = 40, I get this error saying:
Output argument "massetetthet_MgCl2" (and maybe others) not assigned during call to "beregn_massetetthet_mettetsaltlosning".
I dont understand I have set all the variables after each if block to something…and I know a similar function has worked for me earlier.Hi:)
When I call the attached function with for instance best_salt_1=’ZnBr2′ and best_salt_2=’MgCl2′ and temperatur_1 = 40, I get this error saying:
Output argument "massetetthet_MgCl2" (and maybe others) not assigned during call to "beregn_massetetthet_mettetsaltlosning".
I dont understand I have set all the variables after each if block to something…and I know a similar function has worked for me earlier. Hi:)
When I call the attached function with for instance best_salt_1=’ZnBr2′ and best_salt_2=’MgCl2′ and temperatur_1 = 40, I get this error saying:
Output argument "massetetthet_MgCl2" (and maybe others) not assigned during call to "beregn_massetetthet_mettetsaltlosning".
I dont understand I have set all the variables after each if block to something…and I know a similar function has worked for me earlier. matlab, strcmpi, if blocks MATLAB Answers — New Questions
Square voltage source and inductors.
Hi, I have this circuit. I’m trying to connect the controlled voltage souce as mentioned in other answers in order to get an square wave an see it in the scope but I can’t connect it. Any advice?Hi, I have this circuit. I’m trying to connect the controlled voltage souce as mentioned in other answers in order to get an square wave an see it in the scope but I can’t connect it. Any advice? Hi, I have this circuit. I’m trying to connect the controlled voltage souce as mentioned in other answers in order to get an square wave an see it in the scope but I can’t connect it. Any advice? square wave, voltage source, inductor MATLAB Answers — New Questions
Model meat through a freezer
Working on a project for school which entails modeling chicken as it goes through a freezer. Ive got the basic layout in place and have the freezing portion working like I want on a constant thermal mass. I am trying to figure out how to model the chicken as it woudl go through the freezer on a conveyor. I seet he conveyor block and maybe I can use that but dont knwo how to have the freezer act on it. Right now I have the thermnal mass block set to variable with the Mdot set to my pounds per hours and the Tin port set to the input temp of the chicken but it still acts like a constant mass.Working on a project for school which entails modeling chicken as it goes through a freezer. Ive got the basic layout in place and have the freezing portion working like I want on a constant thermal mass. I am trying to figure out how to model the chicken as it woudl go through the freezer on a conveyor. I seet he conveyor block and maybe I can use that but dont knwo how to have the freezer act on it. Right now I have the thermnal mass block set to variable with the Mdot set to my pounds per hours and the Tin port set to the input temp of the chicken but it still acts like a constant mass. Working on a project for school which entails modeling chicken as it goes through a freezer. Ive got the basic layout in place and have the freezing portion working like I want on a constant thermal mass. I am trying to figure out how to model the chicken as it woudl go through the freezer on a conveyor. I seet he conveyor block and maybe I can use that but dont knwo how to have the freezer act on it. Right now I have the thermnal mass block set to variable with the Mdot set to my pounds per hours and the Tin port set to the input temp of the chicken but it still acts like a constant mass. freezer chicken MATLAB Answers — New Questions
Placing java classes at the head of javaclasspath
I have been working on a java object that needs some logging facility. I implemented this with org.slf4j.simple.SimpleLogger. Here is a test:
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class Main {
static Logger log = LoggerFactory.getLogger(Main.class);
public static void main(String[] args) {
String message;
if (args.length == 0) {
message = "Hello world";
} else {
message = args[0];
}
new Main(message);
}
public Main(String message) {
System.out.println(LoggerFactory.class.getResource("LoggerFactory.class"));
log.info(message);
}
}
If I call Main(), it works and reports
$ java -jar target/logtest-1.0.jar
jar:file:/home/jeffemandel/logtest/target/logtest-1.0.jar!/org/slf4j/LoggerFactory.class
2025-11-09 11:12:55.494 [INFO] org.jeffmandel.logtest.Main – Hello world
From MATLAB, calling Main reports
>> Main(‘test’);
jar:file:/Applications/MATLAB_R2025b.app/java/jarext/slf4j/slf4j-api.jar!/org/slf4j/LoggerFactory.class
Since I don’t have log4j12 configured, the output goes to NOP.
As noted in this Stackoverflow answer, if I add the full path to slf4j-api-2.0.17.jar to my javaclasspath.txt with the tag <before>, I get the expected behavior:
>> Main(‘Hello world’);
jar:file:/Users/jeffemandel/.m2/repository/org/slf4j/slf4j-api/2.0.17/slf4j-api-2.0.17.jar!/org/slf4j/LoggerFactory.class
2025-11-09 11:24:47.349 [INFO] org.jeffmandel.logtest.Main – Hello world
Finally, if I add logtest-1.0.jar with the <before> tag, I don’t need to add slf4j-api-2.0.17.jar to javaclasspath.txt
>> Main(‘Hello world’);
jar:file:/Users/jeffemandel/MATLAB-Drive/dise_service/logtest-1.0.jar!/org/slf4j/LoggerFactory.class
2025-11-09 11:26:44.041 [INFO] org.jeffmandel.logtest.Main – Hello world
This seems to be the best approach, as it avoids cluttering up the classpath with jars I only need in my own objects.
Now I get that this is a long run for a short slide (I could just configure my object to use slf4j-log4j12), but according to the author of the SO post this undocumented feature has been around since 2013a, so maybe it should be a standard feature. I say this because on the way to understanding the issue, I saw the recommendation to edit the file that says don’t edit this file, and saw someone who solved the problem by deleting slf4j-api.jar from jarext.I have been working on a java object that needs some logging facility. I implemented this with org.slf4j.simple.SimpleLogger. Here is a test:
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class Main {
static Logger log = LoggerFactory.getLogger(Main.class);
public static void main(String[] args) {
String message;
if (args.length == 0) {
message = "Hello world";
} else {
message = args[0];
}
new Main(message);
}
public Main(String message) {
System.out.println(LoggerFactory.class.getResource("LoggerFactory.class"));
log.info(message);
}
}
If I call Main(), it works and reports
$ java -jar target/logtest-1.0.jar
jar:file:/home/jeffemandel/logtest/target/logtest-1.0.jar!/org/slf4j/LoggerFactory.class
2025-11-09 11:12:55.494 [INFO] org.jeffmandel.logtest.Main – Hello world
From MATLAB, calling Main reports
>> Main(‘test’);
jar:file:/Applications/MATLAB_R2025b.app/java/jarext/slf4j/slf4j-api.jar!/org/slf4j/LoggerFactory.class
Since I don’t have log4j12 configured, the output goes to NOP.
As noted in this Stackoverflow answer, if I add the full path to slf4j-api-2.0.17.jar to my javaclasspath.txt with the tag <before>, I get the expected behavior:
>> Main(‘Hello world’);
jar:file:/Users/jeffemandel/.m2/repository/org/slf4j/slf4j-api/2.0.17/slf4j-api-2.0.17.jar!/org/slf4j/LoggerFactory.class
2025-11-09 11:24:47.349 [INFO] org.jeffmandel.logtest.Main – Hello world
Finally, if I add logtest-1.0.jar with the <before> tag, I don’t need to add slf4j-api-2.0.17.jar to javaclasspath.txt
>> Main(‘Hello world’);
jar:file:/Users/jeffemandel/MATLAB-Drive/dise_service/logtest-1.0.jar!/org/slf4j/LoggerFactory.class
2025-11-09 11:26:44.041 [INFO] org.jeffmandel.logtest.Main – Hello world
This seems to be the best approach, as it avoids cluttering up the classpath with jars I only need in my own objects.
Now I get that this is a long run for a short slide (I could just configure my object to use slf4j-log4j12), but according to the author of the SO post this undocumented feature has been around since 2013a, so maybe it should be a standard feature. I say this because on the way to understanding the issue, I saw the recommendation to edit the file that says don’t edit this file, and saw someone who solved the problem by deleting slf4j-api.jar from jarext. I have been working on a java object that needs some logging facility. I implemented this with org.slf4j.simple.SimpleLogger. Here is a test:
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class Main {
static Logger log = LoggerFactory.getLogger(Main.class);
public static void main(String[] args) {
String message;
if (args.length == 0) {
message = "Hello world";
} else {
message = args[0];
}
new Main(message);
}
public Main(String message) {
System.out.println(LoggerFactory.class.getResource("LoggerFactory.class"));
log.info(message);
}
}
If I call Main(), it works and reports
$ java -jar target/logtest-1.0.jar
jar:file:/home/jeffemandel/logtest/target/logtest-1.0.jar!/org/slf4j/LoggerFactory.class
2025-11-09 11:12:55.494 [INFO] org.jeffmandel.logtest.Main – Hello world
From MATLAB, calling Main reports
>> Main(‘test’);
jar:file:/Applications/MATLAB_R2025b.app/java/jarext/slf4j/slf4j-api.jar!/org/slf4j/LoggerFactory.class
Since I don’t have log4j12 configured, the output goes to NOP.
As noted in this Stackoverflow answer, if I add the full path to slf4j-api-2.0.17.jar to my javaclasspath.txt with the tag <before>, I get the expected behavior:
>> Main(‘Hello world’);
jar:file:/Users/jeffemandel/.m2/repository/org/slf4j/slf4j-api/2.0.17/slf4j-api-2.0.17.jar!/org/slf4j/LoggerFactory.class
2025-11-09 11:24:47.349 [INFO] org.jeffmandel.logtest.Main – Hello world
Finally, if I add logtest-1.0.jar with the <before> tag, I don’t need to add slf4j-api-2.0.17.jar to javaclasspath.txt
>> Main(‘Hello world’);
jar:file:/Users/jeffemandel/MATLAB-Drive/dise_service/logtest-1.0.jar!/org/slf4j/LoggerFactory.class
2025-11-09 11:26:44.041 [INFO] org.jeffmandel.logtest.Main – Hello world
This seems to be the best approach, as it avoids cluttering up the classpath with jars I only need in my own objects.
Now I get that this is a long run for a short slide (I could just configure my object to use slf4j-log4j12), but according to the author of the SO post this undocumented feature has been around since 2013a, so maybe it should be a standard feature. I say this because on the way to understanding the issue, I saw the recommendation to edit the file that says don’t edit this file, and saw someone who solved the problem by deleting slf4j-api.jar from jarext. matlab, java, slf4j MATLAB Answers — New Questions
I have two same errors every time i paste a code to check
This is my task and here is code:
% Load the x-y-z positions into the variable R
load datafile.mat
m = 1.2; % particle mass in kg
% Find the center of mass location in a row vector rcm
rcm = mean(R);
% Find the moment of inertia matrix I, a 3-by-3 matrix
Ixx = sum(m*(R(:,2).^2+R(:,3).^2));
Iyy = sum(m*(R(:,1).^2 + R(:,3).^2));
Izz = sum(m*(R(:,1).^2 + R(:,2).^2));
Ixy = -sum(m * R(:,1) .* R(:,2));
Ixz = -sum(m * R(:,1) .* R(:,3));
Iyz = -sum(m * R(:,2) .*R(:,3));
% Composite main inertia matrix I
I = [ Ixx, Ixy, Ixz;
Ixy, Iyy, Iyz;
Ixz, Iyz, Izz ];
% Find the principal moment of inertia
[~,II] = eig(I);
and the errors are
I tried many different methods to solve this but non of them worked :/, thanks for any helpThis is my task and here is code:
% Load the x-y-z positions into the variable R
load datafile.mat
m = 1.2; % particle mass in kg
% Find the center of mass location in a row vector rcm
rcm = mean(R);
% Find the moment of inertia matrix I, a 3-by-3 matrix
Ixx = sum(m*(R(:,2).^2+R(:,3).^2));
Iyy = sum(m*(R(:,1).^2 + R(:,3).^2));
Izz = sum(m*(R(:,1).^2 + R(:,2).^2));
Ixy = -sum(m * R(:,1) .* R(:,2));
Ixz = -sum(m * R(:,1) .* R(:,3));
Iyz = -sum(m * R(:,2) .*R(:,3));
% Composite main inertia matrix I
I = [ Ixx, Ixy, Ixz;
Ixy, Iyy, Iyz;
Ixz, Iyz, Izz ];
% Find the principal moment of inertia
[~,II] = eig(I);
and the errors are
I tried many different methods to solve this but non of them worked :/, thanks for any help This is my task and here is code:
% Load the x-y-z positions into the variable R
load datafile.mat
m = 1.2; % particle mass in kg
% Find the center of mass location in a row vector rcm
rcm = mean(R);
% Find the moment of inertia matrix I, a 3-by-3 matrix
Ixx = sum(m*(R(:,2).^2+R(:,3).^2));
Iyy = sum(m*(R(:,1).^2 + R(:,3).^2));
Izz = sum(m*(R(:,1).^2 + R(:,2).^2));
Ixy = -sum(m * R(:,1) .* R(:,2));
Ixz = -sum(m * R(:,1) .* R(:,3));
Iyz = -sum(m * R(:,2) .*R(:,3));
% Composite main inertia matrix I
I = [ Ixx, Ixy, Ixz;
Ixy, Iyy, Iyz;
Ixz, Iyz, Izz ];
% Find the principal moment of inertia
[~,II] = eig(I);
and the errors are
I tried many different methods to solve this but non of them worked :/, thanks for any help moment of inertia, matrix MATLAB Answers — New Questions
Fitting exponential function, coefficients and errors
Dear experts,
I have experimental data for exponential distribution a*exp(b*x). I need to find coefficients a, b and their errors. I have used function fit(B,C, ‘exp1’) and I got some results. I have problem because some data points in my file have higher error rate because of the nature of experiment.
1.) Which algorithm or function in Matlab can give the smallest error ?
2.) How can I use/adopt some function in Matlab to put smaller weight (when I calculate coefficients) on data that drastically differ from exponential function ?
Thank you.Dear experts,
I have experimental data for exponential distribution a*exp(b*x). I need to find coefficients a, b and their errors. I have used function fit(B,C, ‘exp1’) and I got some results. I have problem because some data points in my file have higher error rate because of the nature of experiment.
1.) Which algorithm or function in Matlab can give the smallest error ?
2.) How can I use/adopt some function in Matlab to put smaller weight (when I calculate coefficients) on data that drastically differ from exponential function ?
Thank you. Dear experts,
I have experimental data for exponential distribution a*exp(b*x). I need to find coefficients a, b and their errors. I have used function fit(B,C, ‘exp1’) and I got some results. I have problem because some data points in my file have higher error rate because of the nature of experiment.
1.) Which algorithm or function in Matlab can give the smallest error ?
2.) How can I use/adopt some function in Matlab to put smaller weight (when I calculate coefficients) on data that drastically differ from exponential function ?
Thank you. fitting exponential function MATLAB Answers — New Questions
Matlab crash on startup
./matlab
MATLAB is selecting SOFTWARE rendering.
qt.qpa.plugin: Could not find the Qt platform plugin "wayland" in ""
QXcbGlxIntegration::initialize
Xcb GLX gl-integration successfully initialized
——————————————————————————–
Segmentation violation detected at 2025-11-08 15:30:44 +0100
——————————————————————————–
Configuration:
Crash Decoding : Disabled – No sandbox or build area path
Crash Mode : continue (default)
Default Encoding : UTF-8
Deployed : false
Desktop Environment : KDE
GNU C Library : 2.42 stable
Graphics Driver : Uninitialized software
Graphics card 1 : Not Started 0x10de ( 0x10de ) 0x28e1 Version 0.0.0.0 (0-0-0)
Graphics card 2 : 0x1002 ( 0x1002 ) 0x1901 Version 0.0.0.0 (0-0-0)
Java Version : Java 1.8.0_202-b08 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
MATLAB Architecture : glnxa64
MATLAB Entitlement ID : 5229650
MATLAB Root : /home/question/MATLAB
MATLAB Version : 24.2.0.2923080 (R2024b) Update 6
OpenGL : software
Operating System : "CachyOS"
Process ID : 5316
Processor ID : x86 Family 25 Model 124 Stepping 0, AuthenticAMD
Session Key : 1b93d498-7911-4e43-b8ff-23a17ac7c520
Window System : The X.Org Foundation (12401009), display :0
Fault Count: 1
Abnormal termination:
Segmentation violation
Current Thread: ‘MCR 0 interpret’ id 140540391716544
Register State (from fault):
RAX = 0000000000000000 RBX = 0000000000000000
RCX = 00007fd1a40008e0 RDX = 0000000000000010
RSP = 00007fd21c1fa730 RBP = 00000000444d4163
RSI = 0000000000000000 RDI = 00007fd1a4584fb0
R8 = 00007fd1a4000090 R9 = 0000000000000030
R10 = 0000000000000030 R11 = 00007fd1a4000030
R12 = 0000000000000000 R13 = 00007fd1a4b73b70
R14 = 0000000000000000 R15 = 0000000000000001
RIP = 00007fd289831c38 EFL = 0000000000010246
CS = 0033 FS = 0000 GS = 0000
Stack Trace (from fault):
[ 0] 0x00007fd289831c38 /home/question/MATLAB/bin/glnxa64/matlab_startup_plugins/lmgrimpl/libmwlmgrimpl.so+02300984 Ox3204a7d97fd297a1+00000552
[ 1] 0x00007fd289832977 /home/question/MATLAB/bin/glnxa64/matlab_startup_plugins/lmgrimpl/libmwlmgrimpl.so+02304375 lc_init+00000055
[ 2] 0x00007fd13ee646a8 /usr/lib/libgnutls.so.30+00411304
[ 3] 0x00007fd13ee264ef /usr/lib/libgnutls.so.30+00156911
[ 4] 0x00007fd35390ac7e /lib64/ld-linux-x86-64.so.2+00027774
[ 5] 0x00007fd35390ad83 /lib64/ld-linux-x86-64.so.2+00028035
[ 6] 0x00007fd353906557 /lib64/ld-linux-x86-64.so.2+00009559 _dl_catch_exception+00000279
[ 7] 0x00007fd353913078 /lib64/ld-linux-x86-64.so.2+00061560
[ 8] 0x00007fd3539064c4 /lib64/ld-linux-x86-64.so.2+00009412 _dl_catch_exception+00000132
[ 9] 0x00007fd353913566 /lib64/ld-linux-x86-64.so.2+00062822
[ 10] 0x00007fd351aa5f4c /usr/lib/libc.so.6+00679756
[ 11] 0x00007fd3539064c4 /lib64/ld-linux-x86-64.so.2+00009412 _dl_catch_exception+00000132
[ 12] 0x00007fd353906603 /lib64/ld-linux-x86-64.so.2+00009731
[ 13] 0x00007fd351aa59d7 /usr/lib/libc.so.6+00678359
[ 14] 0x00007fd351aa6019 /usr/lib/libc.so.6+00679961 dlopen+00000121
[ 15] 0x00007fd28a50e9e1 /home/question/MATLAB/sys/java/jre/glnxa64/jre/lib/amd64/server/libjvm.so+09497057
[ 16] 0x00007fd28a2fc539 /home/question/MATLAB/sys/java/jre/glnxa64/jre/lib/amd64/server/libjvm.so+07324985 JVM_LoadLibrary+00000153
[ 17] 0x00007fd23980e380 /home/question/MATLAB/sys/java/jre/glnxa64/jre/lib/amd64/libjava.so+00058240 Java_java_lang_ClassLoader_00024NativeLibrary_load+00000416
[ 18] 0x00007fd225018087 <unknown-module>+00000000
[ 19] 0x00007fd2250082bd <unknown-module>+00000000
[ 20] 0x00007fd225007a90 <unknown-module>+00000000
[ 21] 0x00007fd2250082bd <unknown-module>+00000000
[ 22] 0x00007fd2250082bd <unknown-module>+00000000
[ 23] 0x00007fd2250082bd <unknown-module>+00000000
[ 24] 0x00007fd2250082bd <unknown-module>+00000000
[ 25] 0x00007fd225008040 <unknown-module>+00000000
[ 26] 0x00007fd225008040 <unknown-module>+00000000
[ 27] 0x00007fd2250082bd <unknown-module>+00000000
[ 28] 0x00007fd2250082bd <unknown-module>+00000000
[ 29] 0x00007fd2250082bd <unknown-module>+00000000
[ 30] 0x00007fd2250082bd <unknown-module>+00000000
[ 31] 0x00007fd2250082bd <unknown-module>+00000000
[ 32] 0x00007fd225008114 <unknown-module>+00000000
[ 33] 0x00007fd225008040 <unknown-module>+00000000
[ 34] 0x00007fd225008040 <unknown-module>+00000000
[ 35] 0x00007fd225008040 <unknown-module>+00000000
[ 36] 0x00007fd225008040 <unknown-module>+00000000
[ 37] 0x00007fd225008040 <unknown-module>+00000000
[ 38] 0x00007fd2250082bd <unknown-module>+00000000
[ 39] 0x00007fd225e33c4c <unknown-module>+00000000
[ 40] 0x00007fd2250082bd <unknown-module>+00000000
[ 41] 0x00007fd2250082bd <unknown-module>+00000000
[ 42] 0x00007fd225008040 <unknown-module>+00000000
[ 43] 0x00007fd2250007a7 <unknown-module>+00000000
[ 44] 0x00007fd28a28839b /home/question/MATLAB/sys/java/jre/glnxa64/jre/lib/amd64/server/libjvm.so+06849435
[ 45] 0x00007fd28a3005e4 /home/question/MATLAB/sys/java/jre/glnxa64/jre/lib/amd64/server/libjvm.so+07341540 JVM_DoPrivileged+00001268
[ 46] 0x00007fd2253938d5 <unknown-module>+00000000
[ 47] 0x00007fd225d10784 <unknown-module>+00000000
[ 48] 0x00007fd225d132fc <unknown-module>+00000000
[ 49] 0x00007fd2250082bd <unknown-module>+00000000
[ 50] 0x00007fd2250082bd <unknown-module>+00000000
[ 51] 0x00007fd2250082bd <unknown-module>+00000000
[ 52] 0x00007fd2250082bd <unknown-module>+00000000
[ 53] 0x00007fd2250007a7 <unknown-module>+00000000
[ 54] 0x00007fd28a28839b /home/question/MATLAB/sys/java/jre/glnxa64/jre/lib/amd64/server/libjvm.so+06849435
[ 55] 0x00007fd28a285c63 /home/question/MATLAB/sys/java/jre/glnxa64/jre/lib/amd64/server/libjvm.so+06839395
[ 56] 0x00007fd28a286227 /home/question/MATLAB/sys/java/jre/glnxa64/jre/lib/amd64/server/libjvm.so+06840871
[ 57] 0x00007fd28a2f239c /home/question/MATLAB/sys/java/jre/glnxa64/jre/lib/amd64/server/libjvm.so+07283612
[ 58] 0x00007fd28a67b9eb /home/question/MATLAB/sys/java/jre/glnxa64/jre/lib/amd64/server/libjvm.so+10992107
[ 59] 0x00007fd28a67bcf1 /home/question/MATLAB/sys/java/jre/glnxa64/jre/lib/amd64/server/libjvm.so+10992881
[ 60] 0x00007fd28a50d8c2 /home/question/MATLAB/sys/java/jre/glnxa64/jre/lib/amd64/server/libjvm.so+09492674
[ 61] 0x00007fd351aaa4f8 /usr/lib/libc.so.6+00697592
[ 62] 0x00007fd351b40fdc /usr/lib/libc.so.6+01314780
** This crash report has been saved to disk as /home/question/matlab_crash_dump.5316-1 **
MATLAB is exiting because of fatal error
fish: Job 1, ‘./matlab’ terminated by signal SIGKILL (Forced quit)
~/MATLAB/bin 13s
❯ ./matlab -nojvm
MATLAB is selecting SOFTWARE rendering.
< M A T L A B (R) >
Copyright 1984-2024 The MathWorks, Inc.
R2024b Update 6 (24.2.0.2923080) 64-bit (glnxa64)
March 28, 2025
For online documentation, see https://www.mathworks.com/support
For product information, visit www.mathworks.com../matlab
MATLAB is selecting SOFTWARE rendering.
qt.qpa.plugin: Could not find the Qt platform plugin "wayland" in ""
QXcbGlxIntegration::initialize
Xcb GLX gl-integration successfully initialized
——————————————————————————–
Segmentation violation detected at 2025-11-08 15:30:44 +0100
——————————————————————————–
Configuration:
Crash Decoding : Disabled – No sandbox or build area path
Crash Mode : continue (default)
Default Encoding : UTF-8
Deployed : false
Desktop Environment : KDE
GNU C Library : 2.42 stable
Graphics Driver : Uninitialized software
Graphics card 1 : Not Started 0x10de ( 0x10de ) 0x28e1 Version 0.0.0.0 (0-0-0)
Graphics card 2 : 0x1002 ( 0x1002 ) 0x1901 Version 0.0.0.0 (0-0-0)
Java Version : Java 1.8.0_202-b08 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
MATLAB Architecture : glnxa64
MATLAB Entitlement ID : 5229650
MATLAB Root : /home/question/MATLAB
MATLAB Version : 24.2.0.2923080 (R2024b) Update 6
OpenGL : software
Operating System : "CachyOS"
Process ID : 5316
Processor ID : x86 Family 25 Model 124 Stepping 0, AuthenticAMD
Session Key : 1b93d498-7911-4e43-b8ff-23a17ac7c520
Window System : The X.Org Foundation (12401009), display :0
Fault Count: 1
Abnormal termination:
Segmentation violation
Current Thread: ‘MCR 0 interpret’ id 140540391716544
Register State (from fault):
RAX = 0000000000000000 RBX = 0000000000000000
RCX = 00007fd1a40008e0 RDX = 0000000000000010
RSP = 00007fd21c1fa730 RBP = 00000000444d4163
RSI = 0000000000000000 RDI = 00007fd1a4584fb0
R8 = 00007fd1a4000090 R9 = 0000000000000030
R10 = 0000000000000030 R11 = 00007fd1a4000030
R12 = 0000000000000000 R13 = 00007fd1a4b73b70
R14 = 0000000000000000 R15 = 0000000000000001
RIP = 00007fd289831c38 EFL = 0000000000010246
CS = 0033 FS = 0000 GS = 0000
Stack Trace (from fault):
[ 0] 0x00007fd289831c38 /home/question/MATLAB/bin/glnxa64/matlab_startup_plugins/lmgrimpl/libmwlmgrimpl.so+02300984 Ox3204a7d97fd297a1+00000552
[ 1] 0x00007fd289832977 /home/question/MATLAB/bin/glnxa64/matlab_startup_plugins/lmgrimpl/libmwlmgrimpl.so+02304375 lc_init+00000055
[ 2] 0x00007fd13ee646a8 /usr/lib/libgnutls.so.30+00411304
[ 3] 0x00007fd13ee264ef /usr/lib/libgnutls.so.30+00156911
[ 4] 0x00007fd35390ac7e /lib64/ld-linux-x86-64.so.2+00027774
[ 5] 0x00007fd35390ad83 /lib64/ld-linux-x86-64.so.2+00028035
[ 6] 0x00007fd353906557 /lib64/ld-linux-x86-64.so.2+00009559 _dl_catch_exception+00000279
[ 7] 0x00007fd353913078 /lib64/ld-linux-x86-64.so.2+00061560
[ 8] 0x00007fd3539064c4 /lib64/ld-linux-x86-64.so.2+00009412 _dl_catch_exception+00000132
[ 9] 0x00007fd353913566 /lib64/ld-linux-x86-64.so.2+00062822
[ 10] 0x00007fd351aa5f4c /usr/lib/libc.so.6+00679756
[ 11] 0x00007fd3539064c4 /lib64/ld-linux-x86-64.so.2+00009412 _dl_catch_exception+00000132
[ 12] 0x00007fd353906603 /lib64/ld-linux-x86-64.so.2+00009731
[ 13] 0x00007fd351aa59d7 /usr/lib/libc.so.6+00678359
[ 14] 0x00007fd351aa6019 /usr/lib/libc.so.6+00679961 dlopen+00000121
[ 15] 0x00007fd28a50e9e1 /home/question/MATLAB/sys/java/jre/glnxa64/jre/lib/amd64/server/libjvm.so+09497057
[ 16] 0x00007fd28a2fc539 /home/question/MATLAB/sys/java/jre/glnxa64/jre/lib/amd64/server/libjvm.so+07324985 JVM_LoadLibrary+00000153
[ 17] 0x00007fd23980e380 /home/question/MATLAB/sys/java/jre/glnxa64/jre/lib/amd64/libjava.so+00058240 Java_java_lang_ClassLoader_00024NativeLibrary_load+00000416
[ 18] 0x00007fd225018087 <unknown-module>+00000000
[ 19] 0x00007fd2250082bd <unknown-module>+00000000
[ 20] 0x00007fd225007a90 <unknown-module>+00000000
[ 21] 0x00007fd2250082bd <unknown-module>+00000000
[ 22] 0x00007fd2250082bd <unknown-module>+00000000
[ 23] 0x00007fd2250082bd <unknown-module>+00000000
[ 24] 0x00007fd2250082bd <unknown-module>+00000000
[ 25] 0x00007fd225008040 <unknown-module>+00000000
[ 26] 0x00007fd225008040 <unknown-module>+00000000
[ 27] 0x00007fd2250082bd <unknown-module>+00000000
[ 28] 0x00007fd2250082bd <unknown-module>+00000000
[ 29] 0x00007fd2250082bd <unknown-module>+00000000
[ 30] 0x00007fd2250082bd <unknown-module>+00000000
[ 31] 0x00007fd2250082bd <unknown-module>+00000000
[ 32] 0x00007fd225008114 <unknown-module>+00000000
[ 33] 0x00007fd225008040 <unknown-module>+00000000
[ 34] 0x00007fd225008040 <unknown-module>+00000000
[ 35] 0x00007fd225008040 <unknown-module>+00000000
[ 36] 0x00007fd225008040 <unknown-module>+00000000
[ 37] 0x00007fd225008040 <unknown-module>+00000000
[ 38] 0x00007fd2250082bd <unknown-module>+00000000
[ 39] 0x00007fd225e33c4c <unknown-module>+00000000
[ 40] 0x00007fd2250082bd <unknown-module>+00000000
[ 41] 0x00007fd2250082bd <unknown-module>+00000000
[ 42] 0x00007fd225008040 <unknown-module>+00000000
[ 43] 0x00007fd2250007a7 <unknown-module>+00000000
[ 44] 0x00007fd28a28839b /home/question/MATLAB/sys/java/jre/glnxa64/jre/lib/amd64/server/libjvm.so+06849435
[ 45] 0x00007fd28a3005e4 /home/question/MATLAB/sys/java/jre/glnxa64/jre/lib/amd64/server/libjvm.so+07341540 JVM_DoPrivileged+00001268
[ 46] 0x00007fd2253938d5 <unknown-module>+00000000
[ 47] 0x00007fd225d10784 <unknown-module>+00000000
[ 48] 0x00007fd225d132fc <unknown-module>+00000000
[ 49] 0x00007fd2250082bd <unknown-module>+00000000
[ 50] 0x00007fd2250082bd <unknown-module>+00000000
[ 51] 0x00007fd2250082bd <unknown-module>+00000000
[ 52] 0x00007fd2250082bd <unknown-module>+00000000
[ 53] 0x00007fd2250007a7 <unknown-module>+00000000
[ 54] 0x00007fd28a28839b /home/question/MATLAB/sys/java/jre/glnxa64/jre/lib/amd64/server/libjvm.so+06849435
[ 55] 0x00007fd28a285c63 /home/question/MATLAB/sys/java/jre/glnxa64/jre/lib/amd64/server/libjvm.so+06839395
[ 56] 0x00007fd28a286227 /home/question/MATLAB/sys/java/jre/glnxa64/jre/lib/amd64/server/libjvm.so+06840871
[ 57] 0x00007fd28a2f239c /home/question/MATLAB/sys/java/jre/glnxa64/jre/lib/amd64/server/libjvm.so+07283612
[ 58] 0x00007fd28a67b9eb /home/question/MATLAB/sys/java/jre/glnxa64/jre/lib/amd64/server/libjvm.so+10992107
[ 59] 0x00007fd28a67bcf1 /home/question/MATLAB/sys/java/jre/glnxa64/jre/lib/amd64/server/libjvm.so+10992881
[ 60] 0x00007fd28a50d8c2 /home/question/MATLAB/sys/java/jre/glnxa64/jre/lib/amd64/server/libjvm.so+09492674
[ 61] 0x00007fd351aaa4f8 /usr/lib/libc.so.6+00697592
[ 62] 0x00007fd351b40fdc /usr/lib/libc.so.6+01314780
** This crash report has been saved to disk as /home/question/matlab_crash_dump.5316-1 **
MATLAB is exiting because of fatal error
fish: Job 1, ‘./matlab’ terminated by signal SIGKILL (Forced quit)
~/MATLAB/bin 13s
❯ ./matlab -nojvm
MATLAB is selecting SOFTWARE rendering.
< M A T L A B (R) >
Copyright 1984-2024 The MathWorks, Inc.
R2024b Update 6 (24.2.0.2923080) 64-bit (glnxa64)
March 28, 2025
For online documentation, see https://www.mathworks.com/support
For product information, visit www.mathworks.com. ./matlab
MATLAB is selecting SOFTWARE rendering.
qt.qpa.plugin: Could not find the Qt platform plugin "wayland" in ""
QXcbGlxIntegration::initialize
Xcb GLX gl-integration successfully initialized
——————————————————————————–
Segmentation violation detected at 2025-11-08 15:30:44 +0100
——————————————————————————–
Configuration:
Crash Decoding : Disabled – No sandbox or build area path
Crash Mode : continue (default)
Default Encoding : UTF-8
Deployed : false
Desktop Environment : KDE
GNU C Library : 2.42 stable
Graphics Driver : Uninitialized software
Graphics card 1 : Not Started 0x10de ( 0x10de ) 0x28e1 Version 0.0.0.0 (0-0-0)
Graphics card 2 : 0x1002 ( 0x1002 ) 0x1901 Version 0.0.0.0 (0-0-0)
Java Version : Java 1.8.0_202-b08 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
MATLAB Architecture : glnxa64
MATLAB Entitlement ID : 5229650
MATLAB Root : /home/question/MATLAB
MATLAB Version : 24.2.0.2923080 (R2024b) Update 6
OpenGL : software
Operating System : "CachyOS"
Process ID : 5316
Processor ID : x86 Family 25 Model 124 Stepping 0, AuthenticAMD
Session Key : 1b93d498-7911-4e43-b8ff-23a17ac7c520
Window System : The X.Org Foundation (12401009), display :0
Fault Count: 1
Abnormal termination:
Segmentation violation
Current Thread: ‘MCR 0 interpret’ id 140540391716544
Register State (from fault):
RAX = 0000000000000000 RBX = 0000000000000000
RCX = 00007fd1a40008e0 RDX = 0000000000000010
RSP = 00007fd21c1fa730 RBP = 00000000444d4163
RSI = 0000000000000000 RDI = 00007fd1a4584fb0
R8 = 00007fd1a4000090 R9 = 0000000000000030
R10 = 0000000000000030 R11 = 00007fd1a4000030
R12 = 0000000000000000 R13 = 00007fd1a4b73b70
R14 = 0000000000000000 R15 = 0000000000000001
RIP = 00007fd289831c38 EFL = 0000000000010246
CS = 0033 FS = 0000 GS = 0000
Stack Trace (from fault):
[ 0] 0x00007fd289831c38 /home/question/MATLAB/bin/glnxa64/matlab_startup_plugins/lmgrimpl/libmwlmgrimpl.so+02300984 Ox3204a7d97fd297a1+00000552
[ 1] 0x00007fd289832977 /home/question/MATLAB/bin/glnxa64/matlab_startup_plugins/lmgrimpl/libmwlmgrimpl.so+02304375 lc_init+00000055
[ 2] 0x00007fd13ee646a8 /usr/lib/libgnutls.so.30+00411304
[ 3] 0x00007fd13ee264ef /usr/lib/libgnutls.so.30+00156911
[ 4] 0x00007fd35390ac7e /lib64/ld-linux-x86-64.so.2+00027774
[ 5] 0x00007fd35390ad83 /lib64/ld-linux-x86-64.so.2+00028035
[ 6] 0x00007fd353906557 /lib64/ld-linux-x86-64.so.2+00009559 _dl_catch_exception+00000279
[ 7] 0x00007fd353913078 /lib64/ld-linux-x86-64.so.2+00061560
[ 8] 0x00007fd3539064c4 /lib64/ld-linux-x86-64.so.2+00009412 _dl_catch_exception+00000132
[ 9] 0x00007fd353913566 /lib64/ld-linux-x86-64.so.2+00062822
[ 10] 0x00007fd351aa5f4c /usr/lib/libc.so.6+00679756
[ 11] 0x00007fd3539064c4 /lib64/ld-linux-x86-64.so.2+00009412 _dl_catch_exception+00000132
[ 12] 0x00007fd353906603 /lib64/ld-linux-x86-64.so.2+00009731
[ 13] 0x00007fd351aa59d7 /usr/lib/libc.so.6+00678359
[ 14] 0x00007fd351aa6019 /usr/lib/libc.so.6+00679961 dlopen+00000121
[ 15] 0x00007fd28a50e9e1 /home/question/MATLAB/sys/java/jre/glnxa64/jre/lib/amd64/server/libjvm.so+09497057
[ 16] 0x00007fd28a2fc539 /home/question/MATLAB/sys/java/jre/glnxa64/jre/lib/amd64/server/libjvm.so+07324985 JVM_LoadLibrary+00000153
[ 17] 0x00007fd23980e380 /home/question/MATLAB/sys/java/jre/glnxa64/jre/lib/amd64/libjava.so+00058240 Java_java_lang_ClassLoader_00024NativeLibrary_load+00000416
[ 18] 0x00007fd225018087 <unknown-module>+00000000
[ 19] 0x00007fd2250082bd <unknown-module>+00000000
[ 20] 0x00007fd225007a90 <unknown-module>+00000000
[ 21] 0x00007fd2250082bd <unknown-module>+00000000
[ 22] 0x00007fd2250082bd <unknown-module>+00000000
[ 23] 0x00007fd2250082bd <unknown-module>+00000000
[ 24] 0x00007fd2250082bd <unknown-module>+00000000
[ 25] 0x00007fd225008040 <unknown-module>+00000000
[ 26] 0x00007fd225008040 <unknown-module>+00000000
[ 27] 0x00007fd2250082bd <unknown-module>+00000000
[ 28] 0x00007fd2250082bd <unknown-module>+00000000
[ 29] 0x00007fd2250082bd <unknown-module>+00000000
[ 30] 0x00007fd2250082bd <unknown-module>+00000000
[ 31] 0x00007fd2250082bd <unknown-module>+00000000
[ 32] 0x00007fd225008114 <unknown-module>+00000000
[ 33] 0x00007fd225008040 <unknown-module>+00000000
[ 34] 0x00007fd225008040 <unknown-module>+00000000
[ 35] 0x00007fd225008040 <unknown-module>+00000000
[ 36] 0x00007fd225008040 <unknown-module>+00000000
[ 37] 0x00007fd225008040 <unknown-module>+00000000
[ 38] 0x00007fd2250082bd <unknown-module>+00000000
[ 39] 0x00007fd225e33c4c <unknown-module>+00000000
[ 40] 0x00007fd2250082bd <unknown-module>+00000000
[ 41] 0x00007fd2250082bd <unknown-module>+00000000
[ 42] 0x00007fd225008040 <unknown-module>+00000000
[ 43] 0x00007fd2250007a7 <unknown-module>+00000000
[ 44] 0x00007fd28a28839b /home/question/MATLAB/sys/java/jre/glnxa64/jre/lib/amd64/server/libjvm.so+06849435
[ 45] 0x00007fd28a3005e4 /home/question/MATLAB/sys/java/jre/glnxa64/jre/lib/amd64/server/libjvm.so+07341540 JVM_DoPrivileged+00001268
[ 46] 0x00007fd2253938d5 <unknown-module>+00000000
[ 47] 0x00007fd225d10784 <unknown-module>+00000000
[ 48] 0x00007fd225d132fc <unknown-module>+00000000
[ 49] 0x00007fd2250082bd <unknown-module>+00000000
[ 50] 0x00007fd2250082bd <unknown-module>+00000000
[ 51] 0x00007fd2250082bd <unknown-module>+00000000
[ 52] 0x00007fd2250082bd <unknown-module>+00000000
[ 53] 0x00007fd2250007a7 <unknown-module>+00000000
[ 54] 0x00007fd28a28839b /home/question/MATLAB/sys/java/jre/glnxa64/jre/lib/amd64/server/libjvm.so+06849435
[ 55] 0x00007fd28a285c63 /home/question/MATLAB/sys/java/jre/glnxa64/jre/lib/amd64/server/libjvm.so+06839395
[ 56] 0x00007fd28a286227 /home/question/MATLAB/sys/java/jre/glnxa64/jre/lib/amd64/server/libjvm.so+06840871
[ 57] 0x00007fd28a2f239c /home/question/MATLAB/sys/java/jre/glnxa64/jre/lib/amd64/server/libjvm.so+07283612
[ 58] 0x00007fd28a67b9eb /home/question/MATLAB/sys/java/jre/glnxa64/jre/lib/amd64/server/libjvm.so+10992107
[ 59] 0x00007fd28a67bcf1 /home/question/MATLAB/sys/java/jre/glnxa64/jre/lib/amd64/server/libjvm.so+10992881
[ 60] 0x00007fd28a50d8c2 /home/question/MATLAB/sys/java/jre/glnxa64/jre/lib/amd64/server/libjvm.so+09492674
[ 61] 0x00007fd351aaa4f8 /usr/lib/libc.so.6+00697592
[ 62] 0x00007fd351b40fdc /usr/lib/libc.so.6+01314780
** This crash report has been saved to disk as /home/question/matlab_crash_dump.5316-1 **
MATLAB is exiting because of fatal error
fish: Job 1, ‘./matlab’ terminated by signal SIGKILL (Forced quit)
~/MATLAB/bin 13s
❯ ./matlab -nojvm
MATLAB is selecting SOFTWARE rendering.
< M A T L A B (R) >
Copyright 1984-2024 The MathWorks, Inc.
R2024b Update 6 (24.2.0.2923080) 64-bit (glnxa64)
March 28, 2025
For online documentation, see https://www.mathworks.com/support
For product information, visit www.mathworks.com. crash, graphics MATLAB Answers — New Questions
Trouble removing gravity from calibrated IMU acceleration (dual ICM-20948 + quaternions)
Hi everyone,
I’m working on a project where I collect motion data using two ICM-20948 IMUs connected to an ESP32. I apply a 6-pose accelerometer calibration on the microcontroller and later process the data in MATLAB to obtain linear acceleration in the global frame (gravity-free). However, even after rotating the accelerometer data using the quaternions and subtracting gravity, the results still don’t look correct.
Before assuming my processing is wrong, I want to double-check with the community whether my MATLAB approach for gravity removal is correct — and whether I’m handling the quaternion convention properly.📍 Data Acquisition Pipeline (short summary)
Hardware: ESP32 + 2× ICM-20948
I use the ICM20948_WE library
On the ESP32 I:✅ Read accel & gyro✅ Apply bias + gain from 6-pose calibration✅ Log calibrated accel (in g), calibrated gyro, and quaternions
No magnetometer used (so yaw may drift, but recordings are 30–120 s only)
Data is saved as:
q0 q1 q2 q3 ax ay az gx gy gz
🧠 MATLAB Processing (core part of code)
Below is the section where I align the IMU with the global frame and remove gravity. I use the first ~5 s (static) to estimate the gravity direction, align the IMU Z-axis to global Z, rotate accel using the quaternions, and subtract gravity:
%% CORREÇÃO DA ORIENTAÇÃO INICIAL (PERÍODO PARADO)
fprintf(‘n— Correção da Orientação Inicial (5 s parado) —n’);
G = 9.80665; % m/s²
Fs_my = 1 / mean(diff(T.t_s));
Nrest = round(5 * Fs_my);
% IMU1
a1_rest = [T.a1x(1:Nrest), T.a1y(1:Nrest), T.a1z(1:Nrest)];
g_est1 = mean(a1_rest, 1);
g_est1 = g_est1 / norm(g_est1);
% direção da gravidade medida
% Quaternion inicial
Q1 = [T.q10, T.q11, T.q12, T.q13];
if mean(abs(Q1(:,1))) < mean(abs(Q1(:,4)))
Q1 = [Q1(:,4), Q1(:,1:3)]; % tentar garantir [w x y z]
end
Q1 = Q1 ./ vecnorm(Q1,2,2);
% Vetor Z global ideal
z_ref = [0 0 1];
% Calcular rotação para alinhar g_est1 -> z_ref
v = cross(g_est1, z_ref);
s = norm(v);
if s ~= 0
c = dot(g_est1, z_ref);
v_skew = [0 -v(3) v(2); v(3) 0 -v(1); -v(2) v(1) 0];
R_align = eye(3) + v_skew + v_skew^2 * ((1 – c)/(s^2));
else
R_align = eye(3);
end
% Converter aceleração e alinhar
a1 = [T.a1x, T.a1y, T.a1z];
a1_gbl = quatrotate(Q1, a1);
a1_gbl_corr = (R_align * a1_gbl’)’;
% Remover gravidade
a1_free_gbl = a1_gbl_corr – [0 0 G];
(I apply the same procedure for IMU2 if present.)📎 Example of the issue
When visualizing the acceleration before and after gravity removal, the result still does not look physically correct, despite the 6-pose calibration and quaternion rotation.
Image 1: Before gravity removal
Image 2: After gravity removal — still incorrect)
❓ My Main Questions
Is my approach to rotate acceleration into the global frame and remove gravity mathematically correct?(Or am I applying the alignment/rotation in the wrong order?)
Should gravity be removed before or after applying R_align?Some posts suggest subtracting gravity in the sensor frame, others in global frame.
Quaternion convention:I’m assuming MATLAB’s quatrotate expects [w x y z] (scalar-first).Am I handling the quaternion conversion correctly here, or could this be a mismatch with the ICM-20948 library?
Given that I’m not using the magnetometer:For recordings of 30–120 s, is yaw drift likely to significantly affect gravity removal, or should it still work reasonably well?
Any help or guidance would be greatly appreciated — especially if someone spots a conceptual mistake or if there’s a more robust approach to handle gravity removal for this sensor.
Thanks in advance!Hi everyone,
I’m working on a project where I collect motion data using two ICM-20948 IMUs connected to an ESP32. I apply a 6-pose accelerometer calibration on the microcontroller and later process the data in MATLAB to obtain linear acceleration in the global frame (gravity-free). However, even after rotating the accelerometer data using the quaternions and subtracting gravity, the results still don’t look correct.
Before assuming my processing is wrong, I want to double-check with the community whether my MATLAB approach for gravity removal is correct — and whether I’m handling the quaternion convention properly.📍 Data Acquisition Pipeline (short summary)
Hardware: ESP32 + 2× ICM-20948
I use the ICM20948_WE library
On the ESP32 I:✅ Read accel & gyro✅ Apply bias + gain from 6-pose calibration✅ Log calibrated accel (in g), calibrated gyro, and quaternions
No magnetometer used (so yaw may drift, but recordings are 30–120 s only)
Data is saved as:
q0 q1 q2 q3 ax ay az gx gy gz
🧠 MATLAB Processing (core part of code)
Below is the section where I align the IMU with the global frame and remove gravity. I use the first ~5 s (static) to estimate the gravity direction, align the IMU Z-axis to global Z, rotate accel using the quaternions, and subtract gravity:
%% CORREÇÃO DA ORIENTAÇÃO INICIAL (PERÍODO PARADO)
fprintf(‘n— Correção da Orientação Inicial (5 s parado) —n’);
G = 9.80665; % m/s²
Fs_my = 1 / mean(diff(T.t_s));
Nrest = round(5 * Fs_my);
% IMU1
a1_rest = [T.a1x(1:Nrest), T.a1y(1:Nrest), T.a1z(1:Nrest)];
g_est1 = mean(a1_rest, 1);
g_est1 = g_est1 / norm(g_est1);
% direção da gravidade medida
% Quaternion inicial
Q1 = [T.q10, T.q11, T.q12, T.q13];
if mean(abs(Q1(:,1))) < mean(abs(Q1(:,4)))
Q1 = [Q1(:,4), Q1(:,1:3)]; % tentar garantir [w x y z]
end
Q1 = Q1 ./ vecnorm(Q1,2,2);
% Vetor Z global ideal
z_ref = [0 0 1];
% Calcular rotação para alinhar g_est1 -> z_ref
v = cross(g_est1, z_ref);
s = norm(v);
if s ~= 0
c = dot(g_est1, z_ref);
v_skew = [0 -v(3) v(2); v(3) 0 -v(1); -v(2) v(1) 0];
R_align = eye(3) + v_skew + v_skew^2 * ((1 – c)/(s^2));
else
R_align = eye(3);
end
% Converter aceleração e alinhar
a1 = [T.a1x, T.a1y, T.a1z];
a1_gbl = quatrotate(Q1, a1);
a1_gbl_corr = (R_align * a1_gbl’)’;
% Remover gravidade
a1_free_gbl = a1_gbl_corr – [0 0 G];
(I apply the same procedure for IMU2 if present.)📎 Example of the issue
When visualizing the acceleration before and after gravity removal, the result still does not look physically correct, despite the 6-pose calibration and quaternion rotation.
Image 1: Before gravity removal
Image 2: After gravity removal — still incorrect)
❓ My Main Questions
Is my approach to rotate acceleration into the global frame and remove gravity mathematically correct?(Or am I applying the alignment/rotation in the wrong order?)
Should gravity be removed before or after applying R_align?Some posts suggest subtracting gravity in the sensor frame, others in global frame.
Quaternion convention:I’m assuming MATLAB’s quatrotate expects [w x y z] (scalar-first).Am I handling the quaternion conversion correctly here, or could this be a mismatch with the ICM-20948 library?
Given that I’m not using the magnetometer:For recordings of 30–120 s, is yaw drift likely to significantly affect gravity removal, or should it still work reasonably well?
Any help or guidance would be greatly appreciated — especially if someone spots a conceptual mistake or if there’s a more robust approach to handle gravity removal for this sensor.
Thanks in advance! Hi everyone,
I’m working on a project where I collect motion data using two ICM-20948 IMUs connected to an ESP32. I apply a 6-pose accelerometer calibration on the microcontroller and later process the data in MATLAB to obtain linear acceleration in the global frame (gravity-free). However, even after rotating the accelerometer data using the quaternions and subtracting gravity, the results still don’t look correct.
Before assuming my processing is wrong, I want to double-check with the community whether my MATLAB approach for gravity removal is correct — and whether I’m handling the quaternion convention properly.📍 Data Acquisition Pipeline (short summary)
Hardware: ESP32 + 2× ICM-20948
I use the ICM20948_WE library
On the ESP32 I:✅ Read accel & gyro✅ Apply bias + gain from 6-pose calibration✅ Log calibrated accel (in g), calibrated gyro, and quaternions
No magnetometer used (so yaw may drift, but recordings are 30–120 s only)
Data is saved as:
q0 q1 q2 q3 ax ay az gx gy gz
🧠 MATLAB Processing (core part of code)
Below is the section where I align the IMU with the global frame and remove gravity. I use the first ~5 s (static) to estimate the gravity direction, align the IMU Z-axis to global Z, rotate accel using the quaternions, and subtract gravity:
%% CORREÇÃO DA ORIENTAÇÃO INICIAL (PERÍODO PARADO)
fprintf(‘n— Correção da Orientação Inicial (5 s parado) —n’);
G = 9.80665; % m/s²
Fs_my = 1 / mean(diff(T.t_s));
Nrest = round(5 * Fs_my);
% IMU1
a1_rest = [T.a1x(1:Nrest), T.a1y(1:Nrest), T.a1z(1:Nrest)];
g_est1 = mean(a1_rest, 1);
g_est1 = g_est1 / norm(g_est1);
% direção da gravidade medida
% Quaternion inicial
Q1 = [T.q10, T.q11, T.q12, T.q13];
if mean(abs(Q1(:,1))) < mean(abs(Q1(:,4)))
Q1 = [Q1(:,4), Q1(:,1:3)]; % tentar garantir [w x y z]
end
Q1 = Q1 ./ vecnorm(Q1,2,2);
% Vetor Z global ideal
z_ref = [0 0 1];
% Calcular rotação para alinhar g_est1 -> z_ref
v = cross(g_est1, z_ref);
s = norm(v);
if s ~= 0
c = dot(g_est1, z_ref);
v_skew = [0 -v(3) v(2); v(3) 0 -v(1); -v(2) v(1) 0];
R_align = eye(3) + v_skew + v_skew^2 * ((1 – c)/(s^2));
else
R_align = eye(3);
end
% Converter aceleração e alinhar
a1 = [T.a1x, T.a1y, T.a1z];
a1_gbl = quatrotate(Q1, a1);
a1_gbl_corr = (R_align * a1_gbl’)’;
% Remover gravidade
a1_free_gbl = a1_gbl_corr – [0 0 G];
(I apply the same procedure for IMU2 if present.)📎 Example of the issue
When visualizing the acceleration before and after gravity removal, the result still does not look physically correct, despite the 6-pose calibration and quaternion rotation.
Image 1: Before gravity removal
Image 2: After gravity removal — still incorrect)
❓ My Main Questions
Is my approach to rotate acceleration into the global frame and remove gravity mathematically correct?(Or am I applying the alignment/rotation in the wrong order?)
Should gravity be removed before or after applying R_align?Some posts suggest subtracting gravity in the sensor frame, others in global frame.
Quaternion convention:I’m assuming MATLAB’s quatrotate expects [w x y z] (scalar-first).Am I handling the quaternion conversion correctly here, or could this be a mismatch with the ICM-20948 library?
Given that I’m not using the magnetometer:For recordings of 30–120 s, is yaw drift likely to significantly affect gravity removal, or should it still work reasonably well?
Any help or guidance would be greatly appreciated — especially if someone spots a conceptual mistake or if there’s a more robust approach to handle gravity removal for this sensor.
Thanks in advance! imu, quaternions, preprocessing, acceleration, icm20948, esp32 MATLAB Answers — New Questions
What is the best practice to understand the source code of MATLAB’s built function ?
I want to learn the basic theory of wavelet synchrosqueezed transform, and find that there is a built-in function wsst in the Wavelet Toolbox. I open the wsst file using the dbtype wsst command so that the source code of the wsst is illustrated in the Command Window. However, I find that there are many complex function callls in the calculation process of wsst, it is difficult to get insight into the detailed calculation procedure of wsst. I would like to receive some useful advice from the mathworks community on how to better understand Matlab’s built-in complex functions, such as the aforementioned wsst function.I want to learn the basic theory of wavelet synchrosqueezed transform, and find that there is a built-in function wsst in the Wavelet Toolbox. I open the wsst file using the dbtype wsst command so that the source code of the wsst is illustrated in the Command Window. However, I find that there are many complex function callls in the calculation process of wsst, it is difficult to get insight into the detailed calculation procedure of wsst. I would like to receive some useful advice from the mathworks community on how to better understand Matlab’s built-in complex functions, such as the aforementioned wsst function. I want to learn the basic theory of wavelet synchrosqueezed transform, and find that there is a built-in function wsst in the Wavelet Toolbox. I open the wsst file using the dbtype wsst command so that the source code of the wsst is illustrated in the Command Window. However, I find that there are many complex function callls in the calculation process of wsst, it is difficult to get insight into the detailed calculation procedure of wsst. I would like to receive some useful advice from the mathworks community on how to better understand Matlab’s built-in complex functions, such as the aforementioned wsst function. wavelet, signal processing, matlab function MATLAB Answers — New Questions
When using noiseParameters functions, why do I have to set the impedance to 1 and not 50.
I have created a cascade of S-Parameter files using the RF Toolbox. When I use the noiseParameters function for the active elements to calculate the noise figure, I notice that to get a noise figure close to what I have calculated manually, I need to set the impedance to 1 Ohm.
However, I am certain that these S-Parameter files represent 50 Ohm systems. This discrepancy is concerning, and I would appreciate any insights or suggestions on how to resolve this issue.
Thank you!I have created a cascade of S-Parameter files using the RF Toolbox. When I use the noiseParameters function for the active elements to calculate the noise figure, I notice that to get a noise figure close to what I have calculated manually, I need to set the impedance to 1 Ohm.
However, I am certain that these S-Parameter files represent 50 Ohm systems. This discrepancy is concerning, and I would appreciate any insights or suggestions on how to resolve this issue.
Thank you! I have created a cascade of S-Parameter files using the RF Toolbox. When I use the noiseParameters function for the active elements to calculate the noise figure, I notice that to get a noise figure close to what I have calculated manually, I need to set the impedance to 1 Ohm.
However, I am certain that these S-Parameter files represent 50 Ohm systems. This discrepancy is concerning, and I would appreciate any insights or suggestions on how to resolve this issue.
Thank you! cascade, noiseparameters MATLAB Answers — New Questions
Quick substitution of all multi-objective optimization results (gamultiobj) into optimization expressions
I’m using problem-based optimization formulation for the first time (it’s great!) and I’ve been struggling a bit with how to interact seamlessly with the results. My optimization is multi-objective and the setup has the following characteristics:
Using problem-based optimization formulation, I’m defining many variables using optimvar (e.g., rho, D, W)
From there I’m defining objective and constraint functions as OptimizationExpression objects, e.g. V=pi*(D/2)^2*W, M=rho*V (simplified but still relevant to my actual problem)
In my case, minimizing volume V is one of the objectives, but M is a part of another objective as well as some constraints, so I would like to quickly evaluate the OptimizationExpression M over the optimization results (Pareto front) returned within sol and use it in some post-processing plots.
After much experimentation, I did find that I can substitute a particular result by index into an existing OptimizationExpression object using the following syntax:
ii=10; % Index of solution I’m interested in
solStruct=struct(sol(ii));
Mval=evaluate(M,solStruct.Values);
Obviously I can build a loop over ii to get an array Mval, but is there a way to do it more elegantly? (And am I using the intended method to evaluate a single solution from the optimization?)I’m using problem-based optimization formulation for the first time (it’s great!) and I’ve been struggling a bit with how to interact seamlessly with the results. My optimization is multi-objective and the setup has the following characteristics:
Using problem-based optimization formulation, I’m defining many variables using optimvar (e.g., rho, D, W)
From there I’m defining objective and constraint functions as OptimizationExpression objects, e.g. V=pi*(D/2)^2*W, M=rho*V (simplified but still relevant to my actual problem)
In my case, minimizing volume V is one of the objectives, but M is a part of another objective as well as some constraints, so I would like to quickly evaluate the OptimizationExpression M over the optimization results (Pareto front) returned within sol and use it in some post-processing plots.
After much experimentation, I did find that I can substitute a particular result by index into an existing OptimizationExpression object using the following syntax:
ii=10; % Index of solution I’m interested in
solStruct=struct(sol(ii));
Mval=evaluate(M,solStruct.Values);
Obviously I can build a loop over ii to get an array Mval, but is there a way to do it more elegantly? (And am I using the intended method to evaluate a single solution from the optimization?) I’m using problem-based optimization formulation for the first time (it’s great!) and I’ve been struggling a bit with how to interact seamlessly with the results. My optimization is multi-objective and the setup has the following characteristics:
Using problem-based optimization formulation, I’m defining many variables using optimvar (e.g., rho, D, W)
From there I’m defining objective and constraint functions as OptimizationExpression objects, e.g. V=pi*(D/2)^2*W, M=rho*V (simplified but still relevant to my actual problem)
In my case, minimizing volume V is one of the objectives, but M is a part of another objective as well as some constraints, so I would like to quickly evaluate the OptimizationExpression M over the optimization results (Pareto front) returned within sol and use it in some post-processing plots.
After much experimentation, I did find that I can substitute a particular result by index into an existing OptimizationExpression object using the following syntax:
ii=10; % Index of solution I’m interested in
solStruct=struct(sol(ii));
Mval=evaluate(M,solStruct.Values);
Obviously I can build a loop over ii to get an array Mval, but is there a way to do it more elegantly? (And am I using the intended method to evaluate a single solution from the optimization?) optimization, multi-objective optimization, gamultiobj, problem-based optimization MATLAB Answers — New Questions
Namespace not recognized when used in a function called from an app
I have an app that calls a function in an external file. The function references a class in a namespace directory (beginning with a +). I set up the paths in the app to include the namespace directory’s parent folder and not the namespace directory. When the app calls the function, the function generates a MATLAB:UndefinedFunction error that it cannot locate the namespace.class. When I debug I stop at the problematic line and can access the namespace as normal in the debug command line. I can execute the code of the line where the error occurs, but if I click continue in the debugger the code fails.
Simplified exemple code:
MyProject/
+MyNameSpace/
MyClass.m
MyApp.mlapp
MyFunction.m
startup.m
MyClass.m:
classdef MyClass
properties
value = 1;
end
end
MyFunction.m:
function value = MyFunction()
value = MyNameSpace.MyClass.value;
end
startup.m:
function startup
% Determine where your m-file’s folder is.
folder = fileparts(which(mfilename));
% Add that folder plus all subfolders to the path.
addpath(folder);
end
Then inside the MyApp.mlapp I use the startupFcn method that is called by the constructor to call startup.m:
function startupFcn(app)
startup
end
And a button callback to call MyFunction:
% Button pushed function: RunButton
function RunButtonPushed(app, event)
value = MyFunction();
end
The returned error states:
"Unrecognized function or variable ‘MyNameSpace’."I have an app that calls a function in an external file. The function references a class in a namespace directory (beginning with a +). I set up the paths in the app to include the namespace directory’s parent folder and not the namespace directory. When the app calls the function, the function generates a MATLAB:UndefinedFunction error that it cannot locate the namespace.class. When I debug I stop at the problematic line and can access the namespace as normal in the debug command line. I can execute the code of the line where the error occurs, but if I click continue in the debugger the code fails.
Simplified exemple code:
MyProject/
+MyNameSpace/
MyClass.m
MyApp.mlapp
MyFunction.m
startup.m
MyClass.m:
classdef MyClass
properties
value = 1;
end
end
MyFunction.m:
function value = MyFunction()
value = MyNameSpace.MyClass.value;
end
startup.m:
function startup
% Determine where your m-file’s folder is.
folder = fileparts(which(mfilename));
% Add that folder plus all subfolders to the path.
addpath(folder);
end
Then inside the MyApp.mlapp I use the startupFcn method that is called by the constructor to call startup.m:
function startupFcn(app)
startup
end
And a button callback to call MyFunction:
% Button pushed function: RunButton
function RunButtonPushed(app, event)
value = MyFunction();
end
The returned error states:
"Unrecognized function or variable ‘MyNameSpace’." I have an app that calls a function in an external file. The function references a class in a namespace directory (beginning with a +). I set up the paths in the app to include the namespace directory’s parent folder and not the namespace directory. When the app calls the function, the function generates a MATLAB:UndefinedFunction error that it cannot locate the namespace.class. When I debug I stop at the problematic line and can access the namespace as normal in the debug command line. I can execute the code of the line where the error occurs, but if I click continue in the debugger the code fails.
Simplified exemple code:
MyProject/
+MyNameSpace/
MyClass.m
MyApp.mlapp
MyFunction.m
startup.m
MyClass.m:
classdef MyClass
properties
value = 1;
end
end
MyFunction.m:
function value = MyFunction()
value = MyNameSpace.MyClass.value;
end
startup.m:
function startup
% Determine where your m-file’s folder is.
folder = fileparts(which(mfilename));
% Add that folder plus all subfolders to the path.
addpath(folder);
end
Then inside the MyApp.mlapp I use the startupFcn method that is called by the constructor to call startup.m:
function startupFcn(app)
startup
end
And a button callback to call MyFunction:
% Button pushed function: RunButton
function RunButtonPushed(app, event)
value = MyFunction();
end
The returned error states:
"Unrecognized function or variable ‘MyNameSpace’." app designer, namespaces, classes MATLAB Answers — New Questions
What am I supposed to put in magnetization inductance?
Hi,
I want to simulate this push-pull DC-DC converter in simulink:
I am modifying the magnetization inductance (Lm) for a value that is appropriate for my specs: Vin = 137.14 V (it comes from a previous stage),Vout = 350 V, D = 0.13, Iin = 7 A (approx.). I see that even if I set it in SI units, it says (pu) for the magnetization inductance. It confuses me because I was trying to have 1 mH or 10 mH to avoid an overvoltage and I don’t know in which units it’s actually. I was also trying with higher values of Lm but I have that peak at the beginning. In fact I have seen 2 situations.
A) Overvoltage, then stabilizes but the value was a few volts far from the reference. This is the case when magnetization inductance is 0.0.
B) Overvoltage, then starts dropping to 155 V.
Can someone tell me what are the expected values in the parameters of the transformer for such specs and in which units is calculating Lm when I set it in SI units?
Also, the input current has this aspect:
Thanks.
CarlosHi,
I want to simulate this push-pull DC-DC converter in simulink:
I am modifying the magnetization inductance (Lm) for a value that is appropriate for my specs: Vin = 137.14 V (it comes from a previous stage),Vout = 350 V, D = 0.13, Iin = 7 A (approx.). I see that even if I set it in SI units, it says (pu) for the magnetization inductance. It confuses me because I was trying to have 1 mH or 10 mH to avoid an overvoltage and I don’t know in which units it’s actually. I was also trying with higher values of Lm but I have that peak at the beginning. In fact I have seen 2 situations.
A) Overvoltage, then stabilizes but the value was a few volts far from the reference. This is the case when magnetization inductance is 0.0.
B) Overvoltage, then starts dropping to 155 V.
Can someone tell me what are the expected values in the parameters of the transformer for such specs and in which units is calculating Lm when I set it in SI units?
Also, the input current has this aspect:
Thanks.
Carlos Hi,
I want to simulate this push-pull DC-DC converter in simulink:
I am modifying the magnetization inductance (Lm) for a value that is appropriate for my specs: Vin = 137.14 V (it comes from a previous stage),Vout = 350 V, D = 0.13, Iin = 7 A (approx.). I see that even if I set it in SI units, it says (pu) for the magnetization inductance. It confuses me because I was trying to have 1 mH or 10 mH to avoid an overvoltage and I don’t know in which units it’s actually. I was also trying with higher values of Lm but I have that peak at the beginning. In fact I have seen 2 situations.
A) Overvoltage, then stabilizes but the value was a few volts far from the reference. This is the case when magnetization inductance is 0.0.
B) Overvoltage, then starts dropping to 155 V.
Can someone tell me what are the expected values in the parameters of the transformer for such specs and in which units is calculating Lm when I set it in SI units?
Also, the input current has this aspect:
Thanks.
Carlos push-pull, power_electronics_control, power_conversion_control, dc-dc converter, simulink MATLAB Answers — New Questions
Reporting the Use of Emojis in Teams Reactions
Find and Analyze How People Use Emojis as Teams Reactions
An interesting LinkedIn post expressed the opinion that it’s easier to learn some new technology by doing something fun with it. In this case, the author shows how to use KQL to interrogate Microsoft 365 audit data stored in Microsoft Sentinel to analyze the use of Teams emoji reactions for messages. Essentially, the idea is that if you can master KQL to query Sentinel data for emoji usage, you can do the same for more serious activities.
I decided that it would be a good idea to show how to do the same with PowerShell based on audit records from the unified audit log. The same data drives both repositories, so the same results should be achievable. I’ve added a little bit of extra value by showing how to display the emojis instead of just the emoji names, and I also report user display names instead of user principal names.
Teams Emojis
Teams offers a wide range of “fluent” emojis that people can use to react to chat and channel messages. Tenants can add their own custom emojis to the set provided by Microsoft. Up to twenty emojis can be used to react to a message. Basically, you can go wild with emojis should you like to react to messages in a blizzard of colorful emotions.
Audit events are captured when people use emojis to react to Teams chat and channel messages. Each emoji counts as a separate reaction, and each reaction is logged as a ReactedToMessage audit event.
Scripting the Emoji Analysis
The code in the script to analyze the use of emojis in Teams reactions is not very complex. Here’s what I did:
- Run Connect-MgGraph to connect to the Microsoft Graph PowerShell SDK to fetch details of user accounts (display names and user principal names). Because these are base properties, only the User.ReadBasic.All permission is needed. If you don’t want to see display names in the report, you don’t need this code.
- Run Connect-ExchangeOnline to connect to the Exchange Online management endpoint.
- Create a hash table and populate it with user principal names (keys) and display names (values). This data is used to translate the user principal names found in audit events into display names for the report.
- Create a hash table of emoji keyed on the emoji name and with the emoji graphics as the values. Microsoft doesn’t document the full set of Teams emojis, but I found this page useful. The hash table contains about 80 emojis from the full set. These are the emojis used in my tenant. Your tenant might differ, in which case you’ll need to add more key-value pairs to the hash table.
- Run the Search-UnifiedAuditLog cmdlet to find events with the ReactToMessage operation. If events are found, the script removes duplications (which can happen in audit results).
- Loop through the audit records and create a report of what’s found. The report includes instances where reactions are added or removed to chats or channel messages.
- Generate an Excel worksheet containing the data (if the ImportExcel module is not installed), the script creates a CSV file instead. Figure 1 shows some data extracted from my tenant.

The data can also be used for basis analysis. For instance, here’s how to find the count of the ten most used emojis, including the emoji fetched from the hash table:
Write-Output "Top Ten Emoji reactions used in Teams"
$Report | Group-Object Reaction -NoElement | Sort-Object Count -Descending | Select-Object -First 10 | Format-Table Name, @{name="Emoji"; Expression = { $Emojis[$_.Name] }}, Count -AutoSize
Top Ten Emoji reactions used in Teams
Name Emoji Count
---- ----- -----
like
334
heart
109
laugh
31
surprised
26
yes-tone1
18
1f4af_hundredpointssymbol
8
like (Removed) 8
follow
7
handsinair
7
fire
7
And here’s how to find the top 10 emoji users:
$Report | Group-Object User -NoElement | Sort-Object Count -Descending | Select-Object -First 10 | Format-Table Name, Count Name Count ---- ----- Paul Robichaux | Keepit 122 Christina Wheeler 112 Tony Redmond 96 Tony Sterling (Teams) 67 Leah Theil | Keepit 61 Juan Carlos González Martín 44 Michel de Rooij (MVP) 41 Leah Theil 31 Ben Lee 18 Sean Landy (Office 365 for IT Pros) 11
A Learning Exercise
I doubt if the script (which you can download from the Office 365 for IT Pros repository) has any great business value. But learning how to access data in the unified audit log is a core skill for a Microsoft 365 tenant administrator. Being able to manipulate the audit data with PowerShell makes the data more powerful, and that’s why we learn how to do these things.
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. Only humans contribute to our work!


334
heart
109
laugh
31
surprised
26
yes-tone1
18
1f4af_hundredpointssymbol
8
like (Removed) 8
follow
7
handsinair
7
fire
7







