Category: News
I need my code to work/dont know what is going wrong.
I am working on a MATLAB assignment where I need to create a custom function called r_wheel.
The function should:
Take two inputs: bet_color and bet_amount
Return three outputs:
result_message (string saying if the bettor won or lost)
winner (0 if lost, 1 if won)
wager_message (string saying how much money was won or lost)
The payout rules are:
Red/Black → 1:1 payout
Green → 17:1 payout
If the bettor loses, they lose the amount wagered.
After that, I need to write a script that runs the function 100 times betting on "red" and calculates the odds of winning.
My issue is that I am not understanding how to get the function to be repeated multiple times and also add to a separate counter.
The error message I get is (Index exceeds the number of array elements. Index must not exceed 1.) Also, the code does not add to a counter, it instead only displays the answer one time.
This is the code for the function I made
function [result_msg,winner,wager_message] = r_wheel(bet_color, bet_amount)
disp(‘Spinning…’)
pause(2) %delay for suspense
random_int=randi([1 38]); %random # between 1 and 38
if random_int < 3 % if the # is less 1 or 2 then result is green
result_color = ‘Green’
wager_message = bet_amount*17 + bet_amount;
elseif (random_int <21) && (random_int>2)
result_color = ‘Red’ % if # is between 3 and 20 result is red
wager_message = bet_amount*2;
else
result_color = ‘Black’ %if # is between 21 and 38 the result is black
wager_message = bet_amount*2;
end
disp(result_color)
if strcmp(result_color, bet_color) % using string compare function to chekc if strings are the same
result_msg = ‘Congratulations! You win!’; % if bet color is correct set result to win
winner = 1; %set winner variable to 1
wager_message = wager_message
else
result_msg = ‘Sorry, you lose. Better luck next time!’; %if the bet color is not the same as result color set message
winner = 0; %set winner variable to 0
wager_message = -bet_amount
end
end
And here is the code for the loop.
clc, clear
x=’Red’
y= 15
win_count = 0
for i = 1:100
[result,winner]=r_wheel(x, y) % runs the function
win_count = 0
[result,winner]=r_wheel(x, y)
if winner(i)==1
win_count(i) = win_count(i)+1
else
win_count(i)= win_count(i)
end
end
disp(win_count)
disp(result)I am working on a MATLAB assignment where I need to create a custom function called r_wheel.
The function should:
Take two inputs: bet_color and bet_amount
Return three outputs:
result_message (string saying if the bettor won or lost)
winner (0 if lost, 1 if won)
wager_message (string saying how much money was won or lost)
The payout rules are:
Red/Black → 1:1 payout
Green → 17:1 payout
If the bettor loses, they lose the amount wagered.
After that, I need to write a script that runs the function 100 times betting on "red" and calculates the odds of winning.
My issue is that I am not understanding how to get the function to be repeated multiple times and also add to a separate counter.
The error message I get is (Index exceeds the number of array elements. Index must not exceed 1.) Also, the code does not add to a counter, it instead only displays the answer one time.
This is the code for the function I made
function [result_msg,winner,wager_message] = r_wheel(bet_color, bet_amount)
disp(‘Spinning…’)
pause(2) %delay for suspense
random_int=randi([1 38]); %random # between 1 and 38
if random_int < 3 % if the # is less 1 or 2 then result is green
result_color = ‘Green’
wager_message = bet_amount*17 + bet_amount;
elseif (random_int <21) && (random_int>2)
result_color = ‘Red’ % if # is between 3 and 20 result is red
wager_message = bet_amount*2;
else
result_color = ‘Black’ %if # is between 21 and 38 the result is black
wager_message = bet_amount*2;
end
disp(result_color)
if strcmp(result_color, bet_color) % using string compare function to chekc if strings are the same
result_msg = ‘Congratulations! You win!’; % if bet color is correct set result to win
winner = 1; %set winner variable to 1
wager_message = wager_message
else
result_msg = ‘Sorry, you lose. Better luck next time!’; %if the bet color is not the same as result color set message
winner = 0; %set winner variable to 0
wager_message = -bet_amount
end
end
And here is the code for the loop.
clc, clear
x=’Red’
y= 15
win_count = 0
for i = 1:100
[result,winner]=r_wheel(x, y) % runs the function
win_count = 0
[result,winner]=r_wheel(x, y)
if winner(i)==1
win_count(i) = win_count(i)+1
else
win_count(i)= win_count(i)
end
end
disp(win_count)
disp(result) I am working on a MATLAB assignment where I need to create a custom function called r_wheel.
The function should:
Take two inputs: bet_color and bet_amount
Return three outputs:
result_message (string saying if the bettor won or lost)
winner (0 if lost, 1 if won)
wager_message (string saying how much money was won or lost)
The payout rules are:
Red/Black → 1:1 payout
Green → 17:1 payout
If the bettor loses, they lose the amount wagered.
After that, I need to write a script that runs the function 100 times betting on "red" and calculates the odds of winning.
My issue is that I am not understanding how to get the function to be repeated multiple times and also add to a separate counter.
The error message I get is (Index exceeds the number of array elements. Index must not exceed 1.) Also, the code does not add to a counter, it instead only displays the answer one time.
This is the code for the function I made
function [result_msg,winner,wager_message] = r_wheel(bet_color, bet_amount)
disp(‘Spinning…’)
pause(2) %delay for suspense
random_int=randi([1 38]); %random # between 1 and 38
if random_int < 3 % if the # is less 1 or 2 then result is green
result_color = ‘Green’
wager_message = bet_amount*17 + bet_amount;
elseif (random_int <21) && (random_int>2)
result_color = ‘Red’ % if # is between 3 and 20 result is red
wager_message = bet_amount*2;
else
result_color = ‘Black’ %if # is between 21 and 38 the result is black
wager_message = bet_amount*2;
end
disp(result_color)
if strcmp(result_color, bet_color) % using string compare function to chekc if strings are the same
result_msg = ‘Congratulations! You win!’; % if bet color is correct set result to win
winner = 1; %set winner variable to 1
wager_message = wager_message
else
result_msg = ‘Sorry, you lose. Better luck next time!’; %if the bet color is not the same as result color set message
winner = 0; %set winner variable to 0
wager_message = -bet_amount
end
end
And here is the code for the loop.
clc, clear
x=’Red’
y= 15
win_count = 0
for i = 1:100
[result,winner]=r_wheel(x, y) % runs the function
win_count = 0
[result,winner]=r_wheel(x, y)
if winner(i)==1
win_count(i) = win_count(i)+1
else
win_count(i)= win_count(i)
end
end
disp(win_count)
disp(result) matlab code, help, error MATLAB Answers — New Questions
Can I configure a mex compiler on toolbox installation?
I have set of XML mexopts files and helper files that enable the use of the MinGW and Cygwin Fortran compilers on Windows on pre-R2024a releases. I’d like to package these in a toolbox like the compiler support package from Mathworks: https://www.mathworks.com/matlabcentral/fileexchange/52848-matlab-support-for-mingw-w64-c-c-fortran-compiler
On a fresh install of Matlab (i.e. mex not previously set up), installing that toolbox sets up the MinGW compilers. I don’t see a mechanism in the toolbox packaging tool to do this, though, and the only other answers I could find on this question suggest either having a check run the first time the user executes a toolbox function or having the user run a setup function.
Is there a way to do this automatically for user-created toolboxes?I have set of XML mexopts files and helper files that enable the use of the MinGW and Cygwin Fortran compilers on Windows on pre-R2024a releases. I’d like to package these in a toolbox like the compiler support package from Mathworks: https://www.mathworks.com/matlabcentral/fileexchange/52848-matlab-support-for-mingw-w64-c-c-fortran-compiler
On a fresh install of Matlab (i.e. mex not previously set up), installing that toolbox sets up the MinGW compilers. I don’t see a mechanism in the toolbox packaging tool to do this, though, and the only other answers I could find on this question suggest either having a check run the first time the user executes a toolbox function or having the user run a setup function.
Is there a way to do this automatically for user-created toolboxes? I have set of XML mexopts files and helper files that enable the use of the MinGW and Cygwin Fortran compilers on Windows on pre-R2024a releases. I’d like to package these in a toolbox like the compiler support package from Mathworks: https://www.mathworks.com/matlabcentral/fileexchange/52848-matlab-support-for-mingw-w64-c-c-fortran-compiler
On a fresh install of Matlab (i.e. mex not previously set up), installing that toolbox sets up the MinGW compilers. I don’t see a mechanism in the toolbox packaging tool to do this, though, and the only other answers I could find on this question suggest either having a check run the first time the user executes a toolbox function or having the user run a setup function.
Is there a way to do this automatically for user-created toolboxes? toolbox, mex MATLAB Answers — New Questions
Resetting a memoized function
I know that clearCache will clear the cache of a MemoizedFunction, but how would you reset its other properties to their defaults? I would have thought that rebuilding it with memoize() would do so, but the test below shows that that does not work.
mf=memoize(@localFcn) %default property values
mf.CacheSize=3; mf.Enabled=false %make some non-default property settings
clear mf
mf=memoize(@localFcn) %clear and rebuild — but property values do not reset!!!!
function y=localFcn(x)
y=x.^2;
endI know that clearCache will clear the cache of a MemoizedFunction, but how would you reset its other properties to their defaults? I would have thought that rebuilding it with memoize() would do so, but the test below shows that that does not work.
mf=memoize(@localFcn) %default property values
mf.CacheSize=3; mf.Enabled=false %make some non-default property settings
clear mf
mf=memoize(@localFcn) %clear and rebuild — but property values do not reset!!!!
function y=localFcn(x)
y=x.^2;
end I know that clearCache will clear the cache of a MemoizedFunction, but how would you reset its other properties to their defaults? I would have thought that rebuilding it with memoize() would do so, but the test below shows that that does not work.
mf=memoize(@localFcn) %default property values
mf.CacheSize=3; mf.Enabled=false %make some non-default property settings
clear mf
mf=memoize(@localFcn) %clear and rebuild — but property values do not reset!!!!
function y=localFcn(x)
y=x.^2;
end memoize MATLAB Answers — New Questions
Create Timeseries Objekt in MATLAB with the property “StoredUnits”
I have various measured values in MATLAB and would like to convert them into a ‘timeseries’ object so that I can analyze them in SDI. To do this, however, the “StoredUnits” property of the ‘timeseries’ object must also be set so that the scaling for the data cursor can then be changed in SDI from, for example, “m/s” to “km/h.”
But “StoredUnits” is not offered in the properties of the ‘timeseries’ object.
% create timeseries-Objekt (example)
temp = timeseries(data, time, "Name", "test", "StoredUnits", "m/s")
Error:
Error using timeseries/init (line 153)
Invalid property name
The alternative method of loading the corresponding signal from the SDI into MATLAB and then setting the property results in the following message::
% get current run from SDI
countRun = Simulink.sdi.Run.getLatest;
% load respective signal
inSigID = getSignalByIndex(countRun, 1);
% set property
inSigID.StoredUnits = "m/s";
Error:
Unable to set the ‘StoredUnits’ property of class ‘Signal’ because it is read-only.
This raises the question: how can a ‘timeseries’ object with the “StoredUnits” property be created in MATLAB?I have various measured values in MATLAB and would like to convert them into a ‘timeseries’ object so that I can analyze them in SDI. To do this, however, the “StoredUnits” property of the ‘timeseries’ object must also be set so that the scaling for the data cursor can then be changed in SDI from, for example, “m/s” to “km/h.”
But “StoredUnits” is not offered in the properties of the ‘timeseries’ object.
% create timeseries-Objekt (example)
temp = timeseries(data, time, "Name", "test", "StoredUnits", "m/s")
Error:
Error using timeseries/init (line 153)
Invalid property name
The alternative method of loading the corresponding signal from the SDI into MATLAB and then setting the property results in the following message::
% get current run from SDI
countRun = Simulink.sdi.Run.getLatest;
% load respective signal
inSigID = getSignalByIndex(countRun, 1);
% set property
inSigID.StoredUnits = "m/s";
Error:
Unable to set the ‘StoredUnits’ property of class ‘Signal’ because it is read-only.
This raises the question: how can a ‘timeseries’ object with the “StoredUnits” property be created in MATLAB? I have various measured values in MATLAB and would like to convert them into a ‘timeseries’ object so that I can analyze them in SDI. To do this, however, the “StoredUnits” property of the ‘timeseries’ object must also be set so that the scaling for the data cursor can then be changed in SDI from, for example, “m/s” to “km/h.”
But “StoredUnits” is not offered in the properties of the ‘timeseries’ object.
% create timeseries-Objekt (example)
temp = timeseries(data, time, "Name", "test", "StoredUnits", "m/s")
Error:
Error using timeseries/init (line 153)
Invalid property name
The alternative method of loading the corresponding signal from the SDI into MATLAB and then setting the property results in the following message::
% get current run from SDI
countRun = Simulink.sdi.Run.getLatest;
% load respective signal
inSigID = getSignalByIndex(countRun, 1);
% set property
inSigID.StoredUnits = "m/s";
Error:
Unable to set the ‘StoredUnits’ property of class ‘Signal’ because it is read-only.
This raises the question: how can a ‘timeseries’ object with the “StoredUnits” property be created in MATLAB? sdi timeseries storedunits MATLAB Answers — New Questions
How can I set up Keycloak for use with MATLAB Web App Server?
I would like to set up Keycloak for authentication for MATLAB Web App Server, as I do not have my own identity provider. However, I am on Windows and cannot use the cloud reference architectures.
How do I manually set up Keycloak for authentication with MATLAB Web App Server?I would like to set up Keycloak for authentication for MATLAB Web App Server, as I do not have my own identity provider. However, I am on Windows and cannot use the cloud reference architectures.
How do I manually set up Keycloak for authentication with MATLAB Web App Server? I would like to set up Keycloak for authentication for MATLAB Web App Server, as I do not have my own identity provider. However, I am on Windows and cannot use the cloud reference architectures.
How do I manually set up Keycloak for authentication with MATLAB Web App Server? mwas, authnz MATLAB Answers — New Questions
How to Use Scoped Graph Permissions with SharePoint Lists
Enable App Access to Selected List and List Items
In the last article about scoped Graph permissions for app access to SharePoint Online and OneDrive for Business content, I discussed how to limit app access to specific files and folders. This article considers scoped permissions to lists and list items, both covered in Microsoft’s documentation about selected permissions in OneDrive and SharePoint.
Things weren’t as straightforward as dealing with files and folders. Part of this is due to the fact that the list permissions are only supported by the beta endpoint, and part is due to some documentation errors, or perhaps my understanding of what the documentation says. Anyway, let’s see how things transpired.
Adding App Access for a List
For this discussion, I use an app registration named “Limited Access to Lists” that has consent for the Lists.SelectedOperations.Selected and ListItems.SelectedOperations.Selected Graph application permissions (Figure 1). The Lists.SelectedOperations.Selected Graph permission gives an app the ability to use a scoped permission added to a list object to access the list.

To create the scoped permission, sign into an account with Sites.FullControl.All permission and populate variables with the identifiers for the application and the target site and list.
$AppId = (Get-MgApplication -Filter "displayName eq 'Limited Access to Lists").AppId $Site = Get-MgSite -Search "https://office365itpros.sharepoint.com/sites/ITComms" $List = Get-MgSiteList -SiteId $Site.Id -Filter "displayName eq 'Travel Requests'"
The next step is to construct the URI to post the Graph request to add the permission. As you can see, the URI points to the target list using the identifiers retrieved above. At the time of writing, only the beta version of the Lists endpoint supports the assignment of scoped permissions.
$Uri = ("https://graph.microsoft.com/beta/sites/{0}/lists/{1}/permissions" -f $Site.Id, $List.Id)The request body connects the app to the permission and is included in the POST request to add the scoped permission. Like the request bodies used to assign permissions to files and folders, the grantedTo property contains details of the app rather than the grantedToV2 property used by scoped site permission assignments:
$Requestbody = @{
roles = @("write") # or "read", "owner", "fullcontrol"
grantedTo = @{
application = @{
id = $AppId # Application (client) ID GUID
}
}
}
Invoke-MgGraphRequest -Uri $Uri -Method Post -Body $RequestBodyIf SharePoint Online accepts the command to create the new permission, it responds with details of the permission. To check that everything’s OK, you can use the same URI to retrieve the permissions for the list:
$Permissions = Invoke-MgGraphRequest -Uri $Uri -Method Get | Select-Object -ExpandProperty Value
You’ll find a write permission in the list of permissions. By examining the grantedToV2 property, we can see that the permission is granted to an application with the correct app identifier.
id aTowaS50fG1zLnNwLmV4dHw4NmEyMzQ1My05YWY0LTRmZDItYjEyYi02ODZjZWE3MzE2MDlAYjY2MjMxM2YtMTRmYy00M2EyLTlhN2EtZDJlMjdmNGYzNDc4
grantedToV2 {[application, System.Collections.Hashtable]}
roles {write}
$Permissions[-1].grantedToV2
Name Value
---- -----
application {[id, 86a23453-9af4-4fd2-b12b-686cea731609]}
Using Scoped App Access for a List
With the permission in place, the app can sign in access the list. The app doesn’t have consent to run Get-MgSite to enumerate or search for sites, so the site identifier might need to be hard coded. As you can see, the app can see the full set of lists in the site, including the lists used for document libraries:
$SiteId = "office365itpros.sharepoint.com,2b61a408-f05d-45b8-9d68-fb020131f86c,51ede316-f0de-4621-b315-39ce1d91d18c" Get-MgSiteList -SiteId $SiteId | Format-Table DisplayName, Id DisplayName Id ----------- -- Web Template Extensions 5feb3e71-34bb-4d87-b112-032a4e0282c7 Travel requests 04c4ef13-5245-4df1-9192-14bdca47bac3 Documents 1553d797-3e0c-4645-ac4e-b2562a2c39c5
Although the app can see the other lists, it only has permission to read items from the Travel Requests list. Here’s the code for the app to retrieve the list items:
$List = Get-MgSiteList -SiteId $SiteId -filter "displayName eq 'Travel Requests'" [array]$Data = Get-MgSiteListItem -ListId $List.Id -SiteId $SiteId
Using the techniques explained in this article, this code fetches the list items and builds a PowerShell list from the information extracted from each item:
[array]$ListItems = Get-MgSiteListItem -ListId $List.Id -SiteId $SiteId -ExpandProperty "fields(`$select=id,Linktitle,requester,reasonfortravel,destination)" -PageSize 500 -All
$ItemData = [System.Collections.Generic.List[Object]]::new()
ForEach ($Item in $ListItems.fields) {
$FullName = ($Item.AdditionalProperties.FullName)
$ReportLine = [PSCustomObject] @{
Id = $Item.Id
'Trip Title' = $Item.additionalProperties.LinkTitle
'Reason for travel' = $Item.AdditionalProperties.ReasonForTravel
Requester = $Item.AdditionalProperties.Requester
Destination = $Item.AdditionalProperties.Destination.displayName
}
$ItemData.Add($ReportLine)
}
After processing, the details of an item look like this:
Id : 1 Trip Title : Microsoft 365 Community Conference 2026 Reason for travel : Networking and learning Requester : Adele Vance Destination : Orlando
Grant App Access for a List Item
Getting even more granular, we can use much the same technique to give permission to an app for one or more items in a list. The app must have consent for the ListItems.SelectedOperations.Selected Graph permission to use item-level access.
To assign permission for a list item, the URI is built from the site and list identifiers as before with the inclusion of the list item identifier (simple integers like 1, 2, 3, and so on). Granting access is done with the same kind of POST request and request body.
$Uri = ("https://graph.microsoft.com/beta/sites/{0}/lists/{1}/items/{2}/permissions" -f $Site.Id, $List.Id, $ListItemId)
Invoke-MgGraphRequest -Uri $Uri -Method Post -Body $RequestBody
With an item-level permission in place, the app is limited to interacting with that item. All other items in the list are invisible.
Granular Access for Lists and Items
In summary, the delegated scope permissions for lists allow tenants to grant app granular levels of access to list and list items. Consider using this feature to restrict apps to accessing just the required information instead of having unfettered access to all the lists and list items in a site.
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.
Microsoft Sovereign Cloud adds governance, productivity and support for large AI models securely running even when completely disconnected
As digital sovereignty becomes a strategic requirement, organizations are rethinking how they deploy critical infrastructure and AI capabilities under tighter regulatory expectations and higher risk conditions. Microsoft’s approach to sovereignty is grounded in enabling enterprises, public sectors and regulated industries to participate in the digital economy securely, independently and on their own terms. The Microsoft Sovereign Cloud brings together productivity, security and cloud workloads to span both public and private environments. Customers can choose the right control posture for each workload, through a continuum of sovereign options protecting against fragmenting their architecture or increasing operational risk. Trust is built on confidence: confidence that data stays protected, controls are enforceable and operations can continue under real-world conditions.
To support these confidential environments, Microsoft offers full stack capabilities that support customers across connected, intermittently connected and fully disconnected modes. Today’s expansion of capabilities includes three major updates:
- Azure Local disconnected operations (now available) – Organizations can now run mission-critical infrastructure with Azure governance and policy control, with no cloud connectivity, optimizing continuity for sovereign, classified or isolated environments.
- Microsoft 365 Local disconnected (now available) – Core productivity workloads, Exchange Server, SharePoint Server and Skype for Business Server can run fully inside the customer’s sovereign operational boundary on Azure Local, keeping teams productive even when disconnected from the cloud.
- Foundry Local adds modern infrastructure capabilities and support for large AI models – Organizations can now bring large AI models into fully disconnected, sovereign environments with Foundry Local. Using modern infrastructure from partners like NVIDIA, customers with sovereign needs will now be able to run multimodal models locally on their own hardware, inside strict sovereign boundaries enabling powerful, local AI inferencing in fully disconnected environments.

This delivers a truly localized full stack experience built on Azure Local infrastructure and Microsoft 365 Local workloads, designed to stay resilient across any connectivity condition, with large models being part of Foundry Local extending the stack to run advanced multimodal models locally, securely, even when fully disconnected. Customers can now help maintain uninterrupted operations, keep mission critical workloads protected and apply consistent governance and policy enforcement, while keeping data, identities and operations within their sovereign boundaries.
Azure Local runs critical infrastructure locally, even when disconnected
For workloads with specialized requirements, Azure Local provides the on-premises foundation with consistent Azure governance and policy controls. With Azure Local disconnected operations, management, policy and workload execution stay within the customer-operated environments, so services continue running securely even when environments must be isolated or connectivity is not available. Using familiar Azure experiences and consistent policies, organizations can deploy and govern workloads locally without depending on continuous connection to public cloud services. Azure Local is designed to scale with mission-critical needs from smaller deployments to larger footprints that support data-intensive and AI-driven workloads. Customers can start fast, expand over time and maintain a unified operational model, all within their sovereign boundary.
Operating in disconnected environments surfaces constraints that go beyond traditional cloud assumptions: External dependencies may be unacceptable, connectivity may be intentionally restricted and operational continuity is a business imperative.
“The availability of Azure Local disconnected operations represents a breakthrough for organizations that need control over their data without sacrificing the power of the Microsoft Cloud. For Luxembourg, where digital sovereignty is not just a principle but a strategic necessity, this model offers the resilience, autonomy and trust our market expects. By combining Microsoft’s technological leadership with Proximus NXT’s sovereign cloud expertise, we are enabling our customers to innovate confidently — even in fully disconnected mode,” said Gerard Hoffmann, CEO Proximus Luxembourg.
Microsoft 365 Local keeps productivity and collaboration available in fully disconnected environments
As sovereign environments move into disconnected environments, keeping people productive becomes just as critical as keeping infrastructure online. Building on more than a decade of delivering and supporting these services, Microsoft 365 Local disconnected brings that continuity to the productivity layer, delivering Microsoft’s core server workloads — Exchange Server, SharePoint Server and Skype for Business Server supported through at least 2035 — directly into the customer’s sovereign private cloud.
With Microsoft 365 Local, teams can communicate, share information and collaborate securely within the same controlled boundary as their infrastructure and AI workloads. Everything runs locally, under customer-owned policies, with full control of data resiliency, access and compliance. By operating with Azure-consistent management and governance, customers get the productivity experience they rely on, designed to stay resilient and secure even when offline.
Bringing large models and modern infrastructure to Foundry Local
With the availability of larger models and modern infrastructure as part of the Foundry Local portfolio, Microsoft is enabling customers with highly secure environments the ability to run multimodal, large models directly inside their sovereign private cloud environments. This brings the richness of Microsoft’s enterprise AI capabilities to on-premises systems, complete with local inferencing and APIs that operate completely within customer-controlled data boundaries.
Expanding beyond small models, the integration of Foundry Local with Azure Local is specifically designed to support large-scale models utilizing the latest GPUs from partners such as NVIDIA. Microsoft will provide comprehensive support for deployments, updates and operational health. Even as inferencing demands increase over time, customers retain complete control over their data and hardware.
Choice and control without added complexity
Customers facing strict sovereignty and regulatory requirements are clear that a fully disconnected sovereign private cloud is a key business need. Microsoft Sovereign Private Cloud is designed to meet these needs head-on, enabling secure, compliant operations even in environments with no external connectivity. At the same time, we recognize that disconnected environments are not one-size-fits-all; some customers operate across connected, hybrid and disconnected modes based on mission, risk and regulation. Our approach helps customers to meet strict sovereign requirements in fully disconnected scenarios without compromising simplicity, while retaining flexibility where connectivity is possible. Together, Azure Local disconnected operations, Microsoft 365 Local and Foundry Local help organizations choose where workloads run and how environments are managed, while standardizing governance and operational practices across connected and disconnected deployments.
Get started
- Azure Local disconnected operations and Microsoft 365 Local disconnected are now available worldwide, and large models on Foundry Local are available to qualified customers.
- Explore the Microsoft Sovereign Cloud
- Learn more about Azure Local disconnected operations
Douglas Phillips leads global engineering efforts for Microsoft’s specialized, sovereign, and private clouds. He is responsible for Microsoft’s global strategy, products and operations that bring Microsoft’s industry-leading solutions, including Azure, our adaptive cloud portfolio and Microsoft 365 collaboration suite, to customers with additional sovereignty, security, edge and compliance requirements.
The post Microsoft Sovereign Cloud adds governance, productivity and support for large AI models securely running even when completely disconnected appeared first on The Official Microsoft Blog.
As digital sovereignty becomes a strategic requirement, organizations are rethinking how they deploy critical infrastructure and AI capabilities under tighter regulatory expectations and higher risk conditions. Microsoft’s approach to sovereignty is grounded in enabling enterprises, public sectors and regulated industries to participate in the digital economy securely, independently and on their own terms. The Microsoft Sovereign Cloud brings together productivity, security and cloud workloads to span both…
The post Microsoft Sovereign Cloud adds governance, productivity and support for large AI models securely running even when completely disconnected appeared first on The Official Microsoft Blog.
Read More
How do I use ‘intersection’ to get the overlapping line between two polyshapes?
Hi – how do I get the line intersection between two polyshapes that overlap along a line? A super-simplified example is below. For the real case, the shapes are more complicated, but I think the simplified case covers it. I’m maybe not understanding how the intersection function works! Thank you!
function main()
%clear all; % completely superfluous in function workspace
x1 = [1 4 4 1];
y1 = [1 1 4 4];
x2 = [4 6 6 4];
y2 = [2 2 3 3];
poly1 = polyshape(x1,y1);
% the poly2 ‘grows’ from poly1
poly2 = polyshape(x2,y2);
poly2 = union(poly1,poly2);
growthPoly = subtract(poly2,poly1,"KeepCollinearPoints",true);
close all;
hold on;
plot(poly1,’FaceColor’,’none’,’EdgeColor’,’k’,’LineWidth’,12);
plot(poly2,’FaceColor’,’none’,’EdgeColor’,’g’,’LineWidth’,8);
plot(growthPoly,’FaceColor’,’none’,’EdgeColor’,’r’,’LineWidth’,4);
% this comes back empty and nothing gets plotted
growthLine = intersect(poly1,growthPoly,"KeepCollinearPoints",true);
plot(growthLine,’FaceColor’,’none’,’EdgeColor’,’b’,’LineWidth’,2);
legend({‘The initial poly1’,…
‘poly2 grew from poly1’,…
‘The growth area is the difference between poly2 and poly1′},’Box’,’off’,’Location’,’south’,’FontSize’,18);
title({‘How do I get the ”growthLine” part that is red-on-black?’;’I thought it would be the intersection of the black and red, but no dice’;’I thought it would show up as a blue line’},’FontSize’,22);
endHi – how do I get the line intersection between two polyshapes that overlap along a line? A super-simplified example is below. For the real case, the shapes are more complicated, but I think the simplified case covers it. I’m maybe not understanding how the intersection function works! Thank you!
function main()
%clear all; % completely superfluous in function workspace
x1 = [1 4 4 1];
y1 = [1 1 4 4];
x2 = [4 6 6 4];
y2 = [2 2 3 3];
poly1 = polyshape(x1,y1);
% the poly2 ‘grows’ from poly1
poly2 = polyshape(x2,y2);
poly2 = union(poly1,poly2);
growthPoly = subtract(poly2,poly1,"KeepCollinearPoints",true);
close all;
hold on;
plot(poly1,’FaceColor’,’none’,’EdgeColor’,’k’,’LineWidth’,12);
plot(poly2,’FaceColor’,’none’,’EdgeColor’,’g’,’LineWidth’,8);
plot(growthPoly,’FaceColor’,’none’,’EdgeColor’,’r’,’LineWidth’,4);
% this comes back empty and nothing gets plotted
growthLine = intersect(poly1,growthPoly,"KeepCollinearPoints",true);
plot(growthLine,’FaceColor’,’none’,’EdgeColor’,’b’,’LineWidth’,2);
legend({‘The initial poly1’,…
‘poly2 grew from poly1’,…
‘The growth area is the difference between poly2 and poly1′},’Box’,’off’,’Location’,’south’,’FontSize’,18);
title({‘How do I get the ”growthLine” part that is red-on-black?’;’I thought it would be the intersection of the black and red, but no dice’;’I thought it would show up as a blue line’},’FontSize’,22);
end Hi – how do I get the line intersection between two polyshapes that overlap along a line? A super-simplified example is below. For the real case, the shapes are more complicated, but I think the simplified case covers it. I’m maybe not understanding how the intersection function works! Thank you!
function main()
%clear all; % completely superfluous in function workspace
x1 = [1 4 4 1];
y1 = [1 1 4 4];
x2 = [4 6 6 4];
y2 = [2 2 3 3];
poly1 = polyshape(x1,y1);
% the poly2 ‘grows’ from poly1
poly2 = polyshape(x2,y2);
poly2 = union(poly1,poly2);
growthPoly = subtract(poly2,poly1,"KeepCollinearPoints",true);
close all;
hold on;
plot(poly1,’FaceColor’,’none’,’EdgeColor’,’k’,’LineWidth’,12);
plot(poly2,’FaceColor’,’none’,’EdgeColor’,’g’,’LineWidth’,8);
plot(growthPoly,’FaceColor’,’none’,’EdgeColor’,’r’,’LineWidth’,4);
% this comes back empty and nothing gets plotted
growthLine = intersect(poly1,growthPoly,"KeepCollinearPoints",true);
plot(growthLine,’FaceColor’,’none’,’EdgeColor’,’b’,’LineWidth’,2);
legend({‘The initial poly1’,…
‘poly2 grew from poly1’,…
‘The growth area is the difference between poly2 and poly1′},’Box’,’off’,’Location’,’south’,’FontSize’,18);
title({‘How do I get the ”growthLine” part that is red-on-black?’;’I thought it would be the intersection of the black and red, but no dice’;’I thought it would show up as a blue line’},’FontSize’,22);
end polyshape, intersection, union, subtract MATLAB Answers — New Questions
Why Does ifourier Not Return Equivalent Results for Equivalent Transforms?
Consider two expressions of a Fourier transform
syms t omega real
HU(omega) = -(exp(-omega*1i)*(exp(omega*1i) – 1)*(omega + 1i))/(omega*(omega^2 + 1))
Y(omega) = (exp(-omega*1i)*1i – 1i)/(omega*(1 + omega*1i))
The transforms are equivalent
simplify(HU(omega)-Y(omega))
so I would expect the inverse transforms to be equivalent.
Inverse transform of Y(omega)
y(t) = ifourier(Y(omega),omega,t)
Inverse transform of HU(omega)
hu(t) = ifourier(HU(omega),omega,t)
hu(t) looks complicated, but the primary concern is that Dirac delta in the first term in the numerator.
Simplify both expressions
s = @(z) simplify(rewrite(simplify(z),’heaviside’));
y(t) = s(y(t))
hu(t) = s(hu(t))
Sure enough, both time domain signals are the same with the exception that hu(t) includes that Dirac delta term.
Show that they are the same, except for the Dirac delta, by subtracting and using fplot that ignores Dirac delta terms:
figure
fplot(y(t)-hu(t),[-10,10]),ylim([-1e-16,1e-16])
Is this a bug, or is there a problem in the code, or am I misunderstanding what the results should be?Consider two expressions of a Fourier transform
syms t omega real
HU(omega) = -(exp(-omega*1i)*(exp(omega*1i) – 1)*(omega + 1i))/(omega*(omega^2 + 1))
Y(omega) = (exp(-omega*1i)*1i – 1i)/(omega*(1 + omega*1i))
The transforms are equivalent
simplify(HU(omega)-Y(omega))
so I would expect the inverse transforms to be equivalent.
Inverse transform of Y(omega)
y(t) = ifourier(Y(omega),omega,t)
Inverse transform of HU(omega)
hu(t) = ifourier(HU(omega),omega,t)
hu(t) looks complicated, but the primary concern is that Dirac delta in the first term in the numerator.
Simplify both expressions
s = @(z) simplify(rewrite(simplify(z),’heaviside’));
y(t) = s(y(t))
hu(t) = s(hu(t))
Sure enough, both time domain signals are the same with the exception that hu(t) includes that Dirac delta term.
Show that they are the same, except for the Dirac delta, by subtracting and using fplot that ignores Dirac delta terms:
figure
fplot(y(t)-hu(t),[-10,10]),ylim([-1e-16,1e-16])
Is this a bug, or is there a problem in the code, or am I misunderstanding what the results should be? Consider two expressions of a Fourier transform
syms t omega real
HU(omega) = -(exp(-omega*1i)*(exp(omega*1i) – 1)*(omega + 1i))/(omega*(omega^2 + 1))
Y(omega) = (exp(-omega*1i)*1i – 1i)/(omega*(1 + omega*1i))
The transforms are equivalent
simplify(HU(omega)-Y(omega))
so I would expect the inverse transforms to be equivalent.
Inverse transform of Y(omega)
y(t) = ifourier(Y(omega),omega,t)
Inverse transform of HU(omega)
hu(t) = ifourier(HU(omega),omega,t)
hu(t) looks complicated, but the primary concern is that Dirac delta in the first term in the numerator.
Simplify both expressions
s = @(z) simplify(rewrite(simplify(z),’heaviside’));
y(t) = s(y(t))
hu(t) = s(hu(t))
Sure enough, both time domain signals are the same with the exception that hu(t) includes that Dirac delta term.
Show that they are the same, except for the Dirac delta, by subtracting and using fplot that ignores Dirac delta terms:
figure
fplot(y(t)-hu(t),[-10,10]),ylim([-1e-16,1e-16])
Is this a bug, or is there a problem in the code, or am I misunderstanding what the results should be? ifourier, inconsistent results MATLAB Answers — New Questions
How to do 1D signal analysis?
I just need an example:
%% =========================
% [2.1] FFT calculation & plotting
% [2.5] Band power computation
% [1.1] Numerical integration (trapz)
% Custom PSD function (FFT-based periodogram)
% =========================
function [f, PSD] = myPSD(x, Fs)
x = x(:); % force column vector
x = x – mean(x); % remove DC offset
N = length(x);
X = fft(x);
K = floor(N/2); % one-sided spectrum length index
X = X(1:K+1);
% One-sided PSD estimate
PSD = (1/(Fs*N)) * abs(X).^2;
% Double interior bins (not DC / Nyquist)
if K > 1
PSD(2:end-1) = 2*PSD(2:end-1);
end
% Frequency vector (matches PSD length exactly)
f = (0:K)’ * (Fs/N);
end
%% Compute PSDs for original signals
[f1, PSD1] = myPSD(sig1, Fs);
[f2, PSD2] = myPSD(sig2, Fs);
%% Plot PSDs (same axes is what the lab asks)
% NOTE: If plotting linear PSD, ylabel should NOT be dB/Hz.
figure;
plot(f1, PSD1, ‘LineWidth’, 1.1); hold on;
plot(f2, PSD2, ‘LineWidth’, 1.1);
grid on;
xlim([0 200]);
xlabel("Frequency (Hz)");
ylabel("Power/Frequency (linear)");
title("PSD of Signal 1 and Signal 2");
legend("sig1","sig2");
% Optional dB version (more readable visually)
figure;
plot(f1, pow2db(PSD1), ‘LineWidth’, 1.1); hold on;
plot(f2, pow2db(PSD2), ‘LineWidth’, 1.1);
grid on;
xlim([0 200]);
xlabel("Frequency (Hz)");
ylabel("Power/Frequency (dB/Hz)");
title("PSD of Signal 1 and Signal 2 (dB)");
%% 20-100 Hz Bandpower using trapz
% [2.5] Band power computation
% [1.1] Numerical integration (trapz)
idx1 = (f1 >= 20) & (f1 <= 100);
idx2 = (f2 >= 20) & (f2 <= 100);
bandpower1 = trapz(f1(idx1), PSD1(idx1));
bandpower2 = trapz(f2(idx2), PSD2(idx2));
fprintf(‘Original bandpower (20-100 Hz): sig1 = %.6g, sig2 = %.6gn’, bandpower1, bandpower2);
%% =========================
% [1.5] Down-sampling
% Anti-aliasing before downsampling (Butterworth lowpass)
% =========================
Fs_down = 200; % new sampling rate (Nyquist = 100 Hz)
downFactor = Fs / Fs_down; % should be integer for downsample()
% Anti-alias lowpass filter (remove content above new Nyquist)
fc = 90; % use < 100 Hz for safety
order = 4;
Wn = fc / (Fs/2); % normalized cutoff
[b, a] = butter(order, Wn, ‘low’);
sig1_filt = filtfilt(b, a, sig1); % zero-phase filtering
sig2_filt = filtfilt(b, a, sig2);
% Downsample filtered signals
sig1_down = downsample(sig1_filt, downFactor);
sig2_down = downsample(sig2_filt, downFactor);
%% PSDs of anti-aliased + downsampled signals
[f1_down, PSD1_down] = myPSD(sig1_down, Fs_down);
[f2_down, PSD2_down] = myPSD(sig2_down, Fs_down);
figure;
plot(f1_down, PSD1_down, ‘LineWidth’, 1.1); hold on;
plot(f2_down, PSD2_down, ‘LineWidth’, 1.1);
grid on;
xlim([0 100]);
xlabel("Frequency (Hz)");
ylabel("Power/Frequency (linear)");
title("PSD of Downsampled Signals");
legend("sig1 down","sig2 down");
%% Bandpower (20-100 Hz) after anti-aliasing + downsampling
idx1_down = (f1_down >= 20) & (f1_down <= 100);
idx2_down = (f2_down >= 20) & (f2_down <= 100);
bandpower1_down = trapz(f1_down(idx1_down), PSD1_down(idx1_down));
bandpower2_down = trapz(f2_down(idx2_down), PSD2_down(idx2_down));
fprintf(‘Downsampled+AA bandpower (20-100 Hz): sig1 = %.6g, sig2 = %.6gn’, bandpower1_down, bandpower2_down);
%% =========================
% [1.4] Signal rectification & enveloping
% =========================
% Lab asks: rectify, then lowpass at 2 Hz to create heartbeat envelope
sig1_rect = abs(sig1_down);
sig2_rect = abs(sig2_down);
fc_env = 2; % envelope lowpass cutoff
order_env = 4;
Wn_env = fc_env / (Fs_down/2);
[b_env, a_env] = butter(order_env, Wn_env, ‘low’);
env1 = filtfilt(b_env, a_env, sig1_rect);
env2 = filtfilt(b_env, a_env, sig2_rect);
t1 = (0:length(env1)-1)’/Fs_down;
t2 = (0:length(env2)-1)’/Fs_down;
figure;
plot(t1, env1); grid on;
xlabel("Time (s)"); ylabel("Envelope amplitude");
title("Envelope of Signal 1");
figure;
plot(t2, env2); grid on;
xlabel("Time (s)"); ylabel("Envelope amplitude");
title("Envelope of Signal 2");
%% Rescale envelopes to [0,1] (helps peak detection)
env1_scaled = rescale(env1);
env2_scaled = rescale(env2);
figure;
plot(t1, env1_scaled); grid on;
xlabel("Time (s)"); ylabel("Scaled envelope");
title("Scaled Envelope of Signal 1");
figure;
plot(t2, env2_scaled); grid on;
xlabel("Time (s)"); ylabel("Scaled envelope");
title("Scaled Envelope of Signal 2");
%% =========================
% [1.2] Peak identification
% =========================
[pks1, locs1] = findpeaks(env1_scaled, ‘MinPeakProminence’, 0.1);
[pks2, locs2] = findpeaks(env2_scaled, ‘MinPeakProminence’, 0.1);
% Optional visualization of peaks
figure;
plot(t1, env1_scaled); hold on; grid on;
plot(locs1/Fs_down, pks1, ‘o’);
xlabel("Time (s)"); ylabel("Scaled envelope");
title("Signal 1 Peaks");
figure;
plot(t2, env2_scaled); hold on; grid on;
plot(locs2/Fs_down, pks2, ‘o’);
xlabel("Time (s)"); ylabel("Scaled envelope");
title("Signal 2 Peaks");
%% =========================
% [1.2] Peak timing -> Heart rate + beat-to-beat timing
% =========================
tpeaks1 = locs1 / Fs_down; % seconds
tpeaks2 = locs2 / Fs_down;
IBI1 = diff(tpeaks1); % inter-beat intervals (s)
IBI2 = diff(tpeaks2);
HR1_bpm = 60 / mean(IBI1); % average heart rate
HR2_bpm = 60 / mean(IBI2);
% Lab also asks for beat-to-beat timing variance
IBIvar1 = var(IBI1);
IBIvar2 = var(IBI2);
fprintf(‘HR sig1 = %.2f bpm, HR sig2 = %.2f bpmn’, HR1_bpm, HR2_bpm);
fprintf(‘Beat-to-beat variance: sig1 = %.6g s^2, sig2 = %.6g s^2n’, IBIvar1, IBIvar2);
%% =========================
% [1.5] Interpolation (recreate original sig1 from downsampled)
% Compare methods using RMSE
% =========================
t_down = (0:length(sig1_down)-1)’ / Fs_down;
t_orig = (0:length(sig1)-1)’ / Fs;
% Try a few methods (lab says experiment with interp1 methods)
methods = ["nearest","linear","spline","pchip","cubic"];
rmseVals = zeros(size(methods));
for k = 1:length(methods)
sig1_int = interp1(t_down, sig1_down, t_orig, methods(k))’;
rmseVals(k) = sqrt(mean((sig1 – sig1_int).^2, ‘omitnan’));
end
% Show RMSEs
disp(table(methods’, rmseVals’, ‘VariableNames’, {‘Method’,’RMSE’}));
% Pick best method (lowest RMSE)
[bestRMSE, idxBest] = min(rmseVals);
bestMethod = methods(idxBest);
% Recompute best interpolation for plotting
sig1_best = interp1(t_down, sig1_down, t_orig, bestMethod)’;
fprintf(‘Best interpolation method: %s (RMSE = %.6g)n’, bestMethod, bestRMSE);
% Plot original vs best interpolated (short window for visibility)
figure;
plot(t_orig, sig1, ‘LineWidth’, 1); hold on; grid on;
plot(t_orig, sig1_best, ‘–‘, ‘LineWidth’, 1);
xlim([0 2]); % zoom into first 2 s so differences are visible
xlabel("Time (s)"); ylabel("Amplitude");
title("Original sig1 vs Interpolated sig1");
legend("Original","Interpolated");I just need an example:
%% =========================
% [2.1] FFT calculation & plotting
% [2.5] Band power computation
% [1.1] Numerical integration (trapz)
% Custom PSD function (FFT-based periodogram)
% =========================
function [f, PSD] = myPSD(x, Fs)
x = x(:); % force column vector
x = x – mean(x); % remove DC offset
N = length(x);
X = fft(x);
K = floor(N/2); % one-sided spectrum length index
X = X(1:K+1);
% One-sided PSD estimate
PSD = (1/(Fs*N)) * abs(X).^2;
% Double interior bins (not DC / Nyquist)
if K > 1
PSD(2:end-1) = 2*PSD(2:end-1);
end
% Frequency vector (matches PSD length exactly)
f = (0:K)’ * (Fs/N);
end
%% Compute PSDs for original signals
[f1, PSD1] = myPSD(sig1, Fs);
[f2, PSD2] = myPSD(sig2, Fs);
%% Plot PSDs (same axes is what the lab asks)
% NOTE: If plotting linear PSD, ylabel should NOT be dB/Hz.
figure;
plot(f1, PSD1, ‘LineWidth’, 1.1); hold on;
plot(f2, PSD2, ‘LineWidth’, 1.1);
grid on;
xlim([0 200]);
xlabel("Frequency (Hz)");
ylabel("Power/Frequency (linear)");
title("PSD of Signal 1 and Signal 2");
legend("sig1","sig2");
% Optional dB version (more readable visually)
figure;
plot(f1, pow2db(PSD1), ‘LineWidth’, 1.1); hold on;
plot(f2, pow2db(PSD2), ‘LineWidth’, 1.1);
grid on;
xlim([0 200]);
xlabel("Frequency (Hz)");
ylabel("Power/Frequency (dB/Hz)");
title("PSD of Signal 1 and Signal 2 (dB)");
%% 20-100 Hz Bandpower using trapz
% [2.5] Band power computation
% [1.1] Numerical integration (trapz)
idx1 = (f1 >= 20) & (f1 <= 100);
idx2 = (f2 >= 20) & (f2 <= 100);
bandpower1 = trapz(f1(idx1), PSD1(idx1));
bandpower2 = trapz(f2(idx2), PSD2(idx2));
fprintf(‘Original bandpower (20-100 Hz): sig1 = %.6g, sig2 = %.6gn’, bandpower1, bandpower2);
%% =========================
% [1.5] Down-sampling
% Anti-aliasing before downsampling (Butterworth lowpass)
% =========================
Fs_down = 200; % new sampling rate (Nyquist = 100 Hz)
downFactor = Fs / Fs_down; % should be integer for downsample()
% Anti-alias lowpass filter (remove content above new Nyquist)
fc = 90; % use < 100 Hz for safety
order = 4;
Wn = fc / (Fs/2); % normalized cutoff
[b, a] = butter(order, Wn, ‘low’);
sig1_filt = filtfilt(b, a, sig1); % zero-phase filtering
sig2_filt = filtfilt(b, a, sig2);
% Downsample filtered signals
sig1_down = downsample(sig1_filt, downFactor);
sig2_down = downsample(sig2_filt, downFactor);
%% PSDs of anti-aliased + downsampled signals
[f1_down, PSD1_down] = myPSD(sig1_down, Fs_down);
[f2_down, PSD2_down] = myPSD(sig2_down, Fs_down);
figure;
plot(f1_down, PSD1_down, ‘LineWidth’, 1.1); hold on;
plot(f2_down, PSD2_down, ‘LineWidth’, 1.1);
grid on;
xlim([0 100]);
xlabel("Frequency (Hz)");
ylabel("Power/Frequency (linear)");
title("PSD of Downsampled Signals");
legend("sig1 down","sig2 down");
%% Bandpower (20-100 Hz) after anti-aliasing + downsampling
idx1_down = (f1_down >= 20) & (f1_down <= 100);
idx2_down = (f2_down >= 20) & (f2_down <= 100);
bandpower1_down = trapz(f1_down(idx1_down), PSD1_down(idx1_down));
bandpower2_down = trapz(f2_down(idx2_down), PSD2_down(idx2_down));
fprintf(‘Downsampled+AA bandpower (20-100 Hz): sig1 = %.6g, sig2 = %.6gn’, bandpower1_down, bandpower2_down);
%% =========================
% [1.4] Signal rectification & enveloping
% =========================
% Lab asks: rectify, then lowpass at 2 Hz to create heartbeat envelope
sig1_rect = abs(sig1_down);
sig2_rect = abs(sig2_down);
fc_env = 2; % envelope lowpass cutoff
order_env = 4;
Wn_env = fc_env / (Fs_down/2);
[b_env, a_env] = butter(order_env, Wn_env, ‘low’);
env1 = filtfilt(b_env, a_env, sig1_rect);
env2 = filtfilt(b_env, a_env, sig2_rect);
t1 = (0:length(env1)-1)’/Fs_down;
t2 = (0:length(env2)-1)’/Fs_down;
figure;
plot(t1, env1); grid on;
xlabel("Time (s)"); ylabel("Envelope amplitude");
title("Envelope of Signal 1");
figure;
plot(t2, env2); grid on;
xlabel("Time (s)"); ylabel("Envelope amplitude");
title("Envelope of Signal 2");
%% Rescale envelopes to [0,1] (helps peak detection)
env1_scaled = rescale(env1);
env2_scaled = rescale(env2);
figure;
plot(t1, env1_scaled); grid on;
xlabel("Time (s)"); ylabel("Scaled envelope");
title("Scaled Envelope of Signal 1");
figure;
plot(t2, env2_scaled); grid on;
xlabel("Time (s)"); ylabel("Scaled envelope");
title("Scaled Envelope of Signal 2");
%% =========================
% [1.2] Peak identification
% =========================
[pks1, locs1] = findpeaks(env1_scaled, ‘MinPeakProminence’, 0.1);
[pks2, locs2] = findpeaks(env2_scaled, ‘MinPeakProminence’, 0.1);
% Optional visualization of peaks
figure;
plot(t1, env1_scaled); hold on; grid on;
plot(locs1/Fs_down, pks1, ‘o’);
xlabel("Time (s)"); ylabel("Scaled envelope");
title("Signal 1 Peaks");
figure;
plot(t2, env2_scaled); hold on; grid on;
plot(locs2/Fs_down, pks2, ‘o’);
xlabel("Time (s)"); ylabel("Scaled envelope");
title("Signal 2 Peaks");
%% =========================
% [1.2] Peak timing -> Heart rate + beat-to-beat timing
% =========================
tpeaks1 = locs1 / Fs_down; % seconds
tpeaks2 = locs2 / Fs_down;
IBI1 = diff(tpeaks1); % inter-beat intervals (s)
IBI2 = diff(tpeaks2);
HR1_bpm = 60 / mean(IBI1); % average heart rate
HR2_bpm = 60 / mean(IBI2);
% Lab also asks for beat-to-beat timing variance
IBIvar1 = var(IBI1);
IBIvar2 = var(IBI2);
fprintf(‘HR sig1 = %.2f bpm, HR sig2 = %.2f bpmn’, HR1_bpm, HR2_bpm);
fprintf(‘Beat-to-beat variance: sig1 = %.6g s^2, sig2 = %.6g s^2n’, IBIvar1, IBIvar2);
%% =========================
% [1.5] Interpolation (recreate original sig1 from downsampled)
% Compare methods using RMSE
% =========================
t_down = (0:length(sig1_down)-1)’ / Fs_down;
t_orig = (0:length(sig1)-1)’ / Fs;
% Try a few methods (lab says experiment with interp1 methods)
methods = ["nearest","linear","spline","pchip","cubic"];
rmseVals = zeros(size(methods));
for k = 1:length(methods)
sig1_int = interp1(t_down, sig1_down, t_orig, methods(k))’;
rmseVals(k) = sqrt(mean((sig1 – sig1_int).^2, ‘omitnan’));
end
% Show RMSEs
disp(table(methods’, rmseVals’, ‘VariableNames’, {‘Method’,’RMSE’}));
% Pick best method (lowest RMSE)
[bestRMSE, idxBest] = min(rmseVals);
bestMethod = methods(idxBest);
% Recompute best interpolation for plotting
sig1_best = interp1(t_down, sig1_down, t_orig, bestMethod)’;
fprintf(‘Best interpolation method: %s (RMSE = %.6g)n’, bestMethod, bestRMSE);
% Plot original vs best interpolated (short window for visibility)
figure;
plot(t_orig, sig1, ‘LineWidth’, 1); hold on; grid on;
plot(t_orig, sig1_best, ‘–‘, ‘LineWidth’, 1);
xlim([0 2]); % zoom into first 2 s so differences are visible
xlabel("Time (s)"); ylabel("Amplitude");
title("Original sig1 vs Interpolated sig1");
legend("Original","Interpolated"); I just need an example:
%% =========================
% [2.1] FFT calculation & plotting
% [2.5] Band power computation
% [1.1] Numerical integration (trapz)
% Custom PSD function (FFT-based periodogram)
% =========================
function [f, PSD] = myPSD(x, Fs)
x = x(:); % force column vector
x = x – mean(x); % remove DC offset
N = length(x);
X = fft(x);
K = floor(N/2); % one-sided spectrum length index
X = X(1:K+1);
% One-sided PSD estimate
PSD = (1/(Fs*N)) * abs(X).^2;
% Double interior bins (not DC / Nyquist)
if K > 1
PSD(2:end-1) = 2*PSD(2:end-1);
end
% Frequency vector (matches PSD length exactly)
f = (0:K)’ * (Fs/N);
end
%% Compute PSDs for original signals
[f1, PSD1] = myPSD(sig1, Fs);
[f2, PSD2] = myPSD(sig2, Fs);
%% Plot PSDs (same axes is what the lab asks)
% NOTE: If plotting linear PSD, ylabel should NOT be dB/Hz.
figure;
plot(f1, PSD1, ‘LineWidth’, 1.1); hold on;
plot(f2, PSD2, ‘LineWidth’, 1.1);
grid on;
xlim([0 200]);
xlabel("Frequency (Hz)");
ylabel("Power/Frequency (linear)");
title("PSD of Signal 1 and Signal 2");
legend("sig1","sig2");
% Optional dB version (more readable visually)
figure;
plot(f1, pow2db(PSD1), ‘LineWidth’, 1.1); hold on;
plot(f2, pow2db(PSD2), ‘LineWidth’, 1.1);
grid on;
xlim([0 200]);
xlabel("Frequency (Hz)");
ylabel("Power/Frequency (dB/Hz)");
title("PSD of Signal 1 and Signal 2 (dB)");
%% 20-100 Hz Bandpower using trapz
% [2.5] Band power computation
% [1.1] Numerical integration (trapz)
idx1 = (f1 >= 20) & (f1 <= 100);
idx2 = (f2 >= 20) & (f2 <= 100);
bandpower1 = trapz(f1(idx1), PSD1(idx1));
bandpower2 = trapz(f2(idx2), PSD2(idx2));
fprintf(‘Original bandpower (20-100 Hz): sig1 = %.6g, sig2 = %.6gn’, bandpower1, bandpower2);
%% =========================
% [1.5] Down-sampling
% Anti-aliasing before downsampling (Butterworth lowpass)
% =========================
Fs_down = 200; % new sampling rate (Nyquist = 100 Hz)
downFactor = Fs / Fs_down; % should be integer for downsample()
% Anti-alias lowpass filter (remove content above new Nyquist)
fc = 90; % use < 100 Hz for safety
order = 4;
Wn = fc / (Fs/2); % normalized cutoff
[b, a] = butter(order, Wn, ‘low’);
sig1_filt = filtfilt(b, a, sig1); % zero-phase filtering
sig2_filt = filtfilt(b, a, sig2);
% Downsample filtered signals
sig1_down = downsample(sig1_filt, downFactor);
sig2_down = downsample(sig2_filt, downFactor);
%% PSDs of anti-aliased + downsampled signals
[f1_down, PSD1_down] = myPSD(sig1_down, Fs_down);
[f2_down, PSD2_down] = myPSD(sig2_down, Fs_down);
figure;
plot(f1_down, PSD1_down, ‘LineWidth’, 1.1); hold on;
plot(f2_down, PSD2_down, ‘LineWidth’, 1.1);
grid on;
xlim([0 100]);
xlabel("Frequency (Hz)");
ylabel("Power/Frequency (linear)");
title("PSD of Downsampled Signals");
legend("sig1 down","sig2 down");
%% Bandpower (20-100 Hz) after anti-aliasing + downsampling
idx1_down = (f1_down >= 20) & (f1_down <= 100);
idx2_down = (f2_down >= 20) & (f2_down <= 100);
bandpower1_down = trapz(f1_down(idx1_down), PSD1_down(idx1_down));
bandpower2_down = trapz(f2_down(idx2_down), PSD2_down(idx2_down));
fprintf(‘Downsampled+AA bandpower (20-100 Hz): sig1 = %.6g, sig2 = %.6gn’, bandpower1_down, bandpower2_down);
%% =========================
% [1.4] Signal rectification & enveloping
% =========================
% Lab asks: rectify, then lowpass at 2 Hz to create heartbeat envelope
sig1_rect = abs(sig1_down);
sig2_rect = abs(sig2_down);
fc_env = 2; % envelope lowpass cutoff
order_env = 4;
Wn_env = fc_env / (Fs_down/2);
[b_env, a_env] = butter(order_env, Wn_env, ‘low’);
env1 = filtfilt(b_env, a_env, sig1_rect);
env2 = filtfilt(b_env, a_env, sig2_rect);
t1 = (0:length(env1)-1)’/Fs_down;
t2 = (0:length(env2)-1)’/Fs_down;
figure;
plot(t1, env1); grid on;
xlabel("Time (s)"); ylabel("Envelope amplitude");
title("Envelope of Signal 1");
figure;
plot(t2, env2); grid on;
xlabel("Time (s)"); ylabel("Envelope amplitude");
title("Envelope of Signal 2");
%% Rescale envelopes to [0,1] (helps peak detection)
env1_scaled = rescale(env1);
env2_scaled = rescale(env2);
figure;
plot(t1, env1_scaled); grid on;
xlabel("Time (s)"); ylabel("Scaled envelope");
title("Scaled Envelope of Signal 1");
figure;
plot(t2, env2_scaled); grid on;
xlabel("Time (s)"); ylabel("Scaled envelope");
title("Scaled Envelope of Signal 2");
%% =========================
% [1.2] Peak identification
% =========================
[pks1, locs1] = findpeaks(env1_scaled, ‘MinPeakProminence’, 0.1);
[pks2, locs2] = findpeaks(env2_scaled, ‘MinPeakProminence’, 0.1);
% Optional visualization of peaks
figure;
plot(t1, env1_scaled); hold on; grid on;
plot(locs1/Fs_down, pks1, ‘o’);
xlabel("Time (s)"); ylabel("Scaled envelope");
title("Signal 1 Peaks");
figure;
plot(t2, env2_scaled); hold on; grid on;
plot(locs2/Fs_down, pks2, ‘o’);
xlabel("Time (s)"); ylabel("Scaled envelope");
title("Signal 2 Peaks");
%% =========================
% [1.2] Peak timing -> Heart rate + beat-to-beat timing
% =========================
tpeaks1 = locs1 / Fs_down; % seconds
tpeaks2 = locs2 / Fs_down;
IBI1 = diff(tpeaks1); % inter-beat intervals (s)
IBI2 = diff(tpeaks2);
HR1_bpm = 60 / mean(IBI1); % average heart rate
HR2_bpm = 60 / mean(IBI2);
% Lab also asks for beat-to-beat timing variance
IBIvar1 = var(IBI1);
IBIvar2 = var(IBI2);
fprintf(‘HR sig1 = %.2f bpm, HR sig2 = %.2f bpmn’, HR1_bpm, HR2_bpm);
fprintf(‘Beat-to-beat variance: sig1 = %.6g s^2, sig2 = %.6g s^2n’, IBIvar1, IBIvar2);
%% =========================
% [1.5] Interpolation (recreate original sig1 from downsampled)
% Compare methods using RMSE
% =========================
t_down = (0:length(sig1_down)-1)’ / Fs_down;
t_orig = (0:length(sig1)-1)’ / Fs;
% Try a few methods (lab says experiment with interp1 methods)
methods = ["nearest","linear","spline","pchip","cubic"];
rmseVals = zeros(size(methods));
for k = 1:length(methods)
sig1_int = interp1(t_down, sig1_down, t_orig, methods(k))’;
rmseVals(k) = sqrt(mean((sig1 – sig1_int).^2, ‘omitnan’));
end
% Show RMSEs
disp(table(methods’, rmseVals’, ‘VariableNames’, {‘Method’,’RMSE’}));
% Pick best method (lowest RMSE)
[bestRMSE, idxBest] = min(rmseVals);
bestMethod = methods(idxBest);
% Recompute best interpolation for plotting
sig1_best = interp1(t_down, sig1_down, t_orig, bestMethod)’;
fprintf(‘Best interpolation method: %s (RMSE = %.6g)n’, bestMethod, bestRMSE);
% Plot original vs best interpolated (short window for visibility)
figure;
plot(t_orig, sig1, ‘LineWidth’, 1); hold on; grid on;
plot(t_orig, sig1_best, ‘–‘, ‘LineWidth’, 1);
xlim([0 2]); % zoom into first 2 s so differences are visible
xlabel("Time (s)"); ylabel("Amplitude");
title("Original sig1 vs Interpolated sig1");
legend("Original","Interpolated"); signal processing MATLAB Answers — New Questions
Why do I receive error, “You do not have access to create LMS integrations for your account” when accessing MATLAB Grader?
I am trying to create an integration for my school. When I access MATLAB Grader, I come across a message saying "You do not have access to create LMS integrations for your account" How can I get access to create integrations?I am trying to create an integration for my school. When I access MATLAB Grader, I come across a message saying "You do not have access to create LMS integrations for your account" How can I get access to create integrations? I am trying to create an integration for my school. When I access MATLAB Grader, I come across a message saying "You do not have access to create LMS integrations for your account" How can I get access to create integrations? MATLAB Answers — New Questions
long time duration simulink simualtion stopped with error
An error occurred during simulation and the simulation was stopped
Caused by:
Output sample times of /Integer N PLL with Single Modulus Prescaler/Single Modulus Prescaler/Logic Decision1 occur out of sequence. Specify the ‘Minimum delay value’ parameter as a value greater than 1e-15 times the simulation stop time.
Component:Simulink | Category:Block errorAn error occurred during simulation and the simulation was stopped
Caused by:
Output sample times of /Integer N PLL with Single Modulus Prescaler/Single Modulus Prescaler/Logic Decision1 occur out of sequence. Specify the ‘Minimum delay value’ parameter as a value greater than 1e-15 times the simulation stop time.
Component:Simulink | Category:Block error An error occurred during simulation and the simulation was stopped
Caused by:
Output sample times of /Integer N PLL with Single Modulus Prescaler/Single Modulus Prescaler/Logic Decision1 occur out of sequence. Specify the ‘Minimum delay value’ parameter as a value greater than 1e-15 times the simulation stop time.
Component:Simulink | Category:Block error simulink, long time simulation, minimum delay value MATLAB Answers — New Questions
Microsoft Extends DLP Policy for Copilot Protection to All Storage Locations
Extending the Reach for the DLP Policy for Copilot
With all the fuss and bother about the bug that allowed Microsoft 365 Copilot Chat (BizChat) to expose content blocked by the DLP policy for Copilot in chat responses, you’d be forgiven for thinking that Copilot leaks confidential information all the time. Of course, Copilot doesn’t. Bugs happen all the time in software and although Microsoft was slow to acknowledge the bug initially, they did fix it promptly thereafter. I guess all those who spouted rubbish in forums such as LinkedIn were simply seeking notoriety, or something like that. It would be better if they engaged their brains before commenting.
Which brings me neatly to message center notification MC1234661 (19 February 2026, Microsoft 365 Roadmap 557255), which announces that Microsoft is extending the reach of the DLP policy for Copilot to all storage locations where Office files are kept. Previously, protection was only available to Office files stored inside Microsoft 365. Now, local and other cloud storage providers are covered. I think this is a pretty big deal.
Rollout will start in late March 2026, and Microsoft expects that the update will be deployed worldwide by late April 2026.
The Magic of the Augmentation Loop
Although Microsoft has control over Microsoft 365 locations, it obviously cannot control local storage. The magic that allows the DLP policy for Copilot to extend its reach comes from a component called the Office Augmentation Loop, often shortened to “AugLoop.”
The Augmentation Loop is an internal Office component that collects signals from Microsoft 365 applications and enforces policy when organizations use connected experiences. Not everything can be processed locally (DLP is a good example), which is when connected experience come into play to link local applications with cloud services.
The problem about discussing anything to do with the augmentation loop is the lack of documentation. The augmentation loop is an internal component that’s not designed to be exposed to users. Based on discussions with Microsoft engineers, my understanding is that the augmentation loop is responsible for gathering information to help components like Copilot make good decisions.
My understanding aligns with the description in MC1234661, where Microsoft explains that the augmentation loop now reads details about sensitivity labels assigned to files through the Office clients. Office clients already know how to report sensitivity labels (for example, to surface the name of the currently applied label in different places within the Office UI.
The older method used Microsoft Graph lookups to retrieve sensitivity label information based on the URL of the file (like the URL assigned to files in a SharePoint Online or OneDrive for Business site). This approach makes perfect sense when dealing with files stored in Microsoft 365 but left a gap for Office files held elsewhere.
No Change Necessary for Existing DLP Policies
The new implementation allows the augmentation loop to gather the information necessary for the DLP policy for Copilot to evaluate whether to block or allow access to content protected by a sensitivity label, even if the file is on a network or local drive. Remember, sensitivity labels travel with files to ensure that only users with adequate rights can open and use the files. Figure 1 shows the flow of processing for the DLP policy for Copilot.

The nice thing is that no changes need to be made to existing DLP policies. Protection is extended automatically to non-Microsoft 365 storage locations after the code update reaches Microsoft 365 tenants.
Consistency is Everything
Sensitivity labels ensure consistency of protection no matter where labelled files are stored. The same consistency of protection is now available through the DLP policy for Copilot. It’s a change that makes perfect sense.
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. No AI is used to generate our output!
Matlab using parallels on M1 macbook pro
Hello,
For the purpose of research, I need to use a image analysis program designed for windows, that requires matlab, which is run using parallels on macs with intel-processors. I’m currently looking at purchasing a new macbook pro m1 for work. Collegues have warned me that it’s only possible to run the insider preview ARM-based windows 11, not x86, using parallels on macbook M1, which is, if I understand this correctly, not compatible with matlab, and therefore I cannot run the programs needed for work. Do anyone know any solution to this problem? I would be most thankful.Hello,
For the purpose of research, I need to use a image analysis program designed for windows, that requires matlab, which is run using parallels on macs with intel-processors. I’m currently looking at purchasing a new macbook pro m1 for work. Collegues have warned me that it’s only possible to run the insider preview ARM-based windows 11, not x86, using parallels on macbook M1, which is, if I understand this correctly, not compatible with matlab, and therefore I cannot run the programs needed for work. Do anyone know any solution to this problem? I would be most thankful. Hello,
For the purpose of research, I need to use a image analysis program designed for windows, that requires matlab, which is run using parallels on macs with intel-processors. I’m currently looking at purchasing a new macbook pro m1 for work. Collegues have warned me that it’s only possible to run the insider preview ARM-based windows 11, not x86, using parallels on macbook M1, which is, if I understand this correctly, not compatible with matlab, and therefore I cannot run the programs needed for work. Do anyone know any solution to this problem? I would be most thankful. mac, m1, parallels MATLAB Answers — New Questions
scanf/printf not working when calling generated C code
In Matlab I have generated C code (.c/.h files) from a Matlab function using codegen from Matlab Coder.
I call this function in a while loop on an ARM quad-core Cortex A53 using AMD Vitis.
Before calling this function I use scanf/printf to get user input and to print to the serial monitor. However, scanf/printf only work once in the 1st iteration (before calling the function) and not in the 2nd iteration or later (after calling the function).
Is this a common problem and has anyone encountered this problem before?
I think, but am not sure, that the problem is in the generated C code and not in Vitis itself.
Thank you in advance!In Matlab I have generated C code (.c/.h files) from a Matlab function using codegen from Matlab Coder.
I call this function in a while loop on an ARM quad-core Cortex A53 using AMD Vitis.
Before calling this function I use scanf/printf to get user input and to print to the serial monitor. However, scanf/printf only work once in the 1st iteration (before calling the function) and not in the 2nd iteration or later (after calling the function).
Is this a common problem and has anyone encountered this problem before?
I think, but am not sure, that the problem is in the generated C code and not in Vitis itself.
Thank you in advance! In Matlab I have generated C code (.c/.h files) from a Matlab function using codegen from Matlab Coder.
I call this function in a while loop on an ARM quad-core Cortex A53 using AMD Vitis.
Before calling this function I use scanf/printf to get user input and to print to the serial monitor. However, scanf/printf only work once in the 1st iteration (before calling the function) and not in the 2nd iteration or later (after calling the function).
Is this a common problem and has anyone encountered this problem before?
I think, but am not sure, that the problem is in the generated C code and not in Vitis itself.
Thank you in advance! matlab coder, code generation MATLAB Answers — New Questions
Unexpected behavior of -nouserjavapath in MATLAB R2025b compared to R2022b
Hello everyone,
I recently upgraded from MATLAB R2022b to MATLAB R2025b and noticed a change in how MATLAB handles the -nouserjavapath startup option.
I have a javaclasspath.txt file in my MATLAB prefdir, where I define several custom JAR file locations. Normally, when MATLAB starts, these JARs are correctly loaded into the static Java class path (visible via javaclasspath(‘-static’)).
In some situations, however, I want to start MATLAB without loading my custom JARs. In R2022b, starting MATLAB with:
matlab -nouserjavapath
correctly ignored the javaclasspath.txt, and my custom JARs did not appear in the static Java class path.
But in R2025b, this no longer works. Even when starting with -nouserjavapath, MATLAB still loads the JARs defined in javaclasspath.txt.
Has something changed in MATLAB R2025b regarding how the -nouserjavapath option is handled?
Is this expected behavior, a known change, or possibly a bug?
Thank you!Hello everyone,
I recently upgraded from MATLAB R2022b to MATLAB R2025b and noticed a change in how MATLAB handles the -nouserjavapath startup option.
I have a javaclasspath.txt file in my MATLAB prefdir, where I define several custom JAR file locations. Normally, when MATLAB starts, these JARs are correctly loaded into the static Java class path (visible via javaclasspath(‘-static’)).
In some situations, however, I want to start MATLAB without loading my custom JARs. In R2022b, starting MATLAB with:
matlab -nouserjavapath
correctly ignored the javaclasspath.txt, and my custom JARs did not appear in the static Java class path.
But in R2025b, this no longer works. Even when starting with -nouserjavapath, MATLAB still loads the JARs defined in javaclasspath.txt.
Has something changed in MATLAB R2025b regarding how the -nouserjavapath option is handled?
Is this expected behavior, a known change, or possibly a bug?
Thank you! Hello everyone,
I recently upgraded from MATLAB R2022b to MATLAB R2025b and noticed a change in how MATLAB handles the -nouserjavapath startup option.
I have a javaclasspath.txt file in my MATLAB prefdir, where I define several custom JAR file locations. Normally, when MATLAB starts, these JARs are correctly loaded into the static Java class path (visible via javaclasspath(‘-static’)).
In some situations, however, I want to start MATLAB without loading my custom JARs. In R2022b, starting MATLAB with:
matlab -nouserjavapath
correctly ignored the javaclasspath.txt, and my custom JARs did not appear in the static Java class path.
But in R2025b, this no longer works. Even when starting with -nouserjavapath, MATLAB still loads the JARs defined in javaclasspath.txt.
Has something changed in MATLAB R2025b regarding how the -nouserjavapath option is handled?
Is this expected behavior, a known change, or possibly a bug?
Thank you! matlab 2025b, matlab 2022b, startup option, -nouserjavapath MATLAB Answers — New Questions
fprintf not printing to command window when asking for input.
Hello. I am working on a Jukebox to play a song that corrisponds with set number (this part is not the issue I am just trying to provide some context).
When the code is run I would like the Opening menu to appear in the command window so the user can see the song choices before being prompted to enter an input. The problem is that when I run the code it does not print any of my text and just waits for an input. I think it has something to do with the fact that other than declaring some variables, there is nothing happening before the first fprintf. I am not getting any error or warning messages on my end.
Is this a quirk of using the online version? I am using the online verison of MATlab because I am having techinal issues with installing the desktop version.
(This is not all of my code, I chose to only share what is relevent to my issue)
clear
clc
close all
%% Declarations
rate = 32768; % sampling rate
songs = 1:9;
octave = 0;
speed = 0;
% Opening menu. Give list of options
fprintf([‘Welcome to Jukebox.n——– SONG MENU ——–n 1 |’…
‘ Bohemian Rhapsody n 2 | ‘ …
‘Dies Irae n 3 | Entry Into Valhalla n 4 | Fur Elise n 5 | ‘ …
‘Game of Thrones Theme n 6 | He”s a Pirate n 7 | Megalovania ‘ …
‘Long n 8 | Paint it Black n’])
% Prompt user for selection, and check validity of choice
songNum = input([‘Enter the number of the song you wish to play –> n’]);
while songNum < 0 || songNum > 9 || mod(songNum,1) ~= 0
songNum = input(‘Try again –> ‘);
endHello. I am working on a Jukebox to play a song that corrisponds with set number (this part is not the issue I am just trying to provide some context).
When the code is run I would like the Opening menu to appear in the command window so the user can see the song choices before being prompted to enter an input. The problem is that when I run the code it does not print any of my text and just waits for an input. I think it has something to do with the fact that other than declaring some variables, there is nothing happening before the first fprintf. I am not getting any error or warning messages on my end.
Is this a quirk of using the online version? I am using the online verison of MATlab because I am having techinal issues with installing the desktop version.
(This is not all of my code, I chose to only share what is relevent to my issue)
clear
clc
close all
%% Declarations
rate = 32768; % sampling rate
songs = 1:9;
octave = 0;
speed = 0;
% Opening menu. Give list of options
fprintf([‘Welcome to Jukebox.n——– SONG MENU ——–n 1 |’…
‘ Bohemian Rhapsody n 2 | ‘ …
‘Dies Irae n 3 | Entry Into Valhalla n 4 | Fur Elise n 5 | ‘ …
‘Game of Thrones Theme n 6 | He”s a Pirate n 7 | Megalovania ‘ …
‘Long n 8 | Paint it Black n’])
% Prompt user for selection, and check validity of choice
songNum = input([‘Enter the number of the song you wish to play –> n’]);
while songNum < 0 || songNum > 9 || mod(songNum,1) ~= 0
songNum = input(‘Try again –> ‘);
end Hello. I am working on a Jukebox to play a song that corrisponds with set number (this part is not the issue I am just trying to provide some context).
When the code is run I would like the Opening menu to appear in the command window so the user can see the song choices before being prompted to enter an input. The problem is that when I run the code it does not print any of my text and just waits for an input. I think it has something to do with the fact that other than declaring some variables, there is nothing happening before the first fprintf. I am not getting any error or warning messages on my end.
Is this a quirk of using the online version? I am using the online verison of MATlab because I am having techinal issues with installing the desktop version.
(This is not all of my code, I chose to only share what is relevent to my issue)
clear
clc
close all
%% Declarations
rate = 32768; % sampling rate
songs = 1:9;
octave = 0;
speed = 0;
% Opening menu. Give list of options
fprintf([‘Welcome to Jukebox.n——– SONG MENU ——–n 1 |’…
‘ Bohemian Rhapsody n 2 | ‘ …
‘Dies Irae n 3 | Entry Into Valhalla n 4 | Fur Elise n 5 | ‘ …
‘Game of Thrones Theme n 6 | He”s a Pirate n 7 | Megalovania ‘ …
‘Long n 8 | Paint it Black n’])
% Prompt user for selection, and check validity of choice
songNum = input([‘Enter the number of the song you wish to play –> n’]);
while songNum < 0 || songNum > 9 || mod(songNum,1) ~= 0
songNum = input(‘Try again –> ‘);
end fprintf, input, matlab MATLAB Answers — New Questions
Update #21 for Automating Microsoft 365 with PowerShell
March 2026 Release for Automating Microsoft 365 with PowerShell eBook
The Automating Microsoft 365 with PowerShell eBook is part of the Office 365 for IT Pros eBook bundle and is also sold separately, including a paperback version. Like the rest of the Office 365 for IT Pros eBook, each month we update Automating Microsoft 365 with PowerShell to add new content, improve existing content, or prune material that is no longer current. We release the update before the start of the month to allow us time to concentrate on the “big book,” and that’s why update #21 for Automating Microsoft 365 with PowerShell is now available for subscribers to download.
Subscribers can fetch the updated EPUB and PDF files from their Gumroad.com account using the link in the receipt emailed for their subscription. We plan to release the March 2026 update for Office 365 for IT Pros on March 1, 2026.
The current version number is 21.2 dated 20 February 2026. The PDF is 390 pages long, or 150,116 words. Because of Amazon KDP formatting rules and because it includes an index, the current paperback version (Figure 1) is 415 pages long. We’ve added 30 pages of content and practical ready-to-use examples to the book since I last got a printed copy in October 2025.

Microsoft Graph PowerShell SDK V2.35.1
On February 5, Microsoft released V2.35.1 of the Microsoft Graph PowerShell SDK. As you might recall, Microsoft rushed out V2.34 just before Christmas 2025 to fix a security issue. As a consequence of the fix, WAM (Web Account Manager) became the default for interactive sessions on Windows PCs. The change wasn’t a problem for anyone who signs into Graph SDK interactive sessions with the same account as they use to sign into Windows, but as we all know, the world isn’t perfect and many different ways to sign into Windows environments exist, including hybrid setups where accounts are hosted by on-premises Active Directory.
Microsoft released V2.34 to address some reported issues with hybrid connections, followed soon after by V2.35.1. So far, my tests show that the release is at least as stable as V2.34. In other words, I haven’t run into anything odd that caused me to log an issue in the Microsoft Graph PowerShell SDK GitHub repository. (unkind people would say that I’m waiting for Microsoft to fix the issues already logged, but that’s not the case). Some folks report that V2.35.1 is incompatible with password managers (I haven’t had an issue using Bitwarden). If you run into a problem, please report it by logging an issue in GitHub.
Keep Current with Other Important Microsoft 365 Modules
The updates for the Microsoft Graph PowerShell SDK prompt me to note the latest versions of important Microsoft 365 PowerShell modules include:
- Microsoft Entra (based on the Microsoft Graph PowerShell SDK): 1.2
- Microsoft Teams: 7.6
- Exchange Online management: 3.9.2. Microsoft is busy removing old bits from this module, so make sure that these changes don’t impact production scripts. The latest change is the deprecation of the Credential parameter for the Connect-ExchangeOnline cmdlet.
- SharePoint Online management: 16.0.26914.12004
Remember to update these and other modules used in scripts to stay current. For example, I use the ImportExcel module to generate Excel worksheets instead of CSV files for reports. The current version for ImportExcel is 7.8.10. It’s also important to keep the modules used by Azure Automation runbooks current.
On to Update #22
Once the March update for Office 365 for IT Pros is squared away, we’ll start thinking about the next update for Automating Microsoft 365 with PowerShell. One thing’s for sure: we’ll always have something to write about.
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.
The fourier series coefficient phase
I am trying to get the x[n] from fourier coefficients, then I used the fft to find the coefficients of my x[n] and compare it with the prompt. So Here is the code
N = 8; % the period
figure;
k = -4:3; % the index for fourier transform
a_k = [0,0,1,1,1,1,1,0]; % fourier series
subplot(2,2,1);
stem(k,abs(a_k)); % plot the magnitude of the fourier coefficient
xlabel(‘k’); ylabel(‘|a_k|’); title(‘Magnitude of the Fourier Series Coefficient Directly From Prompt’); %xlabel tilte and ylabel
subplot(2,2,3);
stem(k,angle(a_k)); % plot the phase of the fourier coefficient
xlabel(‘k’); ylabel(‘phase of a_k’); title(‘Phase of the Fourier Series Coefficient Directly Prompt’);%xlabel title and ylabel
x = zeros(1,N);
n = -4:3; % the n matrix
w = 2*pi/N; % omega
A = [1,2,2,0,0,0,0,0]; % the cos wave amplitude
phi = [0,0,0,0,0,0,0,0]; % the phase
for i = 1:N
x = x+A(i)*cos((i-1)*w*n+phi(i));
end
ak_re = fft(fftshift(x)); % the coefficients
ak_shifted = fftshift(ak_re); % shifted version
subplot(2,2,2);
stem(k,abs(ak_shifted)/N);% stem plot
xlabel(‘k’); ylabel(‘|a_k|’); title(‘Magnitude of the Fourier Series Coefficient by FFT’); %xlabel tilte and ylabel
subplot(2,2,4);
stem(k,angle(ak_shifted));% stem plot
xlabel(‘k’); ylabel(‘phase of a_k’); title(‘Phase of the Fourier Series Coefficient by FFT’);%xlabel title and ylabel
x_re = N*fftshift(ifft(ifftshift(a_k))); % Rebuilt x[n]
figure;
subplot(1,2,1);
stem(n,x_re); % plot the original graph
xlabel(‘n’); ylabel(‘x[n]’); title(‘Plot of x[n] Rebuilt from Coefficients’); %xlabel tilte and ylabel
subplot(1,2,2);
stem(n,x); % stem plot
xlabel(‘n’); % xlabel of the x[n]
ylabel(‘x[n]’); % ylabel
title(‘Plot of x[n] Directly from Expression’); % title
I find out that x[n] plots are same, but a_k plots are a little bit off on phase plots. Apparently the Phase of the Fourier Series Coefficient by FFT is not equal to the original phase of the coefficients by prompt. They are like half periods off. So I tried to use fftshift, but it did not help. So please let me know what is wrong here.I am trying to get the x[n] from fourier coefficients, then I used the fft to find the coefficients of my x[n] and compare it with the prompt. So Here is the code
N = 8; % the period
figure;
k = -4:3; % the index for fourier transform
a_k = [0,0,1,1,1,1,1,0]; % fourier series
subplot(2,2,1);
stem(k,abs(a_k)); % plot the magnitude of the fourier coefficient
xlabel(‘k’); ylabel(‘|a_k|’); title(‘Magnitude of the Fourier Series Coefficient Directly From Prompt’); %xlabel tilte and ylabel
subplot(2,2,3);
stem(k,angle(a_k)); % plot the phase of the fourier coefficient
xlabel(‘k’); ylabel(‘phase of a_k’); title(‘Phase of the Fourier Series Coefficient Directly Prompt’);%xlabel title and ylabel
x = zeros(1,N);
n = -4:3; % the n matrix
w = 2*pi/N; % omega
A = [1,2,2,0,0,0,0,0]; % the cos wave amplitude
phi = [0,0,0,0,0,0,0,0]; % the phase
for i = 1:N
x = x+A(i)*cos((i-1)*w*n+phi(i));
end
ak_re = fft(fftshift(x)); % the coefficients
ak_shifted = fftshift(ak_re); % shifted version
subplot(2,2,2);
stem(k,abs(ak_shifted)/N);% stem plot
xlabel(‘k’); ylabel(‘|a_k|’); title(‘Magnitude of the Fourier Series Coefficient by FFT’); %xlabel tilte and ylabel
subplot(2,2,4);
stem(k,angle(ak_shifted));% stem plot
xlabel(‘k’); ylabel(‘phase of a_k’); title(‘Phase of the Fourier Series Coefficient by FFT’);%xlabel title and ylabel
x_re = N*fftshift(ifft(ifftshift(a_k))); % Rebuilt x[n]
figure;
subplot(1,2,1);
stem(n,x_re); % plot the original graph
xlabel(‘n’); ylabel(‘x[n]’); title(‘Plot of x[n] Rebuilt from Coefficients’); %xlabel tilte and ylabel
subplot(1,2,2);
stem(n,x); % stem plot
xlabel(‘n’); % xlabel of the x[n]
ylabel(‘x[n]’); % ylabel
title(‘Plot of x[n] Directly from Expression’); % title
I find out that x[n] plots are same, but a_k plots are a little bit off on phase plots. Apparently the Phase of the Fourier Series Coefficient by FFT is not equal to the original phase of the coefficients by prompt. They are like half periods off. So I tried to use fftshift, but it did not help. So please let me know what is wrong here. I am trying to get the x[n] from fourier coefficients, then I used the fft to find the coefficients of my x[n] and compare it with the prompt. So Here is the code
N = 8; % the period
figure;
k = -4:3; % the index for fourier transform
a_k = [0,0,1,1,1,1,1,0]; % fourier series
subplot(2,2,1);
stem(k,abs(a_k)); % plot the magnitude of the fourier coefficient
xlabel(‘k’); ylabel(‘|a_k|’); title(‘Magnitude of the Fourier Series Coefficient Directly From Prompt’); %xlabel tilte and ylabel
subplot(2,2,3);
stem(k,angle(a_k)); % plot the phase of the fourier coefficient
xlabel(‘k’); ylabel(‘phase of a_k’); title(‘Phase of the Fourier Series Coefficient Directly Prompt’);%xlabel title and ylabel
x = zeros(1,N);
n = -4:3; % the n matrix
w = 2*pi/N; % omega
A = [1,2,2,0,0,0,0,0]; % the cos wave amplitude
phi = [0,0,0,0,0,0,0,0]; % the phase
for i = 1:N
x = x+A(i)*cos((i-1)*w*n+phi(i));
end
ak_re = fft(fftshift(x)); % the coefficients
ak_shifted = fftshift(ak_re); % shifted version
subplot(2,2,2);
stem(k,abs(ak_shifted)/N);% stem plot
xlabel(‘k’); ylabel(‘|a_k|’); title(‘Magnitude of the Fourier Series Coefficient by FFT’); %xlabel tilte and ylabel
subplot(2,2,4);
stem(k,angle(ak_shifted));% stem plot
xlabel(‘k’); ylabel(‘phase of a_k’); title(‘Phase of the Fourier Series Coefficient by FFT’);%xlabel title and ylabel
x_re = N*fftshift(ifft(ifftshift(a_k))); % Rebuilt x[n]
figure;
subplot(1,2,1);
stem(n,x_re); % plot the original graph
xlabel(‘n’); ylabel(‘x[n]’); title(‘Plot of x[n] Rebuilt from Coefficients’); %xlabel tilte and ylabel
subplot(1,2,2);
stem(n,x); % stem plot
xlabel(‘n’); % xlabel of the x[n]
ylabel(‘x[n]’); % ylabel
title(‘Plot of x[n] Directly from Expression’); % title
I find out that x[n] plots are same, but a_k plots are a little bit off on phase plots. Apparently the Phase of the Fourier Series Coefficient by FFT is not equal to the original phase of the coefficients by prompt. They are like half periods off. So I tried to use fftshift, but it did not help. So please let me know what is wrong here. matlab, fft, ifft, fftshift MATLAB Answers — New Questions
How to load data from Octave?
I have a .M file from Octave that I want to run in MATLAB, but I obtain an error. Here is the content of .M file (it’s just one line):
load "Slovenia_centered.mat"
And here is the error:
Error using load
Unable to read file ‘"Slovenia_centered.mat"’: Invalid argument.
Error in
Slovenia_centered (line 1)
load "Slovenia_centered.mat"
^^^^I have a .M file from Octave that I want to run in MATLAB, but I obtain an error. Here is the content of .M file (it’s just one line):
load "Slovenia_centered.mat"
And here is the error:
Error using load
Unable to read file ‘"Slovenia_centered.mat"’: Invalid argument.
Error in
Slovenia_centered (line 1)
load "Slovenia_centered.mat"
^^^^ I have a .M file from Octave that I want to run in MATLAB, but I obtain an error. Here is the content of .M file (it’s just one line):
load "Slovenia_centered.mat"
And here is the error:
Error using load
Unable to read file ‘"Slovenia_centered.mat"’: Invalid argument.
Error in
Slovenia_centered (line 1)
load "Slovenia_centered.mat"
^^^^ load MATLAB Answers — New Questions









