Month: November 2025
Microsoft Launches Preview of Exchange Admin API
Exchange Admin API Fills Gaps Left by EWS

As you probably know, Microsoft will retire Exchange Web Services (EWS) from Exchange Online in October 2026. With less than a year to go , Microsoft 365 tenants should have a solid grasp of how EWS is used by apps. Hopefully, hybrid tenants have deployed the dedicated hybrid app to facilitate sharing of information like free/busy data, and an inventory of apps is being worked through to arrange for app retirement, app replacement, or code upgrades to eliminate EWS.
If you’re involved in overhauling EWS code, you’ve probably using the Microsoft Graph APIs to replace EWS calls, and have discovered some of the issues documented by Glen Scales in a recent article. The simple fact is that the Graph APIs do not cover every function available in EWS, and that’s the hole Microsoft plans to plug with the Exchange Admin API, launched in public preview on November 17.
A REST-based Cmdlet-Style API
According to Microsoft, the Exchange Admin API is a “REST based, cmdlet style administrative surface specifically designed to help organizations migrate away from EWS for specific Exchange admin scenarios and modernize automation workflows over HTTP.”
Peeling everything away, we discover that the Exchange Admin API is not a full-fledged REST API for Exchange Online management. Instead, it is a short-term fix to help customers to move away from EWS by providing an API that supports a limited set of scenarios that aren’t currently covered by a Graph API. The Exchange Admin API works by allowing applications to run Exchange Online cmdlets and receive the output from those cmdlets for processing. In essence, the API delivers a wrapper around selected Exchange PowerShell cmdlets. Although this might seem odd, giving apps the ability to run Exchange cmdlets is a pragmatic method that avoids recreating any wheels to deliver for what is essentially a discardable API.
Like apps that use Graph APIs to access tenant information, apps that use the Exchange Admin API must be authorized (be able to secure an access token) and possess a role (like the Exchange administrator) role to access Exchange data. Once authorized, apps can send POST requests to endpoints for processing.
Six Endpoints for the Exchange Admin API
The Exchange Admin API Public Preview includes six endpoints. The endpoints are:
- OrganizationConfig: Access tenant-wide MailTips related configuration.
- AcceptedDomain: Accepted domains and core domain settings for the tenant. The same information can be accessed using the List Domains Graph API (and the Get-MgDomain cmdlet from the Microsoft Graph PowerShell SDK).
- Mailbox: Read mailbox properties and manage Send on behalf delegates (view/update). Send on behalf delegates can also be managed with the Set-Mailbox cmdlet.
- MailboxFolderPermission: List, grant, modify, and remove folder level permissions (Inbox, Calendar, subfolders). This is equivalent to the Set-MailboxFolderPermission cmdlet.
- DistributionGroupMember: Retrieve membership for distribution groups. This is equivalent to the Get-DistributionGroupMember cmdlet.
- DynamicDistributionGroupMember: Retrieve membership for dynamic distribution groups. This is equivalent to running the Get-DynamicDistributionGroupMember cmdlet.
It might seem strange for the Exchange Admin API to include endpoints when other methods exist in terms of Graph APIs or PowerShell cmdlets. However, EWS is predominantly an interface used by email clients and applications rather than a platform for the automation of administrative operations like Exchange Online PowerShell.
Most of EWS code can be migrated to Graph APIs. The Exchange Admin API fills in the current gaps in Graph coverage to allow the developers of EWS applications to migrate their code to a newer platform in a way that maintains functionality, and that’s where the value of the API lies.
No Long-Term Future for the Exchange Admin API
Over the long term, Microsoft’s focus for automation of Exchange management tasks remains the Exchange Online management PowerShell module. For programmatic access, the focus is on Graph APIs, and highly functional APIs are available to access mailboxes, calendars, and other Exchange data.
It’s clear that the Exchange Admin API has not much of a future after the need to migrate EWS applications passes. Over time, Microsoft engineering effort will go into developing and expanding the capabilities of the Graph APIs. Once the gaps filled by the Exchange Admin API are addressed in Graph APIs, the reason for having the Exchange Admin API disappears.
For that reason, developers should continue to focus on writing code that leverages the Graph APIs with as little use of the Exchange Admin API as possible to avoid code that must eventually be replaced. Apps that move from EWS to the Exchange Admin API face going through two separate code migrations. We don’t know when the second migration will happen because Microsoft hasn’t given a date for when they will close the EWS gaps in the Graph APIs. In the interim, using the Exchange Admin API is a necessary sin to meet the EWS deprecation deadline in October 2026.
Documentation, including request patterns, and details of how to connect to the Exchange Admin API endpoints is available as an overview of the Exchange Admin API, getting started guide, and endpoint references.
Time for Testing
The Exchange Admin API is a preview. Those with responsibility for EWS applications are already on a tight schedule to get their code ready and tested before Microsoft removes EWS from Exchange Online in October 2026. If you’re in that situation, you should review and test the Exchange Admin API to determine if it’s needed, does the job for your application, and if not, provide feedback to Microsoft so that they can make changes before general availability. There’s no point in complaining if you don’t test the API!
Learn about managing Exchange Online and the rest of the Microsoft 365 ecosystem by subscribing to the Office 365 for IT Pros eBook. Use our experience to understand what’s important and how best to protect your tenant.
roll back slbuild genrated model by one step
I have generated a Simscape model to c excutable and code using slbuild and it has produced a main code rt_malloc_main in C which I am editing. I will eventually build that executable with gcc (and where needed g++) and use in Ubuntu 22.04.
For various reasons I need to roll back the model, i.e. reject all the progress made during the last call to rt_OneStep(S). This is a large model with many simscapep multibody library blocks, but also simulink blocks, and some matlab function blocks which use global variables through the persistent command.
What I ideally want would look like this:
save model S
advance one step: rt_OneStep(S)
if condition is not achieved completely roll back everything to how they where before rt_OneStep was called, or in the very least time and states so that a new call to rt_OneStep would give the exact same results: restore(S)
I currently have some ad-hoc lines of code to do save and restore and various efforts have also led me to use the rt_terminate (S) and rt_Init(S) to avoid bad memory allocation problems, and then use restore(S) in the hope that I also change my time and all states in the various blocks.
Is there a formal way to go back one step and cancel the effects of rt_OneStep(S) without starting the simulation from t=0?
The reason behind this roll back is that I am coupling this code with another code that needs the roll-backI have generated a Simscape model to c excutable and code using slbuild and it has produced a main code rt_malloc_main in C which I am editing. I will eventually build that executable with gcc (and where needed g++) and use in Ubuntu 22.04.
For various reasons I need to roll back the model, i.e. reject all the progress made during the last call to rt_OneStep(S). This is a large model with many simscapep multibody library blocks, but also simulink blocks, and some matlab function blocks which use global variables through the persistent command.
What I ideally want would look like this:
save model S
advance one step: rt_OneStep(S)
if condition is not achieved completely roll back everything to how they where before rt_OneStep was called, or in the very least time and states so that a new call to rt_OneStep would give the exact same results: restore(S)
I currently have some ad-hoc lines of code to do save and restore and various efforts have also led me to use the rt_terminate (S) and rt_Init(S) to avoid bad memory allocation problems, and then use restore(S) in the hope that I also change my time and all states in the various blocks.
Is there a formal way to go back one step and cancel the effects of rt_OneStep(S) without starting the simulation from t=0?
The reason behind this roll back is that I am coupling this code with another code that needs the roll-back I have generated a Simscape model to c excutable and code using slbuild and it has produced a main code rt_malloc_main in C which I am editing. I will eventually build that executable with gcc (and where needed g++) and use in Ubuntu 22.04.
For various reasons I need to roll back the model, i.e. reject all the progress made during the last call to rt_OneStep(S). This is a large model with many simscapep multibody library blocks, but also simulink blocks, and some matlab function blocks which use global variables through the persistent command.
What I ideally want would look like this:
save model S
advance one step: rt_OneStep(S)
if condition is not achieved completely roll back everything to how they where before rt_OneStep was called, or in the very least time and states so that a new call to rt_OneStep would give the exact same results: restore(S)
I currently have some ad-hoc lines of code to do save and restore and various efforts have also led me to use the rt_terminate (S) and rt_Init(S) to avoid bad memory allocation problems, and then use restore(S) in the hope that I also change my time and all states in the various blocks.
Is there a formal way to go back one step and cancel the effects of rt_OneStep(S) without starting the simulation from t=0?
The reason behind this roll back is that I am coupling this code with another code that needs the roll-back rt_onestep, reject time step, slbuild MATLAB Answers — New Questions
Adding Second Callback to UIAxes Toolbar in App Designer
I’m trying to find out how to add a second callback to the existing toolbar function(s) in App Designer so that one may, for example, hit the Restore View button and have the normal view restore callback as well as a custom function. I found some help here, but I wasn’t able to get it to work properly. This was my attempt:
function callback2(app,~)
disp(‘The button was pushed.’)
end
axtoolbar(app.UIAxes,{‘export’,’pan’,’zoomin’,’zoomout’,’restoreview’}) %create toolbar for app.UIAxes
%@(e,d)matlab.graphics.controls.internal.resetHelper(d.Axes,true) %original function for ButtonPushedFcn
ax = app.UIAxes;
ax.Toolbar.Children(5).ButtonPushedFcn = cellfun(@(x)feval(x,app,ax),…
{@(app)matlab.graphics.controls.internal.resetHelper(ax,true),…
@(app)callback2(app)}); %change the restoreview callback to include the original function and my custom function
I don’t think this is very difficult to do, but I was in a rush and ended up doing something else anyway. For future reference, this would be beneficial to know though. The version I’m using is 2020b.I’m trying to find out how to add a second callback to the existing toolbar function(s) in App Designer so that one may, for example, hit the Restore View button and have the normal view restore callback as well as a custom function. I found some help here, but I wasn’t able to get it to work properly. This was my attempt:
function callback2(app,~)
disp(‘The button was pushed.’)
end
axtoolbar(app.UIAxes,{‘export’,’pan’,’zoomin’,’zoomout’,’restoreview’}) %create toolbar for app.UIAxes
%@(e,d)matlab.graphics.controls.internal.resetHelper(d.Axes,true) %original function for ButtonPushedFcn
ax = app.UIAxes;
ax.Toolbar.Children(5).ButtonPushedFcn = cellfun(@(x)feval(x,app,ax),…
{@(app)matlab.graphics.controls.internal.resetHelper(ax,true),…
@(app)callback2(app)}); %change the restoreview callback to include the original function and my custom function
I don’t think this is very difficult to do, but I was in a rush and ended up doing something else anyway. For future reference, this would be beneficial to know though. The version I’m using is 2020b. I’m trying to find out how to add a second callback to the existing toolbar function(s) in App Designer so that one may, for example, hit the Restore View button and have the normal view restore callback as well as a custom function. I found some help here, but I wasn’t able to get it to work properly. This was my attempt:
function callback2(app,~)
disp(‘The button was pushed.’)
end
axtoolbar(app.UIAxes,{‘export’,’pan’,’zoomin’,’zoomout’,’restoreview’}) %create toolbar for app.UIAxes
%@(e,d)matlab.graphics.controls.internal.resetHelper(d.Axes,true) %original function for ButtonPushedFcn
ax = app.UIAxes;
ax.Toolbar.Children(5).ButtonPushedFcn = cellfun(@(x)feval(x,app,ax),…
{@(app)matlab.graphics.controls.internal.resetHelper(ax,true),…
@(app)callback2(app)}); %change the restoreview callback to include the original function and my custom function
I don’t think this is very difficult to do, but I was in a rush and ended up doing something else anyway. For future reference, this would be beneficial to know though. The version I’m using is 2020b. app designer, matlab, callback, toolbar, restore MATLAB Answers — New Questions
How to move data tip in R2025b?
In previous versions of matlab, an existing data tip would move to a new point whenever I clicked on a new point in a graph or image, and I could also use the arrows on the keyboard to move the data tip one pixel at a time. In R2025b I get a new data tip each time I click somewhere in a plot, and there does not seem to be any way to move the data tips to a different point. How can I make the data tips behave like they did before? I never want to have hundreds of data tips in a plot, so holding shift while clicking in order to create a second data tip is not a problem.In previous versions of matlab, an existing data tip would move to a new point whenever I clicked on a new point in a graph or image, and I could also use the arrows on the keyboard to move the data tip one pixel at a time. In R2025b I get a new data tip each time I click somewhere in a plot, and there does not seem to be any way to move the data tips to a different point. How can I make the data tips behave like they did before? I never want to have hundreds of data tips in a plot, so holding shift while clicking in order to create a second data tip is not a problem. In previous versions of matlab, an existing data tip would move to a new point whenever I clicked on a new point in a graph or image, and I could also use the arrows on the keyboard to move the data tip one pixel at a time. In R2025b I get a new data tip each time I click somewhere in a plot, and there does not seem to be any way to move the data tips to a different point. How can I make the data tips behave like they did before? I never want to have hundreds of data tips in a plot, so holding shift while clicking in order to create a second data tip is not a problem. data tips, matlab r2025b MATLAB Answers — New Questions
I am trying to propagate an orbit using the mission analysis block
I am initially finding out the orbital parameters for the injection point and successively the drifts that I am gonna encounter and my final result needs to a fully High precision orbit incoporating drag and atmospheric model and also calculating revisit time at the same time calculating the orbital parameters variation. I am also doing a keplerian unperturbed analysis.I am initially finding out the orbital parameters for the injection point and successively the drifts that I am gonna encounter and my final result needs to a fully High precision orbit incoporating drag and atmospheric model and also calculating revisit time at the same time calculating the orbital parameters variation. I am also doing a keplerian unperturbed analysis. I am initially finding out the orbital parameters for the injection point and successively the drifts that I am gonna encounter and my final result needs to a fully High precision orbit incoporating drag and atmospheric model and also calculating revisit time at the same time calculating the orbital parameters variation. I am also doing a keplerian unperturbed analysis. trajectory design, orbit propagation MATLAB Answers — New Questions
Plus as concatenate for numeric vectors?
I’ve been using Matlab for years and I’ve never seen this before, is it new? It was hard to debug this since it’s pretty subtle
size([ones(1,10) +ones(1,10)])
Apparently if you don’t put a space after the plus sign — and there is a space before it — then + concatenates instead of adding. There’s nothing in the documentation for + about concatenating numeric arrays. I don’t really have a question, this just seems really confusing as a feature.I’ve been using Matlab for years and I’ve never seen this before, is it new? It was hard to debug this since it’s pretty subtle
size([ones(1,10) +ones(1,10)])
Apparently if you don’t put a space after the plus sign — and there is a space before it — then + concatenates instead of adding. There’s nothing in the documentation for + about concatenating numeric arrays. I don’t really have a question, this just seems really confusing as a feature. I’ve been using Matlab for years and I’ve never seen this before, is it new? It was hard to debug this since it’s pretty subtle
size([ones(1,10) +ones(1,10)])
Apparently if you don’t put a space after the plus sign — and there is a space before it — then + concatenates instead of adding. There’s nothing in the documentation for + about concatenating numeric arrays. I don’t really have a question, this just seems really confusing as a feature. mathematics, arrays MATLAB Answers — New Questions
Removing Inactive Entra ID User Accounts with PowerShell
Buy Entra Governance Licenses or Use PowerShell to Remove Inactive User Accounts
Some time ago, I discussed how to manage Entra ID guest accounts and the choice that exists between using Microsoft Entra ID Governance (lifecycle workflows and access reviews) or creating your own processes with PowerShell. I made the point that the steps required to find and deal with inactive guest accounts do not require difficult code and pointed out the many available scripts to do the job.
The intention behind highlighting scripts to replace Entra ID Governance functionality is not to say that Entra ID Governance is useless. That’s obviously not the case. It’s always nice to have someone else be responsible for maintaining and supporting code. However, not every tenant can afford to invest in Entra P2 licenses and, in some cases, tenants with Entra P2 licenses might prefer to create customized versions of account lifecycle processes.
Lifecycle Workflow to Remove Inactive User Accounts
All of which brings me to the latest preview offering in Entra ID Governance, the ability to manage inactive user accounts through lifecycle workflows. Essentially, Entra ID looks for accounts that haven’t signed in for a set number of days and deems those accounts to be in active. The workflow can then remove the inactive accounts to free up licenses or simply clean up the directory.
No one wants to pay for licenses that are unused and there’s no sense in having inactive user accounts cluttering up the directory. An inactive user lifecycle workflow is a good idea and I’m sure the tenants with Entra P2 licenses will happily implement workflows to make sure that their directories are spanking clean.
The PowerShell Alternative
But just like the lifecycle workflows to manage guest accounts, the PowerShell code to find and process inactive user accounts is straightforward. In fact, I’ve been over this ground before with a script to find unused mailboxes. In this case, the script focuses on user accounts instead of mailboxes. The steps are:
- Find the user accounts to process. This could be all licensed user accounts (there’s no point in processing user accounts created for room or shared mailboxes) or a subset defined by a group.
- Check each account to establish when it last signed in. If the number of days since the last sign in doesn’t meet a set threshold, mark the account as inactive by setting custom attribute 10 to “Inactive.” In addition, the account is disabled. The script uses a 90-day threshold, which should be enough for absences such as sabbaticals.
- Subsequent runs of the job remove the disabled accounts marked by this workflow. Using a two-phase approach allows administrators to recover accounts disabled in error without doing too much harm.
- Instead of simply deleting the inactive accounts, the accounts are placed on litigation hold before deletion to make their mailboxes inactive and capable of recovery. It’s also possible to convert user mailboxes into shared mailboxes, but overall, I think it’s better to use inactive mailboxes (if only because inactive mailboxes avoid the potential need to license shared mailboxes for MDO or if the mailbox has an archive). Deleting an account frees up its assigned licenses. If you convert mailboxes to be shared mailboxes, remember to remove licenses from the account.
- Report what’s been done by sending details of the processed accounts in an email to administrators (Figure 1).
If an account is deleted in error, it can be recovered through the Entra admin center for up to 30 days after removal. Once that period lapses, Entra ID permanently removes the account.

A process like this is well suited to executing as a scheduled Azure Automation runbook, perhaps on a biweekly basis. You can download the script from the Office 365 for IT Pros repository. Make sure to amend the addresses used for the message sender and recipient to match accounts in your tenant.
Choosing Between Off-the-Shelf Software and PowerShell
Once again, I’m not saying that Microsoft 365 tenants should not invest in Entra ID Governance. The solution offers more functionality than simply detecting and removing inactive user accounts. I do want to remind people that PowerShell is often an alternative, especially when you want to create a custom workflow for your organization. It’s nice to have a choice.
Need help to write and manage PowerShell scripts for Microsoft 365, including Azure Automation runbooks? Get a copy of the Automating Microsoft 365 with PowerShell eBook, available standalone or as part of the Office 365 for IT Pros eBook bundle.
Spatial Contact Force — Normal Force documentation
I am working with Simscape Multibody using Spatial Contact Force block. Can anyone point me to the documentation on the following:
How is the first time derivative of the penetration depth computed as a function of time?
What is the equation of the smoothing function?
Thank you in advance!I am working with Simscape Multibody using Spatial Contact Force block. Can anyone point me to the documentation on the following:
How is the first time derivative of the penetration depth computed as a function of time?
What is the equation of the smoothing function?
Thank you in advance! I am working with Simscape Multibody using Spatial Contact Force block. Can anyone point me to the documentation on the following:
How is the first time derivative of the penetration depth computed as a function of time?
What is the equation of the smoothing function?
Thank you in advance! simscape MATLAB Answers — New Questions
How do I stop exportgraphics from adding a border
Hi Everyone
I’m using Matlab 2024b and have found an oddity.
If I load an image and then export it again exportgraphics seem to add a white border
In its simplest form…
fig = figure();
im = imread(‘peppers.png’);
imshow(im)
exportgraphics(gca,’exportplot.jpg’);
If you compare peppers.png with the exported version then you can see a pixel wide border has been added
I’ve tried
set(gca, ‘color’, ‘none’);
axis off
exportgraphics(gca,’plot2.jpg’,’BackgroundColor’,’none’)
but none of these seem to make any difference. What’s annoying is that I’m also using exportgraphics to generate animated gifs but the white margin appears around those too. This really shows up on the black background that I’m using.
Any suggestions on how to eliminate this?Hi Everyone
I’m using Matlab 2024b and have found an oddity.
If I load an image and then export it again exportgraphics seem to add a white border
In its simplest form…
fig = figure();
im = imread(‘peppers.png’);
imshow(im)
exportgraphics(gca,’exportplot.jpg’);
If you compare peppers.png with the exported version then you can see a pixel wide border has been added
I’ve tried
set(gca, ‘color’, ‘none’);
axis off
exportgraphics(gca,’plot2.jpg’,’BackgroundColor’,’none’)
but none of these seem to make any difference. What’s annoying is that I’m also using exportgraphics to generate animated gifs but the white margin appears around those too. This really shows up on the black background that I’m using.
Any suggestions on how to eliminate this? Hi Everyone
I’m using Matlab 2024b and have found an oddity.
If I load an image and then export it again exportgraphics seem to add a white border
In its simplest form…
fig = figure();
im = imread(‘peppers.png’);
imshow(im)
exportgraphics(gca,’exportplot.jpg’);
If you compare peppers.png with the exported version then you can see a pixel wide border has been added
I’ve tried
set(gca, ‘color’, ‘none’);
axis off
exportgraphics(gca,’plot2.jpg’,’BackgroundColor’,’none’)
but none of these seem to make any difference. What’s annoying is that I’m also using exportgraphics to generate animated gifs but the white margin appears around those too. This really shows up on the black background that I’m using.
Any suggestions on how to eliminate this? exportgraphics, margins, border MATLAB Answers — New Questions
getting error in fuzzy inference system & gain block
iam getting error iin FIS system opening even though i kept all files in one folder & its showing below error.
code:
clc; clear; close all;
%% =======================================================
% CHECK & OPEN SIMULINK MODEL CONFIGURATION
% *** PLEASE CHANGE THIS PATH TO YOUR ACTUAL FILE LOCATION ***
%% =======================================================
model = ‘SimFuzzyPID’;
modelPath = ‘D:trials_1611251CP 25 705 (1)finalSimFuzzyPID.slx’;
% Extract folder path and add it to the MATLAB path for file finding
[folderPath, ~, ~] = fileparts(modelPath);
addpath(folderPath);
if ~exist(modelPath, ‘file’)
error(‘SimFuzzyPID.slx NOT FOUND at the specified path. Please check modelPath.’);
end
load_system(model);
open_system(model);
disp([‘Model "’, model, ‘" loaded successfully.’]);
%% =======================================================
% PLANT TRANSFER FUNCTION & DISCRETIZATION
% G(s) = [1250/(s^2 + 50s + 1250)] * [0.57s^2+2.64s+1] * e^(-0.2s)
%% =======================================================
s = tf(‘s’);
G1 = 1250 / (s^2 + 50*s + 1250);
G2 = (0.57*s^2 + 2.64*s + 1);
Delay = exp(-0.2*s);
G = G1 * G2 * Delay;
Ts = 0.01;
Plant = c2d(G, Ts, ‘zoh’);
disp([‘Plant discretized with Ts = ‘, num2str(Ts), ‘s.’]);
%% =======================================================
% PID DESIGN USING pidtune (For initial gains)
%% =======================================================
C0 = pid(1,1,1,’Ts’,Ts,’IF’,’B’,’DF’,’B’);
C = pidtune(Plant, C0);
[Kp, Ki, Kd] = piddata(C);
disp([‘PID Gains: Kp=’, num2str(Kp), ‘, Ki=’, num2str(Ki), ‘, Kd=’, num2str(Kd)]);
%% =======================================================
% FUZZY PID SCALING GAINS
%% =======================================================
% You can tune these manually for better performance if needed
GE = 100; % Input scaling for Error (E)
GCE = GE * (Kp – sqrt(Kp^2 – 4*Ki*Kd)) / (2*Ki); % Input scaling for Change of Error (CE)
GCU = Ki / GE; % Output scaling gain (Ku)
GU = Kd / GCE; % Another output scaling gain (Ku * GCE / Kd, simplified)
disp([‘Calculated Scaling Gains: GE=’, num2str(GE), ‘, GCE=’, num2str(GCE), ‘, GCU=’, num2str(GCU), ‘, GU=’, num2str(GU)]);
%% =======================================================
% BUILD FUZZY FIS (5 MFs Sugeno Structure)
%% =======================================================
FIS = mamfis("FIS","FISType","sugeno");
% — Input 1: Error (E) —
FIS = addInput(FIS,[-100 100],’Name’,’E’);
FIS = addMF(FIS,’E’,"NB","trimf",[-100 -100 -50]); % Negative Big
FIS = addMF(FIS,’E’,"NS","trimf",[-100 -50 0]); % Negative Small
FIS = addMF(FIS,’E’,"Z","trimf",[-50 0 50]); % Zero
FIS = addMF(FIS,’E’,"PS","trimf",[0 50 100]); % Positive Small
FIS = addMF(FIS,’E’,"PB","trimf",[50 100 100]); % Positive Big
% — Input 2: Change of Error (CE) —
FIS = addInput(FIS,[-100 100],’Name’,’CE’);
FIS = addMF(FIS,’CE’,"NB","trimf",[-100 -100 -50]);
FIS = addMF(FIS,’CE’,"NS","trimf",[-100 -50 0]);
FIS = addMF(FIS,’CE’,"Z","trimf",[-50 0 50]);
FIS = addMF(FIS,’CE’,"PS","trimf",[0 50 100]);
FIS = addMF(FIS,’CE’,"PB","trimf",[50 100 100]);
% — Output: Control u (Constants) —
FIS = addOutput(FIS,[-200 200],’Name’,’u’);
FIS = addMF(FIS,’u’,"NB","constant",-200);
FIS = addMF(FIS,’u’,"NS","constant",-100);
FIS = addMF(FIS,’u’,"Z","constant",0);
FIS = addMF(FIS,’u’,"PS","constant",100);
FIS = addMF(FIS,’u’,"PB","constant",200);
% — Rule Base (25 Rules) —
% Mapping: 1=NB, 2=NS, 3=Z, 4=PS, 5=PB
ruleList = [
1 1 1 1 1; 1 2 1 1 1; 1 3 2 1 1; 1 4 2 1 1; 1 5 3 1 1;
2 1 1 1 1; 2 2 2 1 1; 2 3 3 1 1; 2 4 4 1 1; 2 5 4 1 1;
3 1 2 1 1; 3 2 3 1 1; 3 3 3 1 1; 3 4 3 1 1; 3 5 4 1 1;
4 1 2 1 1; 4 2 3 1 1; 4 3 4 1 1; 4 4 4 1 1; 4 5 5 1 1;
5 1 3 1 1; 5 2 4 1 1; 5 3 4 1 1; 5 4 5 1 1; 5 5 5 1 1
];
FIS = addRule(FIS, ruleList);
disp(‘Fuzzy FIS defined with 5 MFs and 25 rules.’);
%% =======================================================
% SAVE FIS TO FILE (Uses the model directory)
%% =======================================================
FIS_FileName = ‘FuzzyPID_Controller.fis’;
fullFilePath = fullfile(folderPath, FIS_FileName);
writeFIS(FIS, fullFilePath);
disp([‘FIS file saved successfully at: ‘, fullFilePath]);
%% =======================================================
% SIMULINK PARAMETER PUSH & SIMULATION
% Push Kp, Ki, Kd, GE, GCE, GCU to the model (assuming blocks are named)
%% =======================================================
% Assuming you have a standard PID block named ‘PID Controller’
% and a Gain block for PID named ‘Kp_Gain’, ‘Ki_Gain’, etc.
% set_param([model, ‘/PID Controller’], ‘P’, num2str(Kp), ‘I’, num2str(Ki), ‘D’, num2str(Kd));
% Assuming you have Gain blocks for the Fuzzy-PID scaling
% set_param([model, ‘/GE_Gain’], ‘Gain’, num2str(GE));
% set_param([model, ‘/GCE_Gain’], ‘Gain’, num2str(GCE));
% set_param([model, ‘/GCU_Gain’], ‘Gain’, num2str(GCU));
simOut = sim(model);
StepPID = simOut.StepPID;
StepFP = simOut.StepFP;
disp(‘Simulation complete.’);
%% =======================================================
% PLOT RESULT: PID vs FUZZY-PID
%% =======================================================
figure;
plot(StepPID.time, StepPID.data,’LineWidth’,2); hold on;
plot(StepFP.time, StepFP.data,’LineWidth’,2);
grid on;
title(‘PID vs Fuzzy-PID Control Performance’);
xlabel(‘Time (s)’);
ylabel(‘Speed Response’);
legend(‘PID’,’Fuzzy-PID’);iam getting error iin FIS system opening even though i kept all files in one folder & its showing below error.
code:
clc; clear; close all;
%% =======================================================
% CHECK & OPEN SIMULINK MODEL CONFIGURATION
% *** PLEASE CHANGE THIS PATH TO YOUR ACTUAL FILE LOCATION ***
%% =======================================================
model = ‘SimFuzzyPID’;
modelPath = ‘D:trials_1611251CP 25 705 (1)finalSimFuzzyPID.slx’;
% Extract folder path and add it to the MATLAB path for file finding
[folderPath, ~, ~] = fileparts(modelPath);
addpath(folderPath);
if ~exist(modelPath, ‘file’)
error(‘SimFuzzyPID.slx NOT FOUND at the specified path. Please check modelPath.’);
end
load_system(model);
open_system(model);
disp([‘Model "’, model, ‘" loaded successfully.’]);
%% =======================================================
% PLANT TRANSFER FUNCTION & DISCRETIZATION
% G(s) = [1250/(s^2 + 50s + 1250)] * [0.57s^2+2.64s+1] * e^(-0.2s)
%% =======================================================
s = tf(‘s’);
G1 = 1250 / (s^2 + 50*s + 1250);
G2 = (0.57*s^2 + 2.64*s + 1);
Delay = exp(-0.2*s);
G = G1 * G2 * Delay;
Ts = 0.01;
Plant = c2d(G, Ts, ‘zoh’);
disp([‘Plant discretized with Ts = ‘, num2str(Ts), ‘s.’]);
%% =======================================================
% PID DESIGN USING pidtune (For initial gains)
%% =======================================================
C0 = pid(1,1,1,’Ts’,Ts,’IF’,’B’,’DF’,’B’);
C = pidtune(Plant, C0);
[Kp, Ki, Kd] = piddata(C);
disp([‘PID Gains: Kp=’, num2str(Kp), ‘, Ki=’, num2str(Ki), ‘, Kd=’, num2str(Kd)]);
%% =======================================================
% FUZZY PID SCALING GAINS
%% =======================================================
% You can tune these manually for better performance if needed
GE = 100; % Input scaling for Error (E)
GCE = GE * (Kp – sqrt(Kp^2 – 4*Ki*Kd)) / (2*Ki); % Input scaling for Change of Error (CE)
GCU = Ki / GE; % Output scaling gain (Ku)
GU = Kd / GCE; % Another output scaling gain (Ku * GCE / Kd, simplified)
disp([‘Calculated Scaling Gains: GE=’, num2str(GE), ‘, GCE=’, num2str(GCE), ‘, GCU=’, num2str(GCU), ‘, GU=’, num2str(GU)]);
%% =======================================================
% BUILD FUZZY FIS (5 MFs Sugeno Structure)
%% =======================================================
FIS = mamfis("FIS","FISType","sugeno");
% — Input 1: Error (E) —
FIS = addInput(FIS,[-100 100],’Name’,’E’);
FIS = addMF(FIS,’E’,"NB","trimf",[-100 -100 -50]); % Negative Big
FIS = addMF(FIS,’E’,"NS","trimf",[-100 -50 0]); % Negative Small
FIS = addMF(FIS,’E’,"Z","trimf",[-50 0 50]); % Zero
FIS = addMF(FIS,’E’,"PS","trimf",[0 50 100]); % Positive Small
FIS = addMF(FIS,’E’,"PB","trimf",[50 100 100]); % Positive Big
% — Input 2: Change of Error (CE) —
FIS = addInput(FIS,[-100 100],’Name’,’CE’);
FIS = addMF(FIS,’CE’,"NB","trimf",[-100 -100 -50]);
FIS = addMF(FIS,’CE’,"NS","trimf",[-100 -50 0]);
FIS = addMF(FIS,’CE’,"Z","trimf",[-50 0 50]);
FIS = addMF(FIS,’CE’,"PS","trimf",[0 50 100]);
FIS = addMF(FIS,’CE’,"PB","trimf",[50 100 100]);
% — Output: Control u (Constants) —
FIS = addOutput(FIS,[-200 200],’Name’,’u’);
FIS = addMF(FIS,’u’,"NB","constant",-200);
FIS = addMF(FIS,’u’,"NS","constant",-100);
FIS = addMF(FIS,’u’,"Z","constant",0);
FIS = addMF(FIS,’u’,"PS","constant",100);
FIS = addMF(FIS,’u’,"PB","constant",200);
% — Rule Base (25 Rules) —
% Mapping: 1=NB, 2=NS, 3=Z, 4=PS, 5=PB
ruleList = [
1 1 1 1 1; 1 2 1 1 1; 1 3 2 1 1; 1 4 2 1 1; 1 5 3 1 1;
2 1 1 1 1; 2 2 2 1 1; 2 3 3 1 1; 2 4 4 1 1; 2 5 4 1 1;
3 1 2 1 1; 3 2 3 1 1; 3 3 3 1 1; 3 4 3 1 1; 3 5 4 1 1;
4 1 2 1 1; 4 2 3 1 1; 4 3 4 1 1; 4 4 4 1 1; 4 5 5 1 1;
5 1 3 1 1; 5 2 4 1 1; 5 3 4 1 1; 5 4 5 1 1; 5 5 5 1 1
];
FIS = addRule(FIS, ruleList);
disp(‘Fuzzy FIS defined with 5 MFs and 25 rules.’);
%% =======================================================
% SAVE FIS TO FILE (Uses the model directory)
%% =======================================================
FIS_FileName = ‘FuzzyPID_Controller.fis’;
fullFilePath = fullfile(folderPath, FIS_FileName);
writeFIS(FIS, fullFilePath);
disp([‘FIS file saved successfully at: ‘, fullFilePath]);
%% =======================================================
% SIMULINK PARAMETER PUSH & SIMULATION
% Push Kp, Ki, Kd, GE, GCE, GCU to the model (assuming blocks are named)
%% =======================================================
% Assuming you have a standard PID block named ‘PID Controller’
% and a Gain block for PID named ‘Kp_Gain’, ‘Ki_Gain’, etc.
% set_param([model, ‘/PID Controller’], ‘P’, num2str(Kp), ‘I’, num2str(Ki), ‘D’, num2str(Kd));
% Assuming you have Gain blocks for the Fuzzy-PID scaling
% set_param([model, ‘/GE_Gain’], ‘Gain’, num2str(GE));
% set_param([model, ‘/GCE_Gain’], ‘Gain’, num2str(GCE));
% set_param([model, ‘/GCU_Gain’], ‘Gain’, num2str(GCU));
simOut = sim(model);
StepPID = simOut.StepPID;
StepFP = simOut.StepFP;
disp(‘Simulation complete.’);
%% =======================================================
% PLOT RESULT: PID vs FUZZY-PID
%% =======================================================
figure;
plot(StepPID.time, StepPID.data,’LineWidth’,2); hold on;
plot(StepFP.time, StepFP.data,’LineWidth’,2);
grid on;
title(‘PID vs Fuzzy-PID Control Performance’);
xlabel(‘Time (s)’);
ylabel(‘Speed Response’);
legend(‘PID’,’Fuzzy-PID’); iam getting error iin FIS system opening even though i kept all files in one folder & its showing below error.
code:
clc; clear; close all;
%% =======================================================
% CHECK & OPEN SIMULINK MODEL CONFIGURATION
% *** PLEASE CHANGE THIS PATH TO YOUR ACTUAL FILE LOCATION ***
%% =======================================================
model = ‘SimFuzzyPID’;
modelPath = ‘D:trials_1611251CP 25 705 (1)finalSimFuzzyPID.slx’;
% Extract folder path and add it to the MATLAB path for file finding
[folderPath, ~, ~] = fileparts(modelPath);
addpath(folderPath);
if ~exist(modelPath, ‘file’)
error(‘SimFuzzyPID.slx NOT FOUND at the specified path. Please check modelPath.’);
end
load_system(model);
open_system(model);
disp([‘Model "’, model, ‘" loaded successfully.’]);
%% =======================================================
% PLANT TRANSFER FUNCTION & DISCRETIZATION
% G(s) = [1250/(s^2 + 50s + 1250)] * [0.57s^2+2.64s+1] * e^(-0.2s)
%% =======================================================
s = tf(‘s’);
G1 = 1250 / (s^2 + 50*s + 1250);
G2 = (0.57*s^2 + 2.64*s + 1);
Delay = exp(-0.2*s);
G = G1 * G2 * Delay;
Ts = 0.01;
Plant = c2d(G, Ts, ‘zoh’);
disp([‘Plant discretized with Ts = ‘, num2str(Ts), ‘s.’]);
%% =======================================================
% PID DESIGN USING pidtune (For initial gains)
%% =======================================================
C0 = pid(1,1,1,’Ts’,Ts,’IF’,’B’,’DF’,’B’);
C = pidtune(Plant, C0);
[Kp, Ki, Kd] = piddata(C);
disp([‘PID Gains: Kp=’, num2str(Kp), ‘, Ki=’, num2str(Ki), ‘, Kd=’, num2str(Kd)]);
%% =======================================================
% FUZZY PID SCALING GAINS
%% =======================================================
% You can tune these manually for better performance if needed
GE = 100; % Input scaling for Error (E)
GCE = GE * (Kp – sqrt(Kp^2 – 4*Ki*Kd)) / (2*Ki); % Input scaling for Change of Error (CE)
GCU = Ki / GE; % Output scaling gain (Ku)
GU = Kd / GCE; % Another output scaling gain (Ku * GCE / Kd, simplified)
disp([‘Calculated Scaling Gains: GE=’, num2str(GE), ‘, GCE=’, num2str(GCE), ‘, GCU=’, num2str(GCU), ‘, GU=’, num2str(GU)]);
%% =======================================================
% BUILD FUZZY FIS (5 MFs Sugeno Structure)
%% =======================================================
FIS = mamfis("FIS","FISType","sugeno");
% — Input 1: Error (E) —
FIS = addInput(FIS,[-100 100],’Name’,’E’);
FIS = addMF(FIS,’E’,"NB","trimf",[-100 -100 -50]); % Negative Big
FIS = addMF(FIS,’E’,"NS","trimf",[-100 -50 0]); % Negative Small
FIS = addMF(FIS,’E’,"Z","trimf",[-50 0 50]); % Zero
FIS = addMF(FIS,’E’,"PS","trimf",[0 50 100]); % Positive Small
FIS = addMF(FIS,’E’,"PB","trimf",[50 100 100]); % Positive Big
% — Input 2: Change of Error (CE) —
FIS = addInput(FIS,[-100 100],’Name’,’CE’);
FIS = addMF(FIS,’CE’,"NB","trimf",[-100 -100 -50]);
FIS = addMF(FIS,’CE’,"NS","trimf",[-100 -50 0]);
FIS = addMF(FIS,’CE’,"Z","trimf",[-50 0 50]);
FIS = addMF(FIS,’CE’,"PS","trimf",[0 50 100]);
FIS = addMF(FIS,’CE’,"PB","trimf",[50 100 100]);
% — Output: Control u (Constants) —
FIS = addOutput(FIS,[-200 200],’Name’,’u’);
FIS = addMF(FIS,’u’,"NB","constant",-200);
FIS = addMF(FIS,’u’,"NS","constant",-100);
FIS = addMF(FIS,’u’,"Z","constant",0);
FIS = addMF(FIS,’u’,"PS","constant",100);
FIS = addMF(FIS,’u’,"PB","constant",200);
% — Rule Base (25 Rules) —
% Mapping: 1=NB, 2=NS, 3=Z, 4=PS, 5=PB
ruleList = [
1 1 1 1 1; 1 2 1 1 1; 1 3 2 1 1; 1 4 2 1 1; 1 5 3 1 1;
2 1 1 1 1; 2 2 2 1 1; 2 3 3 1 1; 2 4 4 1 1; 2 5 4 1 1;
3 1 2 1 1; 3 2 3 1 1; 3 3 3 1 1; 3 4 3 1 1; 3 5 4 1 1;
4 1 2 1 1; 4 2 3 1 1; 4 3 4 1 1; 4 4 4 1 1; 4 5 5 1 1;
5 1 3 1 1; 5 2 4 1 1; 5 3 4 1 1; 5 4 5 1 1; 5 5 5 1 1
];
FIS = addRule(FIS, ruleList);
disp(‘Fuzzy FIS defined with 5 MFs and 25 rules.’);
%% =======================================================
% SAVE FIS TO FILE (Uses the model directory)
%% =======================================================
FIS_FileName = ‘FuzzyPID_Controller.fis’;
fullFilePath = fullfile(folderPath, FIS_FileName);
writeFIS(FIS, fullFilePath);
disp([‘FIS file saved successfully at: ‘, fullFilePath]);
%% =======================================================
% SIMULINK PARAMETER PUSH & SIMULATION
% Push Kp, Ki, Kd, GE, GCE, GCU to the model (assuming blocks are named)
%% =======================================================
% Assuming you have a standard PID block named ‘PID Controller’
% and a Gain block for PID named ‘Kp_Gain’, ‘Ki_Gain’, etc.
% set_param([model, ‘/PID Controller’], ‘P’, num2str(Kp), ‘I’, num2str(Ki), ‘D’, num2str(Kd));
% Assuming you have Gain blocks for the Fuzzy-PID scaling
% set_param([model, ‘/GE_Gain’], ‘Gain’, num2str(GE));
% set_param([model, ‘/GCE_Gain’], ‘Gain’, num2str(GCE));
% set_param([model, ‘/GCU_Gain’], ‘Gain’, num2str(GCU));
simOut = sim(model);
StepPID = simOut.StepPID;
StepFP = simOut.StepFP;
disp(‘Simulation complete.’);
%% =======================================================
% PLOT RESULT: PID vs FUZZY-PID
%% =======================================================
figure;
plot(StepPID.time, StepPID.data,’LineWidth’,2); hold on;
plot(StepFP.time, StepFP.data,’LineWidth’,2);
grid on;
title(‘PID vs Fuzzy-PID Control Performance’);
xlabel(‘Time (s)’);
ylabel(‘Speed Response’);
legend(‘PID’,’Fuzzy-PID’); fuzzy logic inference error MATLAB Answers — New Questions
check out a matlab code method
Hello everyone, I’m deeply sorry to ask this question, because i could’nt resolve it . I’m using R2024a matlab version, and I wanna know how to check a matlab code i mean ( array, matrix,…) . In this part, I would know how to get those errors messages?
if Bearing_Type == 7 % fluid film bearings – based on short width bearing theory
if ncol_bearing < 7, disp(‘>>>> Error – too few columns in bearing definition matrix for bearing type 7’), end
if Rotor_Spd == 0, disp(‘>>>> Error – bearing type 7 – fluid bearing model undefined at zero speed’), end
F = Bearing_Def(i,3); % static load (N) colonne 3,The static bearing’s force needs to be calculated.
D = Bearing_Def(i,4); % bearing diameter (m) colonne 4
L = Bearing_Def(i,5); % bearing length (m) colonne 5
c = Bearing_Def(i,6); % bearing radial clearance (m) colonne 6
eta = Bearing_Def(i,7); % oil viscosity (Ns/m^2) colonne 7
model.bearing = [7 1 Bearing1_diam Bearing1_clear Bearing1_wid Lubricating_oil_number eta; …
7 12 Bearing2_diam Bearing2_clear Bearing2_wid Lubricating_oil_number eta];Hello everyone, I’m deeply sorry to ask this question, because i could’nt resolve it . I’m using R2024a matlab version, and I wanna know how to check a matlab code i mean ( array, matrix,…) . In this part, I would know how to get those errors messages?
if Bearing_Type == 7 % fluid film bearings – based on short width bearing theory
if ncol_bearing < 7, disp(‘>>>> Error – too few columns in bearing definition matrix for bearing type 7’), end
if Rotor_Spd == 0, disp(‘>>>> Error – bearing type 7 – fluid bearing model undefined at zero speed’), end
F = Bearing_Def(i,3); % static load (N) colonne 3,The static bearing’s force needs to be calculated.
D = Bearing_Def(i,4); % bearing diameter (m) colonne 4
L = Bearing_Def(i,5); % bearing length (m) colonne 5
c = Bearing_Def(i,6); % bearing radial clearance (m) colonne 6
eta = Bearing_Def(i,7); % oil viscosity (Ns/m^2) colonne 7
model.bearing = [7 1 Bearing1_diam Bearing1_clear Bearing1_wid Lubricating_oil_number eta; …
7 12 Bearing2_diam Bearing2_clear Bearing2_wid Lubricating_oil_number eta]; Hello everyone, I’m deeply sorry to ask this question, because i could’nt resolve it . I’m using R2024a matlab version, and I wanna know how to check a matlab code i mean ( array, matrix,…) . In this part, I would know how to get those errors messages?
if Bearing_Type == 7 % fluid film bearings – based on short width bearing theory
if ncol_bearing < 7, disp(‘>>>> Error – too few columns in bearing definition matrix for bearing type 7’), end
if Rotor_Spd == 0, disp(‘>>>> Error – bearing type 7 – fluid bearing model undefined at zero speed’), end
F = Bearing_Def(i,3); % static load (N) colonne 3,The static bearing’s force needs to be calculated.
D = Bearing_Def(i,4); % bearing diameter (m) colonne 4
L = Bearing_Def(i,5); % bearing length (m) colonne 5
c = Bearing_Def(i,6); % bearing radial clearance (m) colonne 6
eta = Bearing_Def(i,7); % oil viscosity (Ns/m^2) colonne 7
model.bearing = [7 1 Bearing1_diam Bearing1_clear Bearing1_wid Lubricating_oil_number eta; …
7 12 Bearing2_diam Bearing2_clear Bearing2_wid Lubricating_oil_number eta]; check matlab code, matlab compiler MATLAB Answers — New Questions
How to add traction force (F = p/v) to vehicle body block simscape?
Hello,
For the following Simscape model, I would like to add the resistance force (F = P/v) from a drive cycle of an existing vehicle. The goal is to match the torque/speed of the wheels with real-world conditions. Does anyone have tips on how to add this force externally?
Kind regards,
SietseHello,
For the following Simscape model, I would like to add the resistance force (F = P/v) from a drive cycle of an existing vehicle. The goal is to match the torque/speed of the wheels with real-world conditions. Does anyone have tips on how to add this force externally?
Kind regards,
Sietse Hello,
For the following Simscape model, I would like to add the resistance force (F = P/v) from a drive cycle of an existing vehicle. The goal is to match the torque/speed of the wheels with real-world conditions. Does anyone have tips on how to add this force externally?
Kind regards,
Sietse vehicle body, simscape, resistance force, drive cycle, torque MATLAB Answers — New Questions
Attach buttons to graph elements
I’ve created an app using the app designer that creates a graph from user inputs with buttons for adding nodes and edges separately, updating the graph each time a node or edge is added. I want each node and edge to be clickable buttons which open a new dialogue in which additional data can be inputted and viewed in the form of a table or database. Any ideas on how I could achieve this?
The inputs occur like this currently in case it’s helpful:
function NewNodeButtonPushed(app, event)
%get basic node data from user
nodetemp = inputdlg(["Node Name", "Latitude", "Longitude"], "Node Details");
%add code to start
nodeinp = addvars(cell2table(transpose(nodetemp),’VariableNames’,{‘Name’,’Latitude’, …
‘Longitude’}), app.index, ‘before’, 1,’NewVariableNames’,{‘Code’});
%update graph with node data
app.NodeTable=[app.NodeTable; nodeinp];
%app.G=graph(app.EdgeTable,app.NodeTable);
app.G=addnode(app.G,nodeinp);
%display graph
plot(app.UIAxes,app.G,’NodeLabel’,app.G.Nodes.Name,’EdgeLabel’,app.G.Edges.Distance)%plot graph
app.UITable.Data = app.NodeTable;
app.index = app.index + 1; %increment node counter
endI’ve created an app using the app designer that creates a graph from user inputs with buttons for adding nodes and edges separately, updating the graph each time a node or edge is added. I want each node and edge to be clickable buttons which open a new dialogue in which additional data can be inputted and viewed in the form of a table or database. Any ideas on how I could achieve this?
The inputs occur like this currently in case it’s helpful:
function NewNodeButtonPushed(app, event)
%get basic node data from user
nodetemp = inputdlg(["Node Name", "Latitude", "Longitude"], "Node Details");
%add code to start
nodeinp = addvars(cell2table(transpose(nodetemp),’VariableNames’,{‘Name’,’Latitude’, …
‘Longitude’}), app.index, ‘before’, 1,’NewVariableNames’,{‘Code’});
%update graph with node data
app.NodeTable=[app.NodeTable; nodeinp];
%app.G=graph(app.EdgeTable,app.NodeTable);
app.G=addnode(app.G,nodeinp);
%display graph
plot(app.UIAxes,app.G,’NodeLabel’,app.G.Nodes.Name,’EdgeLabel’,app.G.Edges.Distance)%plot graph
app.UITable.Data = app.NodeTable;
app.index = app.index + 1; %increment node counter
end I’ve created an app using the app designer that creates a graph from user inputs with buttons for adding nodes and edges separately, updating the graph each time a node or edge is added. I want each node and edge to be clickable buttons which open a new dialogue in which additional data can be inputted and viewed in the form of a table or database. Any ideas on how I could achieve this?
The inputs occur like this currently in case it’s helpful:
function NewNodeButtonPushed(app, event)
%get basic node data from user
nodetemp = inputdlg(["Node Name", "Latitude", "Longitude"], "Node Details");
%add code to start
nodeinp = addvars(cell2table(transpose(nodetemp),’VariableNames’,{‘Name’,’Latitude’, …
‘Longitude’}), app.index, ‘before’, 1,’NewVariableNames’,{‘Code’});
%update graph with node data
app.NodeTable=[app.NodeTable; nodeinp];
%app.G=graph(app.EdgeTable,app.NodeTable);
app.G=addnode(app.G,nodeinp);
%display graph
plot(app.UIAxes,app.G,’NodeLabel’,app.G.Nodes.Name,’EdgeLabel’,app.G.Edges.Distance)%plot graph
app.UITable.Data = app.NodeTable;
app.index = app.index + 1; %increment node counter
end appdesigner, app designer, graph, figure, table, buttons, input MATLAB Answers — New Questions
New Pixhawk Cube Orange+ hardware incompatible with MATLAB PX4 Toolbox (PX4 v1.14.x)?
Hi all,
It appears that the Pixhawk Cube Orange+ has undergone a hardware change since the MATLAB R2024a PX4 Support Package (PX4 v1.14.0) was released. In my lab we use Cube Orange+ for custom flight control law testing, and a recent purchase of four Cube Orange+ units (ordered August 2025) has revealed a serious compatibility issue:
Older Cube Orange+ boards (purchased before Summer 2025) work perfectly with MATLAB R2024a PX4 Toolbox (PX4 v1.14.0).
Newer Cube Orange+ boards (purchased Aug 2025) are unusable with PX4 v1.14.x–based MATLAB builds, but work fine with newer stock PX4 firmware.
On the newer Cube Orange+ boards, I observe the following behavior:
Stock PX4 v1.15, v1.16, and v1.17 build and flash without issue. RC input works correctly, and peripherals such as GPS, TFmini LiDAR, and airspeed sensors behave as expected.
MATLAB R2024a PX4 toolbox builds (PX4 v1.14.0), which still work on older Cube Orange+ boards, cause the Cube to play the “error tune” immediately after boot when flashed to the newer boards.
RC input is completely missing. The Radio setup screen in QGroundControl shows no channels, and MAVLink Inspector shows no RC_CHANNELS or RC_CHANNELS_RAW messages being published.
RCIN does not respond to standard SBUS input.
When ELRS/CRSF drivers are enabled, some switch activity appears in the Radio screen but is glitchy and not reliably received by the Pixhawk.
TFmini LiDAR modules no longer publish to DISTANCE_SENSOR in MAVLink Inspector.
PWM_MAIN channels 1–8 are disabled after uploading the v1.14.0 firmware.
PWM_MAIN_TIM* parameters are missing, similar to the behavior reported previously on the Pixhawk 6C.
From what I have seen so far, this issue appears to persist with MATLAB R2025a+ (PX4 v1.14.3 firmware), so the proposed 1.14.3 fix that helped the 6C does not appear to resolve this for newer Cube Orange+ boards.
Tests I have already tried on the newer Cube Orange+ units include:
Flashing stock PX4 v1.17, fully setting up the board in QGroundControl, verifying that RC and TFmini work, then flashing MATLAB-generated PX4 v1.14.0 firmware (that still works on older cubes) → error tune and no RC/TFmini.
Flashing stock PX4 v1.16, setting up the board, verifying RC and TFmini, then flashing MATLAB-generated PX4 v1.14.0 firmware → error tune and no RC/TFmini.
Flashing stock PX4 v1.15, setting up the board, verifying RC and TFmini, then flashing MATLAB-generated PX4 v1.14.0 firmware → error tune and no RC/TFmini.
Flashing stock PX4 v1.14.0 directly from the PX4 GitHub repository and setting up the board → error tune and the same loss of RC/TFmini.
Performing a full wipe (SD card erase and parameter reset), then flashing MATLAB-generated PX4 v1.14.0 firmware that still works on older Cube Orange+ units → error tune and no RC/TFmini.
From these tests, I have deduced the following:
The same MATLAB PX4 v1.14.0 firmware remains fully functional on older Cube Orange+ boards.
The same newer Cube Orange+ hardware works correctly with stock PX4 v1.15 and newer.
The newer Cube Orange+ hardware consistently shows broken RC/IO/TFmini behavior with PX4 v1.14.x (both stock builds and MATLAB-generated builds).
This makes me suspect that there has been a hardware revision in the Cube Orange+ and that the IO/RC/PWM layer in PX4 v1.14.x (including the IO firmware) is no longer fully compatible with these newer boards.
A few questions:
Is MathWorks aware of this issue with newer Pixhawk Cube Orange+ hardware and the PX4 v1.14.x–based support packages (R2024a–R2025b)?
Is MATLAB R2026a (or a future PX4 Support Package update) planning to move to PX4 v1.15 or newer, which appears to work reliably on these newer Cube Orange+ boards?
Has anyone else seen this behavior on newer Cube Orange+ units, and if so, has anyone found a workaround or partial solution (e.g., custom IO firmware, patched board configuration, or updated support package)?
Has anyone confirmed whether this issue is also present in the Cube Orange (non +) variants?
Thank you in advance for any guidance, support, or suggestions you may have.
-AHi all,
It appears that the Pixhawk Cube Orange+ has undergone a hardware change since the MATLAB R2024a PX4 Support Package (PX4 v1.14.0) was released. In my lab we use Cube Orange+ for custom flight control law testing, and a recent purchase of four Cube Orange+ units (ordered August 2025) has revealed a serious compatibility issue:
Older Cube Orange+ boards (purchased before Summer 2025) work perfectly with MATLAB R2024a PX4 Toolbox (PX4 v1.14.0).
Newer Cube Orange+ boards (purchased Aug 2025) are unusable with PX4 v1.14.x–based MATLAB builds, but work fine with newer stock PX4 firmware.
On the newer Cube Orange+ boards, I observe the following behavior:
Stock PX4 v1.15, v1.16, and v1.17 build and flash without issue. RC input works correctly, and peripherals such as GPS, TFmini LiDAR, and airspeed sensors behave as expected.
MATLAB R2024a PX4 toolbox builds (PX4 v1.14.0), which still work on older Cube Orange+ boards, cause the Cube to play the “error tune” immediately after boot when flashed to the newer boards.
RC input is completely missing. The Radio setup screen in QGroundControl shows no channels, and MAVLink Inspector shows no RC_CHANNELS or RC_CHANNELS_RAW messages being published.
RCIN does not respond to standard SBUS input.
When ELRS/CRSF drivers are enabled, some switch activity appears in the Radio screen but is glitchy and not reliably received by the Pixhawk.
TFmini LiDAR modules no longer publish to DISTANCE_SENSOR in MAVLink Inspector.
PWM_MAIN channels 1–8 are disabled after uploading the v1.14.0 firmware.
PWM_MAIN_TIM* parameters are missing, similar to the behavior reported previously on the Pixhawk 6C.
From what I have seen so far, this issue appears to persist with MATLAB R2025a+ (PX4 v1.14.3 firmware), so the proposed 1.14.3 fix that helped the 6C does not appear to resolve this for newer Cube Orange+ boards.
Tests I have already tried on the newer Cube Orange+ units include:
Flashing stock PX4 v1.17, fully setting up the board in QGroundControl, verifying that RC and TFmini work, then flashing MATLAB-generated PX4 v1.14.0 firmware (that still works on older cubes) → error tune and no RC/TFmini.
Flashing stock PX4 v1.16, setting up the board, verifying RC and TFmini, then flashing MATLAB-generated PX4 v1.14.0 firmware → error tune and no RC/TFmini.
Flashing stock PX4 v1.15, setting up the board, verifying RC and TFmini, then flashing MATLAB-generated PX4 v1.14.0 firmware → error tune and no RC/TFmini.
Flashing stock PX4 v1.14.0 directly from the PX4 GitHub repository and setting up the board → error tune and the same loss of RC/TFmini.
Performing a full wipe (SD card erase and parameter reset), then flashing MATLAB-generated PX4 v1.14.0 firmware that still works on older Cube Orange+ units → error tune and no RC/TFmini.
From these tests, I have deduced the following:
The same MATLAB PX4 v1.14.0 firmware remains fully functional on older Cube Orange+ boards.
The same newer Cube Orange+ hardware works correctly with stock PX4 v1.15 and newer.
The newer Cube Orange+ hardware consistently shows broken RC/IO/TFmini behavior with PX4 v1.14.x (both stock builds and MATLAB-generated builds).
This makes me suspect that there has been a hardware revision in the Cube Orange+ and that the IO/RC/PWM layer in PX4 v1.14.x (including the IO firmware) is no longer fully compatible with these newer boards.
A few questions:
Is MathWorks aware of this issue with newer Pixhawk Cube Orange+ hardware and the PX4 v1.14.x–based support packages (R2024a–R2025b)?
Is MATLAB R2026a (or a future PX4 Support Package update) planning to move to PX4 v1.15 or newer, which appears to work reliably on these newer Cube Orange+ boards?
Has anyone else seen this behavior on newer Cube Orange+ units, and if so, has anyone found a workaround or partial solution (e.g., custom IO firmware, patched board configuration, or updated support package)?
Has anyone confirmed whether this issue is also present in the Cube Orange (non +) variants?
Thank you in advance for any guidance, support, or suggestions you may have.
-A Hi all,
It appears that the Pixhawk Cube Orange+ has undergone a hardware change since the MATLAB R2024a PX4 Support Package (PX4 v1.14.0) was released. In my lab we use Cube Orange+ for custom flight control law testing, and a recent purchase of four Cube Orange+ units (ordered August 2025) has revealed a serious compatibility issue:
Older Cube Orange+ boards (purchased before Summer 2025) work perfectly with MATLAB R2024a PX4 Toolbox (PX4 v1.14.0).
Newer Cube Orange+ boards (purchased Aug 2025) are unusable with PX4 v1.14.x–based MATLAB builds, but work fine with newer stock PX4 firmware.
On the newer Cube Orange+ boards, I observe the following behavior:
Stock PX4 v1.15, v1.16, and v1.17 build and flash without issue. RC input works correctly, and peripherals such as GPS, TFmini LiDAR, and airspeed sensors behave as expected.
MATLAB R2024a PX4 toolbox builds (PX4 v1.14.0), which still work on older Cube Orange+ boards, cause the Cube to play the “error tune” immediately after boot when flashed to the newer boards.
RC input is completely missing. The Radio setup screen in QGroundControl shows no channels, and MAVLink Inspector shows no RC_CHANNELS or RC_CHANNELS_RAW messages being published.
RCIN does not respond to standard SBUS input.
When ELRS/CRSF drivers are enabled, some switch activity appears in the Radio screen but is glitchy and not reliably received by the Pixhawk.
TFmini LiDAR modules no longer publish to DISTANCE_SENSOR in MAVLink Inspector.
PWM_MAIN channels 1–8 are disabled after uploading the v1.14.0 firmware.
PWM_MAIN_TIM* parameters are missing, similar to the behavior reported previously on the Pixhawk 6C.
From what I have seen so far, this issue appears to persist with MATLAB R2025a+ (PX4 v1.14.3 firmware), so the proposed 1.14.3 fix that helped the 6C does not appear to resolve this for newer Cube Orange+ boards.
Tests I have already tried on the newer Cube Orange+ units include:
Flashing stock PX4 v1.17, fully setting up the board in QGroundControl, verifying that RC and TFmini work, then flashing MATLAB-generated PX4 v1.14.0 firmware (that still works on older cubes) → error tune and no RC/TFmini.
Flashing stock PX4 v1.16, setting up the board, verifying RC and TFmini, then flashing MATLAB-generated PX4 v1.14.0 firmware → error tune and no RC/TFmini.
Flashing stock PX4 v1.15, setting up the board, verifying RC and TFmini, then flashing MATLAB-generated PX4 v1.14.0 firmware → error tune and no RC/TFmini.
Flashing stock PX4 v1.14.0 directly from the PX4 GitHub repository and setting up the board → error tune and the same loss of RC/TFmini.
Performing a full wipe (SD card erase and parameter reset), then flashing MATLAB-generated PX4 v1.14.0 firmware that still works on older Cube Orange+ units → error tune and no RC/TFmini.
From these tests, I have deduced the following:
The same MATLAB PX4 v1.14.0 firmware remains fully functional on older Cube Orange+ boards.
The same newer Cube Orange+ hardware works correctly with stock PX4 v1.15 and newer.
The newer Cube Orange+ hardware consistently shows broken RC/IO/TFmini behavior with PX4 v1.14.x (both stock builds and MATLAB-generated builds).
This makes me suspect that there has been a hardware revision in the Cube Orange+ and that the IO/RC/PWM layer in PX4 v1.14.x (including the IO firmware) is no longer fully compatible with these newer boards.
A few questions:
Is MathWorks aware of this issue with newer Pixhawk Cube Orange+ hardware and the PX4 v1.14.x–based support packages (R2024a–R2025b)?
Is MATLAB R2026a (or a future PX4 Support Package update) planning to move to PX4 v1.15 or newer, which appears to work reliably on these newer Cube Orange+ boards?
Has anyone else seen this behavior on newer Cube Orange+ units, and if so, has anyone found a workaround or partial solution (e.g., custom IO firmware, patched board configuration, or updated support package)?
Has anyone confirmed whether this issue is also present in the Cube Orange (non +) variants?
Thank you in advance for any guidance, support, or suggestions you may have.
-A px4, pixhawk MATLAB Answers — New Questions
As of R2025ab, are all figures now uifigures?
Prior to R2025, the result of the code below was tf=0. Have the figure and uifigure frameworks been unified somehow? Is that why tf is now 1?
fig=figure; plot(1:5);
tf = matlab.ui.internal.isUIFigure(fig)Prior to R2025, the result of the code below was tf=0. Have the figure and uifigure frameworks been unified somehow? Is that why tf is now 1?
fig=figure; plot(1:5);
tf = matlab.ui.internal.isUIFigure(fig) Prior to R2025, the result of the code below was tf=0. Have the figure and uifigure frameworks been unified somehow? Is that why tf is now 1?
fig=figure; plot(1:5);
tf = matlab.ui.internal.isUIFigure(fig) figure, uifigure, matlab.ui.internal.isuifigure, graphics MATLAB Answers — New Questions
Managing large number of large set of parameter
Hello All,
Do you have some tips for managing a lot of design data. I give you my usecase, maybe you can share yours to improve way to manage data under our models.
My simulink models are component-based with many subsystems reference, each subsystem reference are a variant model of several subsystem reference.
each component of my composition can be instancited many times with different parameters.
I build a kind of framework with mask to path different parameters for each instance.
My paramters are manage like that :
CmpObj.Param.MyParam.v
I’ve got as many m-files as instance of my component. So I have a lot of m-files splitted into many folder which is a nightmare.
What do you think ? How did you do ?Hello All,
Do you have some tips for managing a lot of design data. I give you my usecase, maybe you can share yours to improve way to manage data under our models.
My simulink models are component-based with many subsystems reference, each subsystem reference are a variant model of several subsystem reference.
each component of my composition can be instancited many times with different parameters.
I build a kind of framework with mask to path different parameters for each instance.
My paramters are manage like that :
CmpObj.Param.MyParam.v
I’ve got as many m-files as instance of my component. So I have a lot of m-files splitted into many folder which is a nightmare.
What do you think ? How did you do ? Hello All,
Do you have some tips for managing a lot of design data. I give you my usecase, maybe you can share yours to improve way to manage data under our models.
My simulink models are component-based with many subsystems reference, each subsystem reference are a variant model of several subsystem reference.
each component of my composition can be instancited many times with different parameters.
I build a kind of framework with mask to path different parameters for each instance.
My paramters are manage like that :
CmpObj.Param.MyParam.v
I’ve got as many m-files as instance of my component. So I have a lot of m-files splitted into many folder which is a nightmare.
What do you think ? How did you do ? simulink MATLAB Answers — New Questions
Error using assignin in a nested m function
Error using assignin
Attempt to add "q" to a static workspace.
Error in syms (line 283)
assignin(‘caller’, x, xsym);
Error in mywork/myfunction (line 66)
syms a(t) q
This error occurs when running mywork.m but not myfunction alone.Error using assignin
Attempt to add "q" to a static workspace.
Error in syms (line 283)
assignin(‘caller’, x, xsym);
Error in mywork/myfunction (line 66)
syms a(t) q
This error occurs when running mywork.m but not myfunction alone. Error using assignin
Attempt to add "q" to a static workspace.
Error in syms (line 283)
assignin(‘caller’, x, xsym);
Error in mywork/myfunction (line 66)
syms a(t) q
This error occurs when running mywork.m but not myfunction alone. syms MATLAB Answers — New Questions
what is power spectrum value mean (‘pspectrum’)
I used the following code.
This is a code that perform STFT on time series pressure data.
[p, f, t] = pspectrum(Pascal, sample_rate, ‘TimeResolution’, 1, ‘spectrogram’);
The MATLAB hompage explanation says the output(‘p’) represents the power spectrum value.
I want to ask what is a power spectrum value’s physical meaning, How is it related to my input, ‘Pascal’ ?
Thank you.I used the following code.
This is a code that perform STFT on time series pressure data.
[p, f, t] = pspectrum(Pascal, sample_rate, ‘TimeResolution’, 1, ‘spectrogram’);
The MATLAB hompage explanation says the output(‘p’) represents the power spectrum value.
I want to ask what is a power spectrum value’s physical meaning, How is it related to my input, ‘Pascal’ ?
Thank you. I used the following code.
This is a code that perform STFT on time series pressure data.
[p, f, t] = pspectrum(Pascal, sample_rate, ‘TimeResolution’, 1, ‘spectrogram’);
The MATLAB hompage explanation says the output(‘p’) represents the power spectrum value.
I want to ask what is a power spectrum value’s physical meaning, How is it related to my input, ‘Pascal’ ?
Thank you. fft, stft, noise, signal MATLAB Answers — New Questions
Increasing the line width of box plot whiskers
I have written some code to produce 2 boxplots side by side using tiledlayout. I would like to increase the line weight of the boxes and the whiskers and have written the code to do so as follows:
figure()
t = tiledlayout(1,2,’tilespacing’,’none’);
nexttile
boxplot(T_toPlot,’BoxStyle’,’outline’,’Color’, ‘b’, ‘Symbol’,’xk’, ‘OutlierSize’,8,’Labels’, labels);
bx1 = findobj(‘Tag’,’boxplot’);
set(bx1.Children,’LineWidth’,2)
h = findobj(gca,’Tag’,’Box’);
for j=1:length(h)
patch(get(h(j),’XData’),get(h(j),’YData’),get(h(j),’Color’),’FaceAlpha’,.5);
end
clear h j
nexttile
boxplot(S_toPlot,’BoxStyle’,’outline’,’Color’, ‘b’, ‘Symbol’,’xk’, ‘OutlierSize’,8,’Labels’, labels);
bx2 = findobj(‘Tag’,’boxplot’);
set(bx2.Children,’LineWidth’,2)
h = findobj(gca,’Tag’,’Box’);
for j=1:length(h)
patch(get(h(j),’XData’),get(h(j),’YData’),get(h(j),’Color’),’FaceAlpha’,.5);
end
clear h j
The first time I run this code, the first tile runs successfully and I get the following error message for the second tile:
Error using matlab.graphics.primitive.Line/set
Invalid parameter/value pair arguments.
Error in Filename (line XXX)
set(bx2.Children,’LineWidth’,2)
If I then do nothing, just hit enter again to re-run the cell, it then fails with the same error, but now for the first tile – and does not reach the second tile. Even if I clear the workspace and re-run the data processing from scratch, subsequent re-runs will fail for the first tile unless I restart the program. How can I increase the line weight of the boxplots (particularly the whiskers) without running into this problem? Thanks!I have written some code to produce 2 boxplots side by side using tiledlayout. I would like to increase the line weight of the boxes and the whiskers and have written the code to do so as follows:
figure()
t = tiledlayout(1,2,’tilespacing’,’none’);
nexttile
boxplot(T_toPlot,’BoxStyle’,’outline’,’Color’, ‘b’, ‘Symbol’,’xk’, ‘OutlierSize’,8,’Labels’, labels);
bx1 = findobj(‘Tag’,’boxplot’);
set(bx1.Children,’LineWidth’,2)
h = findobj(gca,’Tag’,’Box’);
for j=1:length(h)
patch(get(h(j),’XData’),get(h(j),’YData’),get(h(j),’Color’),’FaceAlpha’,.5);
end
clear h j
nexttile
boxplot(S_toPlot,’BoxStyle’,’outline’,’Color’, ‘b’, ‘Symbol’,’xk’, ‘OutlierSize’,8,’Labels’, labels);
bx2 = findobj(‘Tag’,’boxplot’);
set(bx2.Children,’LineWidth’,2)
h = findobj(gca,’Tag’,’Box’);
for j=1:length(h)
patch(get(h(j),’XData’),get(h(j),’YData’),get(h(j),’Color’),’FaceAlpha’,.5);
end
clear h j
The first time I run this code, the first tile runs successfully and I get the following error message for the second tile:
Error using matlab.graphics.primitive.Line/set
Invalid parameter/value pair arguments.
Error in Filename (line XXX)
set(bx2.Children,’LineWidth’,2)
If I then do nothing, just hit enter again to re-run the cell, it then fails with the same error, but now for the first tile – and does not reach the second tile. Even if I clear the workspace and re-run the data processing from scratch, subsequent re-runs will fail for the first tile unless I restart the program. How can I increase the line weight of the boxplots (particularly the whiskers) without running into this problem? Thanks! I have written some code to produce 2 boxplots side by side using tiledlayout. I would like to increase the line weight of the boxes and the whiskers and have written the code to do so as follows:
figure()
t = tiledlayout(1,2,’tilespacing’,’none’);
nexttile
boxplot(T_toPlot,’BoxStyle’,’outline’,’Color’, ‘b’, ‘Symbol’,’xk’, ‘OutlierSize’,8,’Labels’, labels);
bx1 = findobj(‘Tag’,’boxplot’);
set(bx1.Children,’LineWidth’,2)
h = findobj(gca,’Tag’,’Box’);
for j=1:length(h)
patch(get(h(j),’XData’),get(h(j),’YData’),get(h(j),’Color’),’FaceAlpha’,.5);
end
clear h j
nexttile
boxplot(S_toPlot,’BoxStyle’,’outline’,’Color’, ‘b’, ‘Symbol’,’xk’, ‘OutlierSize’,8,’Labels’, labels);
bx2 = findobj(‘Tag’,’boxplot’);
set(bx2.Children,’LineWidth’,2)
h = findobj(gca,’Tag’,’Box’);
for j=1:length(h)
patch(get(h(j),’XData’),get(h(j),’YData’),get(h(j),’Color’),’FaceAlpha’,.5);
end
clear h j
The first time I run this code, the first tile runs successfully and I get the following error message for the second tile:
Error using matlab.graphics.primitive.Line/set
Invalid parameter/value pair arguments.
Error in Filename (line XXX)
set(bx2.Children,’LineWidth’,2)
If I then do nothing, just hit enter again to re-run the cell, it then fails with the same error, but now for the first tile – and does not reach the second tile. Even if I clear the workspace and re-run the data processing from scratch, subsequent re-runs will fail for the first tile unless I restart the program. How can I increase the line weight of the boxplots (particularly the whiskers) without running into this problem? Thanks! boxplot, matlab MATLAB Answers — New Questions
How to plot and calculate 95% confidence interval
Hello,
I have two vectors of the actual values and predicted values and I want to calculate and plot 95% confidenence interval just like the image I have attached. Colud you please help me?
thanks a lot.Hello,
I have two vectors of the actual values and predicted values and I want to calculate and plot 95% confidenence interval just like the image I have attached. Colud you please help me?
thanks a lot. Hello,
I have two vectors of the actual values and predicted values and I want to calculate and plot 95% confidenence interval just like the image I have attached. Colud you please help me?
thanks a lot. matlab, plot, machine learning MATLAB Answers — New Questions









