Category: News
Legend in multiple plots: example bubblecharts or combined plot bubblechart and scatter
Hi, I am trying to display to variables on a map and add a legend for both of the variables. Since I the problems is the legend I removed the map behind the plot to just focus on the variables.
I splitted the two variables first in two seperate plots to show how the legend should look like for each variable. Than I combine it in two ways and discuss the legend problems that I have face.
% create random data
xCoordinate = randi([3.1976e+05 8.2960e+05],21, 1); %Location on a map xCoordinate
yCoordinate = randi([6.1639e+06 7.2924e+06],21, 1); %Location on a map yCoordinate
markerSizesV = randi([0 5],21, 1);
markerSizesC = randi([1 379],21, 1);
%% create bubblechart Cats per km^2 of region with legend
bC = bubblechart(xCoordinate,yCoordinate,markerSizesC, [1, 1, 1]); %FaceColor white
bC.MarkerEdgeColor = [0,0,0]; %EdgeColor black
bubblesize([4 15]) % limit the bubblesize
axis equal % ensures 1 unit in x equals 1 unit in y
axis off % romoves the axis
blgdC1 = bubblelegend({‘Cats’;’per km^2′},’Location’,’eastoutside’); % plots the legend
The legend for Cats per km^2 should look like in the plot above. (Ignor the that some of the bubbles are getting cut off this doesn’t happens when the map is ploted as well.)
%% create bubblechart Cat visits per region with legend
bV = bubblechart(xCoordinate,yCoordinate,markerSizesV, [0.9290, 0.6940, 0.1250]);
bubblesize([4 15])
axis equal % ensures 1 unit in x equals 1 unit in y
axis off
blgdV1 = bubblelegend({‘Cat Visits’;’per region’});
The legend for Cat visits per region should look like in the plot above. (Ignor the that some of the bubbles are getting cut off this doesn’t happens when the map is ploted as well.)
%% combined bubblechart Cats per km^2 and Cat visits per region
bC = bubblechart(xCoordinate,yCoordinate,markerSizesC, [1, 1, 1]);
hold on
bC.MarkerEdgeColor = [0,0,0];
bubblesize([4 15])
axis equal % ensures 1 unit in x equals 1 unit in y
axis off
bV = bubblechart(xCoordinate,yCoordinate,markerSizesV, [0.9290, 0.6940, 0.1250]);
bubblesize([4 15])
blgdC2 = bubblelegend({‘Cats’;’per km^2′},’Location’,’eastoutside’); %
blgdV2 = bubblelegend({‘Cat Visits’;’per region’},’Location’,’westoutside’);
legend(‘Cats per km^2’, ‘Cat Visits per Region’) %test what legend does
hold off
As soon as I combine two bubblecharts MATLAB combines valus in ratio to each other and combines it also into the same population legend. This is fine if I would have two variables with the same unit / content but different regions.
Therefore I tryed a version with
%% combine bubblechart Cat visits per region with scatter Cats per km^2
s = scatter(xCoordinate,yCoordinate,markerSizesC/2, MarkerFaceColor = "white", MarkerEdgeColor = "#36454F");
hold on
bV = bubblechart(xCoordinate,yCoordinate,markerSizesV, [0.9290, 0.6940, 0.1250]);
bubblesize([4 15])
axis equal % ensures 1 unit in x equals 1 unit in y
axis off
blgdV = bubblelegend({‘Cat Visits’;’per region’},’Location’,’westoutside’);
legend(‘Cats per km^2’, ‘Cat Visits per Region’)
hold off
This solves at least the problem that MATLAB considers these two variables should be in relation to each other. Plus the legend for "Cat visits per region" is correct and with the right color and right size.
However I don’t get a legend like this next to my plot as in the bubblechart combinded with scatter.
Is their anyone knowing how to solve this issue with legends?
Thanks for any input in this matter.Hi, I am trying to display to variables on a map and add a legend for both of the variables. Since I the problems is the legend I removed the map behind the plot to just focus on the variables.
I splitted the two variables first in two seperate plots to show how the legend should look like for each variable. Than I combine it in two ways and discuss the legend problems that I have face.
% create random data
xCoordinate = randi([3.1976e+05 8.2960e+05],21, 1); %Location on a map xCoordinate
yCoordinate = randi([6.1639e+06 7.2924e+06],21, 1); %Location on a map yCoordinate
markerSizesV = randi([0 5],21, 1);
markerSizesC = randi([1 379],21, 1);
%% create bubblechart Cats per km^2 of region with legend
bC = bubblechart(xCoordinate,yCoordinate,markerSizesC, [1, 1, 1]); %FaceColor white
bC.MarkerEdgeColor = [0,0,0]; %EdgeColor black
bubblesize([4 15]) % limit the bubblesize
axis equal % ensures 1 unit in x equals 1 unit in y
axis off % romoves the axis
blgdC1 = bubblelegend({‘Cats’;’per km^2′},’Location’,’eastoutside’); % plots the legend
The legend for Cats per km^2 should look like in the plot above. (Ignor the that some of the bubbles are getting cut off this doesn’t happens when the map is ploted as well.)
%% create bubblechart Cat visits per region with legend
bV = bubblechart(xCoordinate,yCoordinate,markerSizesV, [0.9290, 0.6940, 0.1250]);
bubblesize([4 15])
axis equal % ensures 1 unit in x equals 1 unit in y
axis off
blgdV1 = bubblelegend({‘Cat Visits’;’per region’});
The legend for Cat visits per region should look like in the plot above. (Ignor the that some of the bubbles are getting cut off this doesn’t happens when the map is ploted as well.)
%% combined bubblechart Cats per km^2 and Cat visits per region
bC = bubblechart(xCoordinate,yCoordinate,markerSizesC, [1, 1, 1]);
hold on
bC.MarkerEdgeColor = [0,0,0];
bubblesize([4 15])
axis equal % ensures 1 unit in x equals 1 unit in y
axis off
bV = bubblechart(xCoordinate,yCoordinate,markerSizesV, [0.9290, 0.6940, 0.1250]);
bubblesize([4 15])
blgdC2 = bubblelegend({‘Cats’;’per km^2′},’Location’,’eastoutside’); %
blgdV2 = bubblelegend({‘Cat Visits’;’per region’},’Location’,’westoutside’);
legend(‘Cats per km^2’, ‘Cat Visits per Region’) %test what legend does
hold off
As soon as I combine two bubblecharts MATLAB combines valus in ratio to each other and combines it also into the same population legend. This is fine if I would have two variables with the same unit / content but different regions.
Therefore I tryed a version with
%% combine bubblechart Cat visits per region with scatter Cats per km^2
s = scatter(xCoordinate,yCoordinate,markerSizesC/2, MarkerFaceColor = "white", MarkerEdgeColor = "#36454F");
hold on
bV = bubblechart(xCoordinate,yCoordinate,markerSizesV, [0.9290, 0.6940, 0.1250]);
bubblesize([4 15])
axis equal % ensures 1 unit in x equals 1 unit in y
axis off
blgdV = bubblelegend({‘Cat Visits’;’per region’},’Location’,’westoutside’);
legend(‘Cats per km^2’, ‘Cat Visits per Region’)
hold off
This solves at least the problem that MATLAB considers these two variables should be in relation to each other. Plus the legend for "Cat visits per region" is correct and with the right color and right size.
However I don’t get a legend like this next to my plot as in the bubblechart combinded with scatter.
Is their anyone knowing how to solve this issue with legends?
Thanks for any input in this matter. Hi, I am trying to display to variables on a map and add a legend for both of the variables. Since I the problems is the legend I removed the map behind the plot to just focus on the variables.
I splitted the two variables first in two seperate plots to show how the legend should look like for each variable. Than I combine it in two ways and discuss the legend problems that I have face.
% create random data
xCoordinate = randi([3.1976e+05 8.2960e+05],21, 1); %Location on a map xCoordinate
yCoordinate = randi([6.1639e+06 7.2924e+06],21, 1); %Location on a map yCoordinate
markerSizesV = randi([0 5],21, 1);
markerSizesC = randi([1 379],21, 1);
%% create bubblechart Cats per km^2 of region with legend
bC = bubblechart(xCoordinate,yCoordinate,markerSizesC, [1, 1, 1]); %FaceColor white
bC.MarkerEdgeColor = [0,0,0]; %EdgeColor black
bubblesize([4 15]) % limit the bubblesize
axis equal % ensures 1 unit in x equals 1 unit in y
axis off % romoves the axis
blgdC1 = bubblelegend({‘Cats’;’per km^2′},’Location’,’eastoutside’); % plots the legend
The legend for Cats per km^2 should look like in the plot above. (Ignor the that some of the bubbles are getting cut off this doesn’t happens when the map is ploted as well.)
%% create bubblechart Cat visits per region with legend
bV = bubblechart(xCoordinate,yCoordinate,markerSizesV, [0.9290, 0.6940, 0.1250]);
bubblesize([4 15])
axis equal % ensures 1 unit in x equals 1 unit in y
axis off
blgdV1 = bubblelegend({‘Cat Visits’;’per region’});
The legend for Cat visits per region should look like in the plot above. (Ignor the that some of the bubbles are getting cut off this doesn’t happens when the map is ploted as well.)
%% combined bubblechart Cats per km^2 and Cat visits per region
bC = bubblechart(xCoordinate,yCoordinate,markerSizesC, [1, 1, 1]);
hold on
bC.MarkerEdgeColor = [0,0,0];
bubblesize([4 15])
axis equal % ensures 1 unit in x equals 1 unit in y
axis off
bV = bubblechart(xCoordinate,yCoordinate,markerSizesV, [0.9290, 0.6940, 0.1250]);
bubblesize([4 15])
blgdC2 = bubblelegend({‘Cats’;’per km^2′},’Location’,’eastoutside’); %
blgdV2 = bubblelegend({‘Cat Visits’;’per region’},’Location’,’westoutside’);
legend(‘Cats per km^2’, ‘Cat Visits per Region’) %test what legend does
hold off
As soon as I combine two bubblecharts MATLAB combines valus in ratio to each other and combines it also into the same population legend. This is fine if I would have two variables with the same unit / content but different regions.
Therefore I tryed a version with
%% combine bubblechart Cat visits per region with scatter Cats per km^2
s = scatter(xCoordinate,yCoordinate,markerSizesC/2, MarkerFaceColor = "white", MarkerEdgeColor = "#36454F");
hold on
bV = bubblechart(xCoordinate,yCoordinate,markerSizesV, [0.9290, 0.6940, 0.1250]);
bubblesize([4 15])
axis equal % ensures 1 unit in x equals 1 unit in y
axis off
blgdV = bubblelegend({‘Cat Visits’;’per region’},’Location’,’westoutside’);
legend(‘Cats per km^2’, ‘Cat Visits per Region’)
hold off
This solves at least the problem that MATLAB considers these two variables should be in relation to each other. Plus the legend for "Cat visits per region" is correct and with the right color and right size.
However I don’t get a legend like this next to my plot as in the bubblechart combinded with scatter.
Is their anyone knowing how to solve this issue with legends?
Thanks for any input in this matter. legend, multiple, bubblechart, scatter plot MATLAB Answers — New Questions
Interacting wih figures in 2025a
Hello!
After updating to MATLAB 2025a, I’ve noticed a significant decrease in performance when interacting with figures. Specifically, zooming, panning, and other figure manipulations are very slow and occasionally cause the program to freeze.
I often work with complex plots that include multiple tabs and numerous subplots, which means a large amount of data is being displayed. While I acknowledge this is a data-intensive use case, performance in previous MATLAB versions was much smoother.
I’m wondering if anyone else has experienced similar issues since the 2025a update?
It appears that my integrated UHD graphics is being used as the renderer device, despite my laptop having a dedicated NVIDIA GeForce GPU. Are there any settings I can adjust to force MATLAB to use my dedicated GPU for rendering to improve performance?
Any insights or potential solutions would be greatly appreciated! Thank you.Hello!
After updating to MATLAB 2025a, I’ve noticed a significant decrease in performance when interacting with figures. Specifically, zooming, panning, and other figure manipulations are very slow and occasionally cause the program to freeze.
I often work with complex plots that include multiple tabs and numerous subplots, which means a large amount of data is being displayed. While I acknowledge this is a data-intensive use case, performance in previous MATLAB versions was much smoother.
I’m wondering if anyone else has experienced similar issues since the 2025a update?
It appears that my integrated UHD graphics is being used as the renderer device, despite my laptop having a dedicated NVIDIA GeForce GPU. Are there any settings I can adjust to force MATLAB to use my dedicated GPU for rendering to improve performance?
Any insights or potential solutions would be greatly appreciated! Thank you. Hello!
After updating to MATLAB 2025a, I’ve noticed a significant decrease in performance when interacting with figures. Specifically, zooming, panning, and other figure manipulations are very slow and occasionally cause the program to freeze.
I often work with complex plots that include multiple tabs and numerous subplots, which means a large amount of data is being displayed. While I acknowledge this is a data-intensive use case, performance in previous MATLAB versions was much smoother.
I’m wondering if anyone else has experienced similar issues since the 2025a update?
It appears that my integrated UHD graphics is being used as the renderer device, despite my laptop having a dedicated NVIDIA GeForce GPU. Are there any settings I can adjust to force MATLAB to use my dedicated GPU for rendering to improve performance?
Any insights or potential solutions would be greatly appreciated! Thank you. 2025a, figure, performance MATLAB Answers — New Questions
Why doesn’t matlab start?
When I attempt to start matlab 2025a on windows 10, blank unresponsive window appears. I see that the task manager shows a "MathWorksCrashReporter.exe".
How do I determine what is going wrong?When I attempt to start matlab 2025a on windows 10, blank unresponsive window appears. I see that the task manager shows a "MathWorksCrashReporter.exe".
How do I determine what is going wrong? When I attempt to start matlab 2025a on windows 10, blank unresponsive window appears. I see that the task manager shows a "MathWorksCrashReporter.exe".
How do I determine what is going wrong? unresponsive MATLAB Answers — New Questions
Matlab installer not downloading
I have matlab license from my university. I wanted to download installer for matlab. But when I click on link displayed with "Download for Windows" it goes to "Your installer is downloading to your browser’s download folder." but nothing downloads. I have tried with various versions and different browsers but same thing happens. Can anyone help me in installing Matlab. As of now, I am using Matlab online version.I have matlab license from my university. I wanted to download installer for matlab. But when I click on link displayed with "Download for Windows" it goes to "Your installer is downloading to your browser’s download folder." but nothing downloads. I have tried with various versions and different browsers but same thing happens. Can anyone help me in installing Matlab. As of now, I am using Matlab online version. I have matlab license from my university. I wanted to download installer for matlab. But when I click on link displayed with "Download for Windows" it goes to "Your installer is downloading to your browser’s download folder." but nothing downloads. I have tried with various versions and different browsers but same thing happens. Can anyone help me in installing Matlab. As of now, I am using Matlab online version. downloading, matlab, installer, issue MATLAB Answers — New Questions
Copilot Transcription Behavior Changing for Teams Meetings
Default Changes to Copilot Enabled Without Transcription
First issued on August 22, 2025, and updated on September 5 to clarify the timeline, message center notification MC1139493 (Microsoft 365 roadmap item 478611) flags an important change in how Microsoft 365 Copilot functions in Teams meetings. Ever since the introduction of Copilot, the way things worked is that transcription is enabled when Copilot is used in meetings. After Microsoft rolls out the change starting in early November 2025, using Copilot in Teams meetings will no longer enable and save transcripts. This change might be disruptive if meeting organizers expect transcripts to be available after meetings conclude, but as always, the devil is in the detail and this change might not affect your tenant.
The change isn’t surprising given that Copilot can answer meeting participant queries without a transcript (this wasn’t originally the case) and that Microsoft has gradually tightened access control to the meeting transcript over time.
Why Change the Generation of Meeting Transcripts
Microsoft isn’t saying why Copilot-enabled Teams meetings will no longer generate a transcript, but it’s probably to safeguard against the possibility that Copilot will regurgitate meeting discussions in its response to user prompts.
Meeting transcripts are stored in the meeting organizer’s OneDrive for Business account and are indexed by Microsoft Search. Because their content is indexed, transcripts are available for Copilot to process just like any other document that isn’t blocked by the DLP policy for Microsoft 365 Copilot. Meeting organizers with Teams Premium licenses can apply a sensitivity label to files shared during a meeting, but the sensitivity label doesn’t apply to the transcript.
Will The Change Affect My Tenant
The simple answer is yes, if your tenant uses the default Teams meeting policy. That’s because Microsoft manages the settings of default Teams policies and can adjust policy settings as needed.
In this instance, Microsoft will change the value of the Copilot setting in the Teams meeting policy from EnabledWithTranscript to Enabled. The first value is in place today and it’s what instructs Teams to generate the transcript with Copilot. The second value allows Copilot to be used in Teams meetings without the generation of a transcript. If you check the documentation for the Set-CsTeamsMeetingPolicy cmdlet, you’ll see that Microsoft refers to a “persisted” and “non-persisted” transcript. A persisted transcript is one that’s saved to OneDrive for Business; a non-persisted transcript is one that Teams generates internally to allow Copilot to reference what people have said during the meeting before deleting all trace of the transcript when the meeting finishes.
New Microsoft 365 tenants will automatically pick up the Teams meeting policy default settings. Existing Microsoft 365 tenants will use the default settings for new meetings.
An exception exists where custom meeting policies are in use. It’s relatively common to customize Teams policies and the meeting policy is often changed to meet organizational needs. When a tenant customizes a default policy, Teams copies the default policy to create a custom copy for the tenant. The tenant controls the settings of custom policies and Microsoft therefore cannot change the default setting for Copilot. In other words, everything happens as before and enabling Copilot for a meeting will generate and save a transcript.
If Microsoft updates meeting policies for a tenant, it’s easy to revert the change to ensure that transcription occurs with Copilot. The change must be made with PowerShell by running the Connect-MicrosoftTeams cmdlet to connect to Teams PowerShell. Then, run this code to find which meeting policies have Copilot enabled without a transcript:
Get-CsTeamsMeetingPolicy | Where-Object {$_.Copilot -eq "Enabled"} | Format-Table Identity
To update a policy and restore Copilot with transcription, note the policy name and update it like this:
Set-CsTeamsMeetingPolicy -Identity "RestrictedFunctionality"-Copilot "EnabledWithTranscript" -AllowTranscription $true
Copilot Transcription for Individual Meetings
Even if Microsoft updates the default Teams meeting policy, meeting organizers can opt for transcription through meeting options either when scheduling (Figure 1) or during the meeting.

Persistent Conversations in Meetings
In MC1139493, Microsoft also make the point that conversation history has been made persistent within meetings. In other words, participants can switch between different elements of a meeting like chat or viewing the participant list without losing access to Copilot insights, even without a transcript being taken. The point is that when transcription is not enabled, persistence is possible using the internal transcript, which is how it should be.
So much change, all the time. It’s a challenge to stay abreast of all the updates Microsoft makes across the Microsoft 365 ecosystem. Subscribe to the Office 365 for IT Pros eBook to receive insights updated monthly into what happens within Microsoft 365, why it happens, and what new features and capabilities mean for your tenant.
Properties validation in subclass with multiple superclass but same ancestor
hello everyone,
I have a problem: I’m trying to build a (quite complex) super/subclassing tree for a project, but I’m stuck before MATLAB failed at instanciating an object deriving from multiple classes but that at the end derive from the same root object, and in this root object I defined an abstract property, with some validators, that should be define in the concrete object.
According to this page, it should works, but it does NOT work in my case (MATLAB 2024a; I plan to migrate to newer versions soon).
Minimum Workin Example (MWE) completely unrelated to my project:
let’s suppose that i have to model several vehicles, so I can create a superclass called "vehicles" with some properties, including the minimum number of staff required to run it:
classdef vehicle < handle
properties (Abstract, Constant)
required_staff (1,1) {mustBeNumeric}
end
methods
function obj = vehicle()
end
end
end
Now, we can specialize the "vehicle" in several ways and multiple times, for example by creating a "landVehicle" class, a "bike" class (extending "landVehicle"), an "electricalVehicle" (all these classes may define something more, but for this MWE we can have them "empty" and it will not change) and finally the "EBike9000" that is an electrical bike.
Code for the "bike" class (the other mid-classes are similar):
classdef bike < landVehicle
end
Code for the "EBike9000" concrete class:
classdef EBike9000 < bike & electricalVehicle
properties (Constant)
required_staff = 1
end
end
Now, the only definition and validation for the required_staff property is in the root "vehicle" class. The middle class never mention it, however, when I tried to instantiate an EBike9000 object, matlab complain with:
Error using EBike9000
Class ‘electricalVehicle’ and class ‘bike’ both define validation for
Abstract property ‘required_staff’. When inheriting property validation,
only one superclass can define validation for property ‘required_staff’.
However, this validator IS the same since it belong to the same superclass, so it should NOT be a problem for MATLAB to validate it (as also stated in the page I linked at the beginning).
So, what’s going on? is this a bug, or it’s me that I’m missing something? Ideas for some workarounds (except including a set.required_staff method which on all the possible vehicles around)?hello everyone,
I have a problem: I’m trying to build a (quite complex) super/subclassing tree for a project, but I’m stuck before MATLAB failed at instanciating an object deriving from multiple classes but that at the end derive from the same root object, and in this root object I defined an abstract property, with some validators, that should be define in the concrete object.
According to this page, it should works, but it does NOT work in my case (MATLAB 2024a; I plan to migrate to newer versions soon).
Minimum Workin Example (MWE) completely unrelated to my project:
let’s suppose that i have to model several vehicles, so I can create a superclass called "vehicles" with some properties, including the minimum number of staff required to run it:
classdef vehicle < handle
properties (Abstract, Constant)
required_staff (1,1) {mustBeNumeric}
end
methods
function obj = vehicle()
end
end
end
Now, we can specialize the "vehicle" in several ways and multiple times, for example by creating a "landVehicle" class, a "bike" class (extending "landVehicle"), an "electricalVehicle" (all these classes may define something more, but for this MWE we can have them "empty" and it will not change) and finally the "EBike9000" that is an electrical bike.
Code for the "bike" class (the other mid-classes are similar):
classdef bike < landVehicle
end
Code for the "EBike9000" concrete class:
classdef EBike9000 < bike & electricalVehicle
properties (Constant)
required_staff = 1
end
end
Now, the only definition and validation for the required_staff property is in the root "vehicle" class. The middle class never mention it, however, when I tried to instantiate an EBike9000 object, matlab complain with:
Error using EBike9000
Class ‘electricalVehicle’ and class ‘bike’ both define validation for
Abstract property ‘required_staff’. When inheriting property validation,
only one superclass can define validation for property ‘required_staff’.
However, this validator IS the same since it belong to the same superclass, so it should NOT be a problem for MATLAB to validate it (as also stated in the page I linked at the beginning).
So, what’s going on? is this a bug, or it’s me that I’m missing something? Ideas for some workarounds (except including a set.required_staff method which on all the possible vehicles around)? hello everyone,
I have a problem: I’m trying to build a (quite complex) super/subclassing tree for a project, but I’m stuck before MATLAB failed at instanciating an object deriving from multiple classes but that at the end derive from the same root object, and in this root object I defined an abstract property, with some validators, that should be define in the concrete object.
According to this page, it should works, but it does NOT work in my case (MATLAB 2024a; I plan to migrate to newer versions soon).
Minimum Workin Example (MWE) completely unrelated to my project:
let’s suppose that i have to model several vehicles, so I can create a superclass called "vehicles" with some properties, including the minimum number of staff required to run it:
classdef vehicle < handle
properties (Abstract, Constant)
required_staff (1,1) {mustBeNumeric}
end
methods
function obj = vehicle()
end
end
end
Now, we can specialize the "vehicle" in several ways and multiple times, for example by creating a "landVehicle" class, a "bike" class (extending "landVehicle"), an "electricalVehicle" (all these classes may define something more, but for this MWE we can have them "empty" and it will not change) and finally the "EBike9000" that is an electrical bike.
Code for the "bike" class (the other mid-classes are similar):
classdef bike < landVehicle
end
Code for the "EBike9000" concrete class:
classdef EBike9000 < bike & electricalVehicle
properties (Constant)
required_staff = 1
end
end
Now, the only definition and validation for the required_staff property is in the root "vehicle" class. The middle class never mention it, however, when I tried to instantiate an EBike9000 object, matlab complain with:
Error using EBike9000
Class ‘electricalVehicle’ and class ‘bike’ both define validation for
Abstract property ‘required_staff’. When inheriting property validation,
only one superclass can define validation for property ‘required_staff’.
However, this validator IS the same since it belong to the same superclass, so it should NOT be a problem for MATLAB to validate it (as also stated in the page I linked at the beginning).
So, what’s going on? is this a bug, or it’s me that I’m missing something? Ideas for some workarounds (except including a set.required_staff method which on all the possible vehicles around)? oop, subclassing, superclass, properties validation MATLAB Answers — New Questions
How to correctly implement a pid control and fuzzy logic control on synchronous generator tied to ieee bus system?
Im trying to implement pid control and fuzzy logic excitation control separately for the synchronous generator for this ieee9 bus system to monitor/compare their performances in terms of voltage control, im struggling with that. Even with the current type1 exciter on the S.G it isnt giving the results it should at all. The stator current is stable until 2 s when it goes sky high for some reason and the Vf drops to extreme negative values. I really hope someone can help guide me in the right direction.Im trying to implement pid control and fuzzy logic excitation control separately for the synchronous generator for this ieee9 bus system to monitor/compare their performances in terms of voltage control, im struggling with that. Even with the current type1 exciter on the S.G it isnt giving the results it should at all. The stator current is stable until 2 s when it goes sky high for some reason and the Vf drops to extreme negative values. I really hope someone can help guide me in the right direction. Im trying to implement pid control and fuzzy logic excitation control separately for the synchronous generator for this ieee9 bus system to monitor/compare their performances in terms of voltage control, im struggling with that. Even with the current type1 exciter on the S.G it isnt giving the results it should at all. The stator current is stable until 2 s when it goes sky high for some reason and the Vf drops to extreme negative values. I really hope someone can help guide me in the right direction. synchronous generator, ieee bus 9, pid, fuzzy logic MATLAB Answers — New Questions
Hi,I am atanu.i wants a matlab simulation expart.i have a simulation problem regarding this paper given below and i also give the input data at the file book06.
the paper and matlab simulink file and input data i given.the paper and matlab simulink file and input data i given. the paper and matlab simulink file and input data i given. simulation MATLAB Answers — New Questions
Using RTX 5090 for GPU computing in forward compatibility
Dear users,
I have read a couple of very useful posts
https://www.mathworks.com/matlabcentral/answers/2173867-can-i-use-my-nvidia-blackwell-architecture-gpu-with-matlab-for-gpu-computing
https://www.mathworks.com/help/parallel-computing/gpu-computing-requirements.html
which explain that Matlab currently does not fully support Nvidia gpus with compute capability greater than 9.0.
This means that RTX 5090 (or any GPU based on the new Blackwell architecture) is not fully supported natively, but it can be enabled with forward compatibility as follows:
parallel.gpu.enableCUDAForwardCompatibility(1)
However, Matlab documentation also says that "Enabling forward compatibility can result in wrong answers and unexpected behavior during GPU computations." (please see second link posted above).
So I would like to ask users who own a NVIDIA RTX 50XX what is their experience and how well forward compatibility works in practice. This feedback will be quite useful because I am currently considering upgrading my GPU to a new 5090 but I wonder if I should wait a bit until a future realease provide full native support.
Thanks in advance for comments/feedback etc.!Dear users,
I have read a couple of very useful posts
https://www.mathworks.com/matlabcentral/answers/2173867-can-i-use-my-nvidia-blackwell-architecture-gpu-with-matlab-for-gpu-computing
https://www.mathworks.com/help/parallel-computing/gpu-computing-requirements.html
which explain that Matlab currently does not fully support Nvidia gpus with compute capability greater than 9.0.
This means that RTX 5090 (or any GPU based on the new Blackwell architecture) is not fully supported natively, but it can be enabled with forward compatibility as follows:
parallel.gpu.enableCUDAForwardCompatibility(1)
However, Matlab documentation also says that "Enabling forward compatibility can result in wrong answers and unexpected behavior during GPU computations." (please see second link posted above).
So I would like to ask users who own a NVIDIA RTX 50XX what is their experience and how well forward compatibility works in practice. This feedback will be quite useful because I am currently considering upgrading my GPU to a new 5090 but I wonder if I should wait a bit until a future realease provide full native support.
Thanks in advance for comments/feedback etc.! Dear users,
I have read a couple of very useful posts
https://www.mathworks.com/matlabcentral/answers/2173867-can-i-use-my-nvidia-blackwell-architecture-gpu-with-matlab-for-gpu-computing
https://www.mathworks.com/help/parallel-computing/gpu-computing-requirements.html
which explain that Matlab currently does not fully support Nvidia gpus with compute capability greater than 9.0.
This means that RTX 5090 (or any GPU based on the new Blackwell architecture) is not fully supported natively, but it can be enabled with forward compatibility as follows:
parallel.gpu.enableCUDAForwardCompatibility(1)
However, Matlab documentation also says that "Enabling forward compatibility can result in wrong answers and unexpected behavior during GPU computations." (please see second link posted above).
So I would like to ask users who own a NVIDIA RTX 50XX what is their experience and how well forward compatibility works in practice. This feedback will be quite useful because I am currently considering upgrading my GPU to a new 5090 but I wonder if I should wait a bit until a future realease provide full native support.
Thanks in advance for comments/feedback etc.! parallel computing toolbox, gpu, forward compatibility, blackwell MATLAB Answers — New Questions
Cannot query I2C bus speed
Hi,
I’m using a Raspberry Pi 5 with the fresh latest OS and the MATLAB Support Package for Raspberry Pi. Last week I made a simple visualisaztion for gyroscope through i2c and it worked nicely. But today I had problem with this error when i try to do raspi
mypi = raspi(‘192.168.0.212’, ‘admin’, ‘raspberry’);
Cannot query I2C bus speed.
Caused by:
Error using matlabshared.internal.ssh2client/execute
Error executing command "sudo cat /sys/module/i2c_bcm2708/parameters/baudrate". Details:
STDERR: cat: /sys/module/i2c_bcm2708/parameters/baudrate: No such file or directory
STDOUT:
So i looked everywhere, made a fresh OS install, flashed a bootloader. I tried enabling via GUI, raspi-config and matlab. Nothing worked. Interestingly when I disable i2c interface on pi I no longer get this error and can do things in matlab.
My /boot/config.txt correctly enables I2C and sets the baudrate:Hi,
I’m using a Raspberry Pi 5 with the fresh latest OS and the MATLAB Support Package for Raspberry Pi. Last week I made a simple visualisaztion for gyroscope through i2c and it worked nicely. But today I had problem with this error when i try to do raspi
mypi = raspi(‘192.168.0.212’, ‘admin’, ‘raspberry’);
Cannot query I2C bus speed.
Caused by:
Error using matlabshared.internal.ssh2client/execute
Error executing command "sudo cat /sys/module/i2c_bcm2708/parameters/baudrate". Details:
STDERR: cat: /sys/module/i2c_bcm2708/parameters/baudrate: No such file or directory
STDOUT:
So i looked everywhere, made a fresh OS install, flashed a bootloader. I tried enabling via GUI, raspi-config and matlab. Nothing worked. Interestingly when I disable i2c interface on pi I no longer get this error and can do things in matlab.
My /boot/config.txt correctly enables I2C and sets the baudrate: Hi,
I’m using a Raspberry Pi 5 with the fresh latest OS and the MATLAB Support Package for Raspberry Pi. Last week I made a simple visualisaztion for gyroscope through i2c and it worked nicely. But today I had problem with this error when i try to do raspi
mypi = raspi(‘192.168.0.212’, ‘admin’, ‘raspberry’);
Cannot query I2C bus speed.
Caused by:
Error using matlabshared.internal.ssh2client/execute
Error executing command "sudo cat /sys/module/i2c_bcm2708/parameters/baudrate". Details:
STDERR: cat: /sys/module/i2c_bcm2708/parameters/baudrate: No such file or directory
STDOUT:
So i looked everywhere, made a fresh OS install, flashed a bootloader. I tried enabling via GUI, raspi-config and matlab. Nothing worked. Interestingly when I disable i2c interface on pi I no longer get this error and can do things in matlab.
My /boot/config.txt correctly enables I2C and sets the baudrate: raspberry, i2c MATLAB Answers — New Questions
Plot vectors from the origin
I am learning matlab and trying to plot vectors. I defined V=[3;4] to represent 3x^+4y^ and attempt to display using plot(V) hoping to see a vector from origin to (3,4) but instead the graph shows a vector from (1,3) to (2,4). Is it a problem with my plotting settings or am I not using the correct script?I am learning matlab and trying to plot vectors. I defined V=[3;4] to represent 3x^+4y^ and attempt to display using plot(V) hoping to see a vector from origin to (3,4) but instead the graph shows a vector from (1,3) to (2,4). Is it a problem with my plotting settings or am I not using the correct script? I am learning matlab and trying to plot vectors. I defined V=[3;4] to represent 3x^+4y^ and attempt to display using plot(V) hoping to see a vector from origin to (3,4) but instead the graph shows a vector from (1,3) to (2,4). Is it a problem with my plotting settings or am I not using the correct script? plotting, linear algebra MATLAB Answers — New Questions
Trying to build a DHT11 block and keep getting this error in Simulink
Im trying to build this block but I get this error that I will provide below. I have followed exactly the steps from the matlab tutorials, so I have no idea what is the problem. Please if anyone knows I would appreciate the help.
C:/Users/user/DOCUME~1/MATLAB/R2024b/ArduinoStaticLibrary/ArduinoUno/FasterRuns/MW_RebuildSrc_Core.o -lm -lcomm -lcore DHT11_DDAppGeneratedModel.o: In function `DHT11_DDAppGeneratedModel_step’: DHT11_DDAppGeneratedModel.c:(.text.DHT11_DDAppGeneratedModel_step+0xc0): undefined reference to `stepFunctionDHT11′ DHT11_DDAppGeneratedModel.o: In function `DHT11_DDAppGeneratedModel_initialize’: DHT11_DDAppGeneratedModel.c:(.text.DHT11_DDAppGeneratedModel_initialize+0x5c): undefined reference to `setupFunctionDHT11′ collect2.exe: error: ld returned 1 exit status gmake[1]: *** [../DHT11_DDAppGeneratedModel.elf] Error 1 gmake[1]: Leaving directory `C:/Users/user/Desktop/DHT11/DHT11_DDAppGeneratedModel_ert_rtw’ gmake: *** [all] Error 2 C:UsersuserDesktopDHT11DHT11_DDAppGeneratedModel_ert_rtw>echo The make command returned an error of 2 The make command returned an error of 2 C:UsersuserDesktopDHT11DHT11_DDAppGeneratedModel_ert_rtw>exit /B 1 ### Build procedure for DHT11_DDAppGeneratedModel aborted due to an error.
Build Summary
Top model targets: Model Build Reason Status Build Duration ===================================================================================================================================================== DHT11_DDAppGeneratedModel Information cache folder or artifacts were missing. Failed to build. For more information, see build log. 0d 0 of 1 models built (0 models already up to date) Build duration: 0h 0m 29.469s
Error(s) encountered while building "DHT11_DDAppGeneratedModel"
Component:Simulink | Category:Block diagram error
And my code is as follows:
#include "C:UsersuserDesktopDHT11DHT11.h"
#include "Adafruit_Sensor.h"
#include "DHT.h"
#include "DHT_U.h"
#include "Arduino.h"
#define DHTPIN 10
#define DHTTYPE DHT11
DHT_Unified dht(DHTPIN, DHTTYPE);
uint32_t delayMS;
void setupFunctiondht11Sensor(uint32_T * dataDelay,int size_vector__1){
Serial.begin(9600);
dht.begin();
delayMS = dataDelay;
}
void stepFunctiondht11Sensor(float * Humidity,int size_vector_1,float * Temperature,int size_vector_2){
delay(delayMS);
sensors_event_t event;
dht.temperature().getEvent(&event);
if (isnan(event.temperature)) {
}
else {
*Temperature=event.temperature;
}
dht.humidity().getEvent(&event);
if (isnan(event.relative_humidity)) {
}
else {
*Humidity=event.relative_humidity;
}
}Im trying to build this block but I get this error that I will provide below. I have followed exactly the steps from the matlab tutorials, so I have no idea what is the problem. Please if anyone knows I would appreciate the help.
C:/Users/user/DOCUME~1/MATLAB/R2024b/ArduinoStaticLibrary/ArduinoUno/FasterRuns/MW_RebuildSrc_Core.o -lm -lcomm -lcore DHT11_DDAppGeneratedModel.o: In function `DHT11_DDAppGeneratedModel_step’: DHT11_DDAppGeneratedModel.c:(.text.DHT11_DDAppGeneratedModel_step+0xc0): undefined reference to `stepFunctionDHT11′ DHT11_DDAppGeneratedModel.o: In function `DHT11_DDAppGeneratedModel_initialize’: DHT11_DDAppGeneratedModel.c:(.text.DHT11_DDAppGeneratedModel_initialize+0x5c): undefined reference to `setupFunctionDHT11′ collect2.exe: error: ld returned 1 exit status gmake[1]: *** [../DHT11_DDAppGeneratedModel.elf] Error 1 gmake[1]: Leaving directory `C:/Users/user/Desktop/DHT11/DHT11_DDAppGeneratedModel_ert_rtw’ gmake: *** [all] Error 2 C:UsersuserDesktopDHT11DHT11_DDAppGeneratedModel_ert_rtw>echo The make command returned an error of 2 The make command returned an error of 2 C:UsersuserDesktopDHT11DHT11_DDAppGeneratedModel_ert_rtw>exit /B 1 ### Build procedure for DHT11_DDAppGeneratedModel aborted due to an error.
Build Summary
Top model targets: Model Build Reason Status Build Duration ===================================================================================================================================================== DHT11_DDAppGeneratedModel Information cache folder or artifacts were missing. Failed to build. For more information, see build log. 0d 0 of 1 models built (0 models already up to date) Build duration: 0h 0m 29.469s
Error(s) encountered while building "DHT11_DDAppGeneratedModel"
Component:Simulink | Category:Block diagram error
And my code is as follows:
#include "C:UsersuserDesktopDHT11DHT11.h"
#include "Adafruit_Sensor.h"
#include "DHT.h"
#include "DHT_U.h"
#include "Arduino.h"
#define DHTPIN 10
#define DHTTYPE DHT11
DHT_Unified dht(DHTPIN, DHTTYPE);
uint32_t delayMS;
void setupFunctiondht11Sensor(uint32_T * dataDelay,int size_vector__1){
Serial.begin(9600);
dht.begin();
delayMS = dataDelay;
}
void stepFunctiondht11Sensor(float * Humidity,int size_vector_1,float * Temperature,int size_vector_2){
delay(delayMS);
sensors_event_t event;
dht.temperature().getEvent(&event);
if (isnan(event.temperature)) {
}
else {
*Temperature=event.temperature;
}
dht.humidity().getEvent(&event);
if (isnan(event.relative_humidity)) {
}
else {
*Humidity=event.relative_humidity;
}
} Im trying to build this block but I get this error that I will provide below. I have followed exactly the steps from the matlab tutorials, so I have no idea what is the problem. Please if anyone knows I would appreciate the help.
C:/Users/user/DOCUME~1/MATLAB/R2024b/ArduinoStaticLibrary/ArduinoUno/FasterRuns/MW_RebuildSrc_Core.o -lm -lcomm -lcore DHT11_DDAppGeneratedModel.o: In function `DHT11_DDAppGeneratedModel_step’: DHT11_DDAppGeneratedModel.c:(.text.DHT11_DDAppGeneratedModel_step+0xc0): undefined reference to `stepFunctionDHT11′ DHT11_DDAppGeneratedModel.o: In function `DHT11_DDAppGeneratedModel_initialize’: DHT11_DDAppGeneratedModel.c:(.text.DHT11_DDAppGeneratedModel_initialize+0x5c): undefined reference to `setupFunctionDHT11′ collect2.exe: error: ld returned 1 exit status gmake[1]: *** [../DHT11_DDAppGeneratedModel.elf] Error 1 gmake[1]: Leaving directory `C:/Users/user/Desktop/DHT11/DHT11_DDAppGeneratedModel_ert_rtw’ gmake: *** [all] Error 2 C:UsersuserDesktopDHT11DHT11_DDAppGeneratedModel_ert_rtw>echo The make command returned an error of 2 The make command returned an error of 2 C:UsersuserDesktopDHT11DHT11_DDAppGeneratedModel_ert_rtw>exit /B 1 ### Build procedure for DHT11_DDAppGeneratedModel aborted due to an error.
Build Summary
Top model targets: Model Build Reason Status Build Duration ===================================================================================================================================================== DHT11_DDAppGeneratedModel Information cache folder or artifacts were missing. Failed to build. For more information, see build log. 0d 0 of 1 models built (0 models already up to date) Build duration: 0h 0m 29.469s
Error(s) encountered while building "DHT11_DDAppGeneratedModel"
Component:Simulink | Category:Block diagram error
And my code is as follows:
#include "C:UsersuserDesktopDHT11DHT11.h"
#include "Adafruit_Sensor.h"
#include "DHT.h"
#include "DHT_U.h"
#include "Arduino.h"
#define DHTPIN 10
#define DHTTYPE DHT11
DHT_Unified dht(DHTPIN, DHTTYPE);
uint32_t delayMS;
void setupFunctiondht11Sensor(uint32_T * dataDelay,int size_vector__1){
Serial.begin(9600);
dht.begin();
delayMS = dataDelay;
}
void stepFunctiondht11Sensor(float * Humidity,int size_vector_1,float * Temperature,int size_vector_2){
delay(delayMS);
sensors_event_t event;
dht.temperature().getEvent(&event);
if (isnan(event.temperature)) {
}
else {
*Temperature=event.temperature;
}
dht.humidity().getEvent(&event);
if (isnan(event.relative_humidity)) {
}
else {
*Humidity=event.relative_humidity;
}
} block diagram, error, simulink, dht11, code, c++ MATLAB Answers — New Questions
how to filter columns
Hello friends,
I have this script. But is very slow!
I want to filter all columns beginning with column first. After that, I want, in the place of column first, to put the second column and, in the place of column second to put the column first and filter again. And go on!
My purpose is decrease the time!
Thanks by support!
clear all
clc
q = 1;
p = 2;
r1 = 1;
r2 = 1;
tic
% Example: Filtering a matrix
load (‘tum.mat’); % tum have 576 x 1000
for i1 = 1:1000
% Filter rows where the first column is greater than 15
z1 = k2(k2(:,1) == 0, :);
s1 = sum(z1, 1);
r(r1,r2) = max(s1);
temp_row = k2(:,q);
k2(:,q) = k2(:,p);
k2(:,p) = temp_row;
p = p + 1;
r1 = r1 + 1;
end
toc
Elapsed time is 337.582496 seconds.Hello friends,
I have this script. But is very slow!
I want to filter all columns beginning with column first. After that, I want, in the place of column first, to put the second column and, in the place of column second to put the column first and filter again. And go on!
My purpose is decrease the time!
Thanks by support!
clear all
clc
q = 1;
p = 2;
r1 = 1;
r2 = 1;
tic
% Example: Filtering a matrix
load (‘tum.mat’); % tum have 576 x 1000
for i1 = 1:1000
% Filter rows where the first column is greater than 15
z1 = k2(k2(:,1) == 0, :);
s1 = sum(z1, 1);
r(r1,r2) = max(s1);
temp_row = k2(:,q);
k2(:,q) = k2(:,p);
k2(:,p) = temp_row;
p = p + 1;
r1 = r1 + 1;
end
toc
Elapsed time is 337.582496 seconds. Hello friends,
I have this script. But is very slow!
I want to filter all columns beginning with column first. After that, I want, in the place of column first, to put the second column and, in the place of column second to put the column first and filter again. And go on!
My purpose is decrease the time!
Thanks by support!
clear all
clc
q = 1;
p = 2;
r1 = 1;
r2 = 1;
tic
% Example: Filtering a matrix
load (‘tum.mat’); % tum have 576 x 1000
for i1 = 1:1000
% Filter rows where the first column is greater than 15
z1 = k2(k2(:,1) == 0, :);
s1 = sum(z1, 1);
r(r1,r2) = max(s1);
temp_row = k2(:,q);
k2(:,q) = k2(:,p);
k2(:,p) = temp_row;
p = p + 1;
r1 = r1 + 1;
end
toc
Elapsed time is 337.582496 seconds. filter columns MATLAB Answers — New Questions
ROS Commands hang/not working
Hello,
I am using R2025a, on Windows 11. I have installed the ROS toolbox, along with python 3.10.x.
Every time I issue a ros command, eg ros2node("/foo") or even ros2 node list, or whatever command in general, matlab hangs.
The program is not frozen, however it is as if the command never finishes execution. I’ve allowed for up to 30m of execution time, and I get nothing on the output window (and of course matlab is indicating "Busy").
The computer has all firewalls/antivirus software/whatnot completely disabled, so this must not be an issue here.
What I have tried:
1) Reinstall ROS addon
2) Try all three RMW implementations
In all cases, there was no difference in the outcome.
I’ve never seen this before, any ideas what it could be?
Thanks,
KonstantinosHello,
I am using R2025a, on Windows 11. I have installed the ROS toolbox, along with python 3.10.x.
Every time I issue a ros command, eg ros2node("/foo") or even ros2 node list, or whatever command in general, matlab hangs.
The program is not frozen, however it is as if the command never finishes execution. I’ve allowed for up to 30m of execution time, and I get nothing on the output window (and of course matlab is indicating "Busy").
The computer has all firewalls/antivirus software/whatnot completely disabled, so this must not be an issue here.
What I have tried:
1) Reinstall ROS addon
2) Try all three RMW implementations
In all cases, there was no difference in the outcome.
I’ve never seen this before, any ideas what it could be?
Thanks,
Konstantinos Hello,
I am using R2025a, on Windows 11. I have installed the ROS toolbox, along with python 3.10.x.
Every time I issue a ros command, eg ros2node("/foo") or even ros2 node list, or whatever command in general, matlab hangs.
The program is not frozen, however it is as if the command never finishes execution. I’ve allowed for up to 30m of execution time, and I get nothing on the output window (and of course matlab is indicating "Busy").
The computer has all firewalls/antivirus software/whatnot completely disabled, so this must not be an issue here.
What I have tried:
1) Reinstall ROS addon
2) Try all three RMW implementations
In all cases, there was no difference in the outcome.
I’ve never seen this before, any ideas what it could be?
Thanks,
Konstantinos ros MATLAB Answers — New Questions
A joint statement from Microsoft and OpenAI
Microsoft and OpenAI have signed a non-binding memorandum of understanding (MOU) for the next phase of our partnership. We are actively working to finalize contractual terms in a definitive agreement. Together, we remain focused on delivering the best AI tools for everyone, grounded in our shared commitment to safety.
The post A joint statement from Microsoft and OpenAI appeared first on The Official Microsoft Blog.
Microsoft and OpenAI have signed a non-binding memorandum of understanding (MOU) for the next phase of our partnership. We are actively working to finalize contractual terms in a definitive agreement. Together, we remain focused on delivering the best AI tools for everyone, grounded in our shared commitment to safety.
The post A joint statement from Microsoft and OpenAI appeared first on The Official Microsoft Blog.Read More
Why do I get the error “Unable to process your request” when trying to sign in to a MathWorks Account via SSO?
Previously I was able to sign in to my MathWorks account using a password, but now when I try to sign in I am redirected to my university’s Single Sign-On (SSO) page and when I sign in there, I get the error "Unable to process your request. If this problem persists, contact support."Previously I was able to sign in to my MathWorks account using a password, but now when I try to sign in I am redirected to my university’s Single Sign-On (SSO) page and when I sign in there, I get the error "Unable to process your request. If this problem persists, contact support." Previously I was able to sign in to my MathWorks account using a password, but now when I try to sign in I am redirected to my university’s Single Sign-On (SSO) page and when I sign in there, I get the error "Unable to process your request. If this problem persists, contact support." MATLAB Answers — New Questions
Neumann boundary condition in a diagonal matrix
I am trying to increase the accuracy of my mode solver by reducing the size of the calculation space, to do that I apply Dirichlet and Neumann on the borders. Assuming the symmetry, solving for only the upper left side (picture below) gives me the whole field. So I apply Dirichlet on the right and top side and Neumann on the bottom and right side.
I solve with eigs the following system : where is a vector describing the whole field and is a symmetric matrix having the form :
Where b is defined as (d is the distance between two points) and a is defined as where n(xi,yi) is the value of n at the x,y position described by (i). The equation used to write the system is :
Defining Neumann Boundary condition as :
Rewriting the above equation for the bottom and left part of the field I evidence the fact that it only changes the coefficient a by a coefficient , so what I did is adding this coefficient to the matrix coefficient when I know it is a boundary, leading to :
if i modulo m is 0 ( for i=1,…,l*m and i=j ) it means I am on the bottom of the field so I add to the previous definition of
if i>=l*(m-1) it means I am on the right boundary of the field so I add to the previous definition of
The addition of this two condition supposedly take into account what happens on the bottom right corner adding . But there must be an issue whith the way I coded it or defined my boundaries since I do not get the same results as when I study the full field (and it is not just an accuracy issue). I plotted the difference between expected results and what I actually got below.
The code I used is as follow :
%%Function topology for DCF design
clear all
clc
format long
%stepIndex———————————————————
sizeX=10e-6;
sizeY=10e-6;
l=100;
m=100;
x=-linspace(0,sizeX,l);
y=linspace(0,sizeY,m);
d=abs(x(1)-x(2))
[xx,yy]=meshgrid(x,y);
n=zeros(size(xx));
Phi=zeros(m*l);
%%%%%%%%%%%%%%%%%%%%%%%%Iterate over wl%%%%%%%%%%%%%%%%%%%%%%%%%%
%Basic physical parameters—————————————–
lambdac=1030e-9;
dlambda=0.5e-9;
rcoreIni=5e-6;
rclad=125e-6;
nbg=1;
neff=[];
lambdac0=1000e-9;
lambdacmax=1600e-9;
psi=[];
for lambda0=lambdac0:50e-9:lambdacmax%lambdac-dlambda:dlambda:lambdac+dlambda
%n_SiO2=interp1(A(:,1)*1e-9,A(:,9),lambda0,’spline’); %-replaced because the Sellmeier filed is not attached and the issue is generalized to every wavelength
wl=lambdac0;
A1=0.6961663;
A2=0.4079426;
A3=0.8974794;
L1=0.0684043e-6;
L2=0.1162414e-6;
L3=9.896161e-6;
n_SiO2=sqrt(1+(A1*wl^2)/(wl^2-L1^2)+(A2*wl^2)/(wl^2-L2^2)+(A3*wl^2)/(wl^2-L3^2));
k0=2*pi/lambda0;
lambda0
%Initial design guess———————————————-
nmin=n_SiO2;
nmax=sqrt(0.14^2+n_SiO2^2);
nicore=nmax;%n_SiO2+0.36*n_SiO2;%n_SiO2+0.38;
niclad=nmin;%n_SiO2;
n=n*0+nbg;
n(xx.^2+yy.^2<rclad^2)=niclad;
n(xx.^2+yy.^2<rcoreIni^2)=nicore;
figure(1);
surf(xx,yy,n,’EdgeColor’,’none’);axis tight
%transform n———————————————————–
ni=[];
for iii=1:1:length(n)
ni=[ni;n(iii,:).’];
end
for ii=1:1:l*m
Phi(ii,ii)=-4/d^2+ni(ii)^2*k0^2;
if(ii-1>=1 && ii+1<=l*m)
Phi(ii-1,ii)=1/d^2;
Phi(ii,ii+1)=1/d^2;
Phi(ii+1,ii)=1/d^2;
Phi(ii,ii-1)=1/d^2;
end
if(ii-m>=1)
Phi(ii,ii-m)=1/d^2;
end
if(ii+m<=l*m)
Phi(ii,ii+m)=1/d^2;
end
if(ii>=l*(m-1))%right hand side
Phi(ii,ii)=Phi(ii,ii)+1/d^2;
end
if(mod(ii,m)==0)%bottom side
Phi(ii,ii)=Phi(ii,ii)+1/d^2;
end
end
%%Eigenvalues calc————————————————–
Phi=sparse(Phi);
%%solving
opts.maxit = 1000;
opts.tol = 1e-9;
[eigenvector,eigenvalues,flag]=eigs(Phi,10,(1.45)^2*k0^2,opts);
beta2=diag(eigenvalues);
Psi=eigenvector;
neff=[neff max(sqrt(beta2)./k0)];
psi=[psi Psi(:,1)];
end
%mode field visual——————————————————-
for iii=1:1:5
Pssi=[];
for jj=1:1:l
Pssi=[Pssi; Psi((jj-1)*l+1:jj*l,iii).’];
end
figure(iii+2);
surf(xx,yy,abs(Pssi).^2,’EdgeColor’,’none’);view(2);
end
lm=lambdac0:50e-9:lambdacmax;
figure(2)
hold on
plot(lm,neff);
hold off
Am I wrong code wise, theory wise or both??
Thanks a lot!I am trying to increase the accuracy of my mode solver by reducing the size of the calculation space, to do that I apply Dirichlet and Neumann on the borders. Assuming the symmetry, solving for only the upper left side (picture below) gives me the whole field. So I apply Dirichlet on the right and top side and Neumann on the bottom and right side.
I solve with eigs the following system : where is a vector describing the whole field and is a symmetric matrix having the form :
Where b is defined as (d is the distance between two points) and a is defined as where n(xi,yi) is the value of n at the x,y position described by (i). The equation used to write the system is :
Defining Neumann Boundary condition as :
Rewriting the above equation for the bottom and left part of the field I evidence the fact that it only changes the coefficient a by a coefficient , so what I did is adding this coefficient to the matrix coefficient when I know it is a boundary, leading to :
if i modulo m is 0 ( for i=1,…,l*m and i=j ) it means I am on the bottom of the field so I add to the previous definition of
if i>=l*(m-1) it means I am on the right boundary of the field so I add to the previous definition of
The addition of this two condition supposedly take into account what happens on the bottom right corner adding . But there must be an issue whith the way I coded it or defined my boundaries since I do not get the same results as when I study the full field (and it is not just an accuracy issue). I plotted the difference between expected results and what I actually got below.
The code I used is as follow :
%%Function topology for DCF design
clear all
clc
format long
%stepIndex———————————————————
sizeX=10e-6;
sizeY=10e-6;
l=100;
m=100;
x=-linspace(0,sizeX,l);
y=linspace(0,sizeY,m);
d=abs(x(1)-x(2))
[xx,yy]=meshgrid(x,y);
n=zeros(size(xx));
Phi=zeros(m*l);
%%%%%%%%%%%%%%%%%%%%%%%%Iterate over wl%%%%%%%%%%%%%%%%%%%%%%%%%%
%Basic physical parameters—————————————–
lambdac=1030e-9;
dlambda=0.5e-9;
rcoreIni=5e-6;
rclad=125e-6;
nbg=1;
neff=[];
lambdac0=1000e-9;
lambdacmax=1600e-9;
psi=[];
for lambda0=lambdac0:50e-9:lambdacmax%lambdac-dlambda:dlambda:lambdac+dlambda
%n_SiO2=interp1(A(:,1)*1e-9,A(:,9),lambda0,’spline’); %-replaced because the Sellmeier filed is not attached and the issue is generalized to every wavelength
wl=lambdac0;
A1=0.6961663;
A2=0.4079426;
A3=0.8974794;
L1=0.0684043e-6;
L2=0.1162414e-6;
L3=9.896161e-6;
n_SiO2=sqrt(1+(A1*wl^2)/(wl^2-L1^2)+(A2*wl^2)/(wl^2-L2^2)+(A3*wl^2)/(wl^2-L3^2));
k0=2*pi/lambda0;
lambda0
%Initial design guess———————————————-
nmin=n_SiO2;
nmax=sqrt(0.14^2+n_SiO2^2);
nicore=nmax;%n_SiO2+0.36*n_SiO2;%n_SiO2+0.38;
niclad=nmin;%n_SiO2;
n=n*0+nbg;
n(xx.^2+yy.^2<rclad^2)=niclad;
n(xx.^2+yy.^2<rcoreIni^2)=nicore;
figure(1);
surf(xx,yy,n,’EdgeColor’,’none’);axis tight
%transform n———————————————————–
ni=[];
for iii=1:1:length(n)
ni=[ni;n(iii,:).’];
end
for ii=1:1:l*m
Phi(ii,ii)=-4/d^2+ni(ii)^2*k0^2;
if(ii-1>=1 && ii+1<=l*m)
Phi(ii-1,ii)=1/d^2;
Phi(ii,ii+1)=1/d^2;
Phi(ii+1,ii)=1/d^2;
Phi(ii,ii-1)=1/d^2;
end
if(ii-m>=1)
Phi(ii,ii-m)=1/d^2;
end
if(ii+m<=l*m)
Phi(ii,ii+m)=1/d^2;
end
if(ii>=l*(m-1))%right hand side
Phi(ii,ii)=Phi(ii,ii)+1/d^2;
end
if(mod(ii,m)==0)%bottom side
Phi(ii,ii)=Phi(ii,ii)+1/d^2;
end
end
%%Eigenvalues calc————————————————–
Phi=sparse(Phi);
%%solving
opts.maxit = 1000;
opts.tol = 1e-9;
[eigenvector,eigenvalues,flag]=eigs(Phi,10,(1.45)^2*k0^2,opts);
beta2=diag(eigenvalues);
Psi=eigenvector;
neff=[neff max(sqrt(beta2)./k0)];
psi=[psi Psi(:,1)];
end
%mode field visual——————————————————-
for iii=1:1:5
Pssi=[];
for jj=1:1:l
Pssi=[Pssi; Psi((jj-1)*l+1:jj*l,iii).’];
end
figure(iii+2);
surf(xx,yy,abs(Pssi).^2,’EdgeColor’,’none’);view(2);
end
lm=lambdac0:50e-9:lambdacmax;
figure(2)
hold on
plot(lm,neff);
hold off
Am I wrong code wise, theory wise or both??
Thanks a lot! I am trying to increase the accuracy of my mode solver by reducing the size of the calculation space, to do that I apply Dirichlet and Neumann on the borders. Assuming the symmetry, solving for only the upper left side (picture below) gives me the whole field. So I apply Dirichlet on the right and top side and Neumann on the bottom and right side.
I solve with eigs the following system : where is a vector describing the whole field and is a symmetric matrix having the form :
Where b is defined as (d is the distance between two points) and a is defined as where n(xi,yi) is the value of n at the x,y position described by (i). The equation used to write the system is :
Defining Neumann Boundary condition as :
Rewriting the above equation for the bottom and left part of the field I evidence the fact that it only changes the coefficient a by a coefficient , so what I did is adding this coefficient to the matrix coefficient when I know it is a boundary, leading to :
if i modulo m is 0 ( for i=1,…,l*m and i=j ) it means I am on the bottom of the field so I add to the previous definition of
if i>=l*(m-1) it means I am on the right boundary of the field so I add to the previous definition of
The addition of this two condition supposedly take into account what happens on the bottom right corner adding . But there must be an issue whith the way I coded it or defined my boundaries since I do not get the same results as when I study the full field (and it is not just an accuracy issue). I plotted the difference between expected results and what I actually got below.
The code I used is as follow :
%%Function topology for DCF design
clear all
clc
format long
%stepIndex———————————————————
sizeX=10e-6;
sizeY=10e-6;
l=100;
m=100;
x=-linspace(0,sizeX,l);
y=linspace(0,sizeY,m);
d=abs(x(1)-x(2))
[xx,yy]=meshgrid(x,y);
n=zeros(size(xx));
Phi=zeros(m*l);
%%%%%%%%%%%%%%%%%%%%%%%%Iterate over wl%%%%%%%%%%%%%%%%%%%%%%%%%%
%Basic physical parameters—————————————–
lambdac=1030e-9;
dlambda=0.5e-9;
rcoreIni=5e-6;
rclad=125e-6;
nbg=1;
neff=[];
lambdac0=1000e-9;
lambdacmax=1600e-9;
psi=[];
for lambda0=lambdac0:50e-9:lambdacmax%lambdac-dlambda:dlambda:lambdac+dlambda
%n_SiO2=interp1(A(:,1)*1e-9,A(:,9),lambda0,’spline’); %-replaced because the Sellmeier filed is not attached and the issue is generalized to every wavelength
wl=lambdac0;
A1=0.6961663;
A2=0.4079426;
A3=0.8974794;
L1=0.0684043e-6;
L2=0.1162414e-6;
L3=9.896161e-6;
n_SiO2=sqrt(1+(A1*wl^2)/(wl^2-L1^2)+(A2*wl^2)/(wl^2-L2^2)+(A3*wl^2)/(wl^2-L3^2));
k0=2*pi/lambda0;
lambda0
%Initial design guess———————————————-
nmin=n_SiO2;
nmax=sqrt(0.14^2+n_SiO2^2);
nicore=nmax;%n_SiO2+0.36*n_SiO2;%n_SiO2+0.38;
niclad=nmin;%n_SiO2;
n=n*0+nbg;
n(xx.^2+yy.^2<rclad^2)=niclad;
n(xx.^2+yy.^2<rcoreIni^2)=nicore;
figure(1);
surf(xx,yy,n,’EdgeColor’,’none’);axis tight
%transform n———————————————————–
ni=[];
for iii=1:1:length(n)
ni=[ni;n(iii,:).’];
end
for ii=1:1:l*m
Phi(ii,ii)=-4/d^2+ni(ii)^2*k0^2;
if(ii-1>=1 && ii+1<=l*m)
Phi(ii-1,ii)=1/d^2;
Phi(ii,ii+1)=1/d^2;
Phi(ii+1,ii)=1/d^2;
Phi(ii,ii-1)=1/d^2;
end
if(ii-m>=1)
Phi(ii,ii-m)=1/d^2;
end
if(ii+m<=l*m)
Phi(ii,ii+m)=1/d^2;
end
if(ii>=l*(m-1))%right hand side
Phi(ii,ii)=Phi(ii,ii)+1/d^2;
end
if(mod(ii,m)==0)%bottom side
Phi(ii,ii)=Phi(ii,ii)+1/d^2;
end
end
%%Eigenvalues calc————————————————–
Phi=sparse(Phi);
%%solving
opts.maxit = 1000;
opts.tol = 1e-9;
[eigenvector,eigenvalues,flag]=eigs(Phi,10,(1.45)^2*k0^2,opts);
beta2=diag(eigenvalues);
Psi=eigenvector;
neff=[neff max(sqrt(beta2)./k0)];
psi=[psi Psi(:,1)];
end
%mode field visual——————————————————-
for iii=1:1:5
Pssi=[];
for jj=1:1:l
Pssi=[Pssi; Psi((jj-1)*l+1:jj*l,iii).’];
end
figure(iii+2);
surf(xx,yy,abs(Pssi).^2,’EdgeColor’,’none’);view(2);
end
lm=lambdac0:50e-9:lambdacmax;
figure(2)
hold on
plot(lm,neff);
hold off
Am I wrong code wise, theory wise or both??
Thanks a lot! neumann, matlab code MATLAB Answers — New Questions
tiledlayout(“vertical”) with multiple columns
Hi,
I want to create a figure with a tiledlayout("vertical") meaning that new rows can be added with nexttile() at a later time. However this layout should have multiple columns per row (the number of columns stays the same in each row – however I do not know how many rows will be added in the end). Do you know of a way how this is possible?
I tried nesting layouts but that didn’t work well – see following code:
ff = figure()
T=tiledlayout(ff, "vertical");
nexttile(T,[1,1]); axis off
t1=tiledlayout(T, "horizontal"); %first inner layout
nexttile(t1)
nexttile(t1)
nexttile(T); axis off
t2=tiledlayout(T, "horizontal"); %first inner layout
nexttile(t2)
Thanks a lot,
AndreasHi,
I want to create a figure with a tiledlayout("vertical") meaning that new rows can be added with nexttile() at a later time. However this layout should have multiple columns per row (the number of columns stays the same in each row – however I do not know how many rows will be added in the end). Do you know of a way how this is possible?
I tried nesting layouts but that didn’t work well – see following code:
ff = figure()
T=tiledlayout(ff, "vertical");
nexttile(T,[1,1]); axis off
t1=tiledlayout(T, "horizontal"); %first inner layout
nexttile(t1)
nexttile(t1)
nexttile(T); axis off
t2=tiledlayout(T, "horizontal"); %first inner layout
nexttile(t2)
Thanks a lot,
Andreas Hi,
I want to create a figure with a tiledlayout("vertical") meaning that new rows can be added with nexttile() at a later time. However this layout should have multiple columns per row (the number of columns stays the same in each row – however I do not know how many rows will be added in the end). Do you know of a way how this is possible?
I tried nesting layouts but that didn’t work well – see following code:
ff = figure()
T=tiledlayout(ff, "vertical");
nexttile(T,[1,1]); axis off
t1=tiledlayout(T, "horizontal"); %first inner layout
nexttile(t1)
nexttile(t1)
nexttile(T); axis off
t2=tiledlayout(T, "horizontal"); %first inner layout
nexttile(t2)
Thanks a lot,
Andreas graphics, tiledlayout MATLAB Answers — New Questions
Reading and plotting STL File
I’m trying to read a .stl file and plot its triangulated surface (from scratch).
%- Let’s storage the vertices in an array.
fid = fopen(‘Silla.stl’,’r’);
regex = ‘s*vertexs*([-]?(?:[0-9]*[.])?[0-9]+)s*([-]?(?:[0-9]*[.])?[0-9]+)s*([-]?(?:[0-9]*[.])?[0-9]+)’;
line_ex = fgetl(fid);
i = 1;
j = 1;
while ~feof(fid)
line_ex = fgetl(fid);
if regexp(line_ex,regex)
toks = regexp(line_ex, regex, ‘tokens’);
%- Points
p{i,1} = str2double(toks{:}{1});
p{i,2} = str2double(toks{:}{3});
p{i,3} = str2double(toks{:}{2});
%p{i,4} = 1;
%- Counter
i = i + 1;
end
end
fclose(fid);
%- Indices.
k = 1;
for j = 1:(size(p,1)/3)
t{j,1} = k;
t{j,2} = k+1;
t{j,3} = k+2;
k = k + 3;
end
what I wanna do is plot triangle by triangle.
I’ve already tried it with trisurf, plot3 and fill3, but I have not seen results.
Any ideas?I’m trying to read a .stl file and plot its triangulated surface (from scratch).
%- Let’s storage the vertices in an array.
fid = fopen(‘Silla.stl’,’r’);
regex = ‘s*vertexs*([-]?(?:[0-9]*[.])?[0-9]+)s*([-]?(?:[0-9]*[.])?[0-9]+)s*([-]?(?:[0-9]*[.])?[0-9]+)’;
line_ex = fgetl(fid);
i = 1;
j = 1;
while ~feof(fid)
line_ex = fgetl(fid);
if regexp(line_ex,regex)
toks = regexp(line_ex, regex, ‘tokens’);
%- Points
p{i,1} = str2double(toks{:}{1});
p{i,2} = str2double(toks{:}{3});
p{i,3} = str2double(toks{:}{2});
%p{i,4} = 1;
%- Counter
i = i + 1;
end
end
fclose(fid);
%- Indices.
k = 1;
for j = 1:(size(p,1)/3)
t{j,1} = k;
t{j,2} = k+1;
t{j,3} = k+2;
k = k + 3;
end
what I wanna do is plot triangle by triangle.
I’ve already tried it with trisurf, plot3 and fill3, but I have not seen results.
Any ideas? I’m trying to read a .stl file and plot its triangulated surface (from scratch).
%- Let’s storage the vertices in an array.
fid = fopen(‘Silla.stl’,’r’);
regex = ‘s*vertexs*([-]?(?:[0-9]*[.])?[0-9]+)s*([-]?(?:[0-9]*[.])?[0-9]+)s*([-]?(?:[0-9]*[.])?[0-9]+)’;
line_ex = fgetl(fid);
i = 1;
j = 1;
while ~feof(fid)
line_ex = fgetl(fid);
if regexp(line_ex,regex)
toks = regexp(line_ex, regex, ‘tokens’);
%- Points
p{i,1} = str2double(toks{:}{1});
p{i,2} = str2double(toks{:}{3});
p{i,3} = str2double(toks{:}{2});
%p{i,4} = 1;
%- Counter
i = i + 1;
end
end
fclose(fid);
%- Indices.
k = 1;
for j = 1:(size(p,1)/3)
t{j,1} = k;
t{j,2} = k+1;
t{j,3} = k+2;
k = k + 3;
end
what I wanna do is plot triangle by triangle.
I’ve already tried it with trisurf, plot3 and fill3, but I have not seen results.
Any ideas? stl MATLAB Answers — New Questions
Where is my License?
I have bought a license for MATLAB, Deep Learning Toolbox, Parallel Computing Toolbox, Statistics and Machine Learning Toolbox in 20 january 2022. But now I don’t see a license in my account.
License type is Home | Individual | PerpetualI have bought a license for MATLAB, Deep Learning Toolbox, Parallel Computing Toolbox, Statistics and Machine Learning Toolbox in 20 january 2022. But now I don’t see a license in my account.
License type is Home | Individual | Perpetual I have bought a license for MATLAB, Deep Learning Toolbox, Parallel Computing Toolbox, Statistics and Machine Learning Toolbox in 20 january 2022. But now I don’t see a license in my account.
License type is Home | Individual | Perpetual license MATLAB Answers — New Questions