Month: April 2026
Automating Microsoft 365 with PowerShell Version 23
The May 2026 Update for Automating Microsoft 365 with PowerShell

As is our normal practice, the Office 365 for IT Pros team has released the regular update for the Automating Microsoft 365 with PowerShell eBook in mid-month. This is update #23 for our PowerShell book. Current subscribers can download the latest PDF and EPUB files from Gumroad.com through their Gumroad account or by using the download link from their receipt. The paperback version of the book (available on an on-demand print basis from Amazon) has also been updated.
The Flexibility of PowerShell
As time progress, the value of understanding how to use the Microsoft Graph to interact with Microsoft 365 workloads increase. Over the last month, I was asked to do some weird and wonderful things. A tenant suspected that people were scheduling and attending single-user Teams meetings to appear busy. Adapting the code from an article describing how to report details of Teams meetings solved that problem (and as it turned out, people were doing what the company suspected). Another question involved a company that uses the calendars of shared mailboxes to schedule vehicles (for example, an engineer needs a car to visit a facility). The ask was to analyze the bookings for vehicles to understand if the fleet needed to be augmented or reduced. Well, a calendar is a calendar, and the script to analyze conference room bookings proved a great base for developing the script to analyze the use of company vehicles.
However, the script that gave me most pleasure was the one developed to help chapter authors for the Office 365 for IT Pros eBook keep on top of developments within Microsoft 365. We synchronize a Planner plan with messages posted in the Microsoft 365 admin center and assign each message to an author. The author then considers whether the change described in the message is something that affects the content of their chapter, and if so, makes the necessary adjustments to the text. It’s a simple system that has served us well for years.
The problem is that authors can overlook assigned tasks (to be honest, I have 52 open tasks at present), so we created a script to find and send a listing of open tasks to authors. The script executes as an Azure Automation runbook, and all authors receive an email detailing their open tasks every Saturday morning. Time will tell if this tactic reduces the number of open tasks, but things are looking up. I hope that the change reported in MC1282308 (16 April 2026) describing changes to message center headings won’t affect the synchronization process.
All of this proves that searching for existing code examples can pay big time before sitting down to write new code, even with the help of AI tools.
Updates to PowerShell Modules
In terms of new releases for major Microsoft 365 PowerShell modules, we’ve only seen an update for the Microsoft Teams module (to V7.7) in the last month. Microsoft said that they improved the performance of the Get-Team cmdlet and the claim appears to be accurate. I tend to use the Get-MgTeam cmdlet rather that Get-Team, but it’s good to see Microsoft paying attention to performance of a cmdlet that features in many scripts.
The SharePoint Online management module moved to version 16.0.27111.12000 to keep track of changes being made to SharePoint tenant settings. However, the SharePoint module remains focused on Windows PowerShell rather than PowerShell Core, which is disappointing.
Keep on Learning
When we split the content that became Automating Microsoft 365 with PowerShell from the “big” Office 365 for IT Pros eBook, I never anticipated that our PowerShell book would take a life of its own and stretch to more than 400 pages of content. With more information about using Graph APIs effectively becoming available all the time, who knows how big the book might become. On to version 24…
App Designer keeps adding multiple Instances of EditFields with the same name on startup
Hello Everyone!
I am having a strange problem with the app designer right now:
Every time I start the app designer and load the .mlapp-File of the Project I’m currently working on, there are multiple instances of the same EditField created. It began with only one copy of an EditField I manually added on the GUI. I didn’t think much about it and simply deleted the second instance. But it seems like this problem has grown exponentially with every start of app designer. Now, when I open up my Project 500 (!!) EditFields with the same name are created! ‘Simply’ deleting all of them is obviously not anymore an acceptable workaround – especially since ‘ctrl+a’ doesn’t work in the Component Browser and you have to selected them all manually…
I have no idea why the app designer creates these multiple instances on the startup – after I deleted all multiple instances, they also didn’t appear in the non-editable Function ‘createComponents(app)’ anymore.
Does anyone of you have an idea on that? Where in my code could be a bug causing this phenomenon? Or could this be an appdesigner-internal bug? The project itself is already quite big with ~260 components even without those multiple and unwanted EditFields…
I’m desperately looking for your help! Thanks a lot in advance.Hello Everyone!
I am having a strange problem with the app designer right now:
Every time I start the app designer and load the .mlapp-File of the Project I’m currently working on, there are multiple instances of the same EditField created. It began with only one copy of an EditField I manually added on the GUI. I didn’t think much about it and simply deleted the second instance. But it seems like this problem has grown exponentially with every start of app designer. Now, when I open up my Project 500 (!!) EditFields with the same name are created! ‘Simply’ deleting all of them is obviously not anymore an acceptable workaround – especially since ‘ctrl+a’ doesn’t work in the Component Browser and you have to selected them all manually…
I have no idea why the app designer creates these multiple instances on the startup – after I deleted all multiple instances, they also didn’t appear in the non-editable Function ‘createComponents(app)’ anymore.
Does anyone of you have an idea on that? Where in my code could be a bug causing this phenomenon? Or could this be an appdesigner-internal bug? The project itself is already quite big with ~260 components even without those multiple and unwanted EditFields…
I’m desperately looking for your help! Thanks a lot in advance. Hello Everyone!
I am having a strange problem with the app designer right now:
Every time I start the app designer and load the .mlapp-File of the Project I’m currently working on, there are multiple instances of the same EditField created. It began with only one copy of an EditField I manually added on the GUI. I didn’t think much about it and simply deleted the second instance. But it seems like this problem has grown exponentially with every start of app designer. Now, when I open up my Project 500 (!!) EditFields with the same name are created! ‘Simply’ deleting all of them is obviously not anymore an acceptable workaround – especially since ‘ctrl+a’ doesn’t work in the Component Browser and you have to selected them all manually…
I have no idea why the app designer creates these multiple instances on the startup – after I deleted all multiple instances, they also didn’t appear in the non-editable Function ‘createComponents(app)’ anymore.
Does anyone of you have an idea on that? Where in my code could be a bug causing this phenomenon? Or could this be an appdesigner-internal bug? The project itself is already quite big with ~260 components even without those multiple and unwanted EditFields…
I’m desperately looking for your help! Thanks a lot in advance. appdesigner, gui MATLAB Answers — New Questions
Signal logging for evaluation episode during RL training
I am training a DDPG agent using a simulink environment. I want to log the last (final) value of a specific signal for every evaluation episode, e.g., if there are 10 evaluation episodes then I will have 10 values, possibly in the form of an array. The agent is unaware of this signal. How can I do this?I am training a DDPG agent using a simulink environment. I want to log the last (final) value of a specific signal for every evaluation episode, e.g., if there are 10 evaluation episodes then I will have 10 values, possibly in the form of an array. The agent is unaware of this signal. How can I do this? I am training a DDPG agent using a simulink environment. I want to log the last (final) value of a specific signal for every evaluation episode, e.g., if there are 10 evaluation episodes then I will have 10 values, possibly in the form of an array. The agent is unaware of this signal. How can I do this? simulink, reinforcement learning MATLAB Answers — New Questions
textscatter example, and behavior, is mysterious
The code for the textscatter example at
textscatter – 2-D scatter plot of text – MATLAB
looks like it should produce text at those random points. Instead the figure there shows some text in unusual places, some points that dont belong to any specific label, and in general, the whole thing is mysterious.The code for the textscatter example at
textscatter – 2-D scatter plot of text – MATLAB
looks like it should produce text at those random points. Instead the figure there shows some text in unusual places, some points that dont belong to any specific label, and in general, the whole thing is mysterious. The code for the textscatter example at
textscatter – 2-D scatter plot of text – MATLAB
looks like it should produce text at those random points. Instead the figure there shows some text in unusual places, some points that dont belong to any specific label, and in general, the whole thing is mysterious. textscatter MATLAB Answers — New Questions
Axis not held using hold command in plot3
I need to plot 2 3d points: x1, y1, z1 and x2, y2, z2 on the same axis. When using plot3 I only get the second marker while using plot3 for each point. When using one command for both points I get only one marker.I need to plot 2 3d points: x1, y1, z1 and x2, y2, z2 on the same axis. When using plot3 I only get the second marker while using plot3 for each point. When using one command for both points I get only one marker. I need to plot 2 3d points: x1, y1, z1 and x2, y2, z2 on the same axis. When using plot3 I only get the second marker while using plot3 for each point. When using one command for both points I get only one marker. hold, plot3 MATLAB Answers — New Questions
Can different sample times be used for fair torque ripple comparison?
Hello,
I am comparing two control strategies: one with fixed switching frequency and another with variable switching frequency.
Is it acceptable to use different powergui or sample times for each method so that both operate at a similar switching frequency range before comparing torque ripple?
Or should the same sample time always be used for both methods, even if their switching frequencies become very different?
Thank you.Hello,
I am comparing two control strategies: one with fixed switching frequency and another with variable switching frequency.
Is it acceptable to use different powergui or sample times for each method so that both operate at a similar switching frequency range before comparing torque ripple?
Or should the same sample time always be used for both methods, even if their switching frequencies become very different?
Thank you. Hello,
I am comparing two control strategies: one with fixed switching frequency and another with variable switching frequency.
Is it acceptable to use different powergui or sample times for each method so that both operate at a similar switching frequency range before comparing torque ripple?
Or should the same sample time always be used for both methods, even if their switching frequencies become very different?
Thank you. powergui, simulink, sample time, switching frequency MATLAB Answers — New Questions
How to build a BESS model phasor system
The examples above in MATLAB all produce BESS sets in discrete mode. I want to build a BESS set in phasor mode but don’t know how to do it because the battery block only allows running in discrete mode. I am very confused. Please help me.The examples above in MATLAB all produce BESS sets in discrete mode. I want to build a BESS set in phasor mode but don’t know how to do it because the battery block only allows running in discrete mode. I am very confused. Please help me. The examples above in MATLAB all produce BESS sets in discrete mode. I want to build a BESS set in phasor mode but don’t know how to do it because the battery block only allows running in discrete mode. I am very confused. Please help me. battery_system_management, bess phasor, battery phasor MATLAB Answers — New Questions
computation of symbolic terms and error analysis
tic
syms x y m %alpha beta b lambda eta phi
phi=sqrt(0.5)
b=10
eta=1
alpha=2;
beta=1;
T=zeros(1,2,’sym’);
G=zeros(1,2,’sym’);
A=zeros(1,’sym’);
B=zeros(1,’sym’);
C=zeros(1,’sym’);
D=zeros(1,’sym’);
E=zeros(1,’sym’);
F=zeros(1,’sym’);
G_val=zeros(1,’sym’);
series(x)=sym(zeros(1,1));
series1(x)=sym(zeros(1,1));
% Transform Initial condition
T(1)=m;
T(2)=0;
% Initial transform value of exp function
for i=1:4
G(i)=y;
if i==1
E(1)=exp((eta*T(1))/(eta+T(1)));
else
A(1)=0;
for j=1:i-1
E(i)=A(1)+(j/(i-1))*G(j)*E(i-j);
end
B(1)=0;
for j=1:i
B(1)=B(1)+T(j)*G(i-j+1);
end
eq1=G(i)-T(i)+(1/eta)*B(1);
G_val=simplify(solve(eq1,y));
G(i)=simplify(G_val);
E_val=subs(E(i),y,G_val);
E(i)=E_val
end
C(1)=0
for r=1:i
C(1)=C(1)+T(r)*E(i-r+1);
end
T(i + alpha*beta) = (phi^2*C(1)-b*phi^2*E(i))*(gamma(1+(sym(i-1)/beta))/gamma(1+alpha+(sym(i-1)/beta)));
%T(i+2)=simplify((1/(i*(i+1)))*(phi^2*C(1)-b*phi^2*E(i)));
end
for k=1:3
series(x)=simplify(series(x)+T(k)*(power(x,((k-1)*beta))));
end
series
e1=subs(series,x,1);
format long
accuracy=input(‘enter the accuracy’)
f=e1(x)
g=inline(f)
a=input(‘enter the ist approximation=’)
b=input(‘enter the 2nd approximation=’)
fa=feval(g,a)
fb=feval(g,b)
while fa*fb>0
a=input(‘enter the ist approximation=’)
b=input(‘enter the 2nd approximation=’)
fa=feval(g,a)
fb=feval(g,b)
end
for i=1:50
c=(a+b)/2;
fc=feval(g,c);
disp([i a fa b fb c fc abs(b-a)])
if fc==accuracy
fprintf(‘the root of the equation is %f’,c)
break;
elseif abs(b-a)<=accuracy
fprintf(‘the root of the equation is %f’,c)
break;
elseif fa*fc<=0
b=c;
fb=fc;
else
a=c;
fa=fc;
end
end
fprintf(‘the value of c=%f’, c);
series1(x)=subs(series,m,c)
residualError=sym(zeros(1,1));
residual=sym(zeros(1,1));
residualError(x) = abs(diff(series1,x,2)+ B*phi^2*(1-(series1)/B)*exp((eta*series1)/(eta+series1)))
residual_error=double(subs(residualError,x,0.2))
var =double(residual_error);
x=0:0.1:1
error=zeros(1)
row=0;
for i=1:length(x)
row=row+1;
error(row)=(residualErrorx(i))
max_error=max(error)
end
fprintf(‘The residual error is %fn’, max_error);
%—————————————————————–
the error appear as Error using mupadengine/evalin2double
Unable to convert expression containing symbolic variables into double array. Apply ‘subs’ function first to substitute values for variables.
Error in mupadengine/feval2double
Error in sym/double (line 756)
X = feval2double(symengine, "symobj::doubleDirect", S);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Related documentation
now i substutite the value of m using sysntax series1(x)=subs(series,m,c) but when i later on call series 1 in line residualError(x) = abs(diff(series1,x,2)+ B*phi^2*(1-(series1)/B)*exp((eta*series1)/(eta+series1))) the final expression is having m and y . That is symbolic and craet an errortic
syms x y m %alpha beta b lambda eta phi
phi=sqrt(0.5)
b=10
eta=1
alpha=2;
beta=1;
T=zeros(1,2,’sym’);
G=zeros(1,2,’sym’);
A=zeros(1,’sym’);
B=zeros(1,’sym’);
C=zeros(1,’sym’);
D=zeros(1,’sym’);
E=zeros(1,’sym’);
F=zeros(1,’sym’);
G_val=zeros(1,’sym’);
series(x)=sym(zeros(1,1));
series1(x)=sym(zeros(1,1));
% Transform Initial condition
T(1)=m;
T(2)=0;
% Initial transform value of exp function
for i=1:4
G(i)=y;
if i==1
E(1)=exp((eta*T(1))/(eta+T(1)));
else
A(1)=0;
for j=1:i-1
E(i)=A(1)+(j/(i-1))*G(j)*E(i-j);
end
B(1)=0;
for j=1:i
B(1)=B(1)+T(j)*G(i-j+1);
end
eq1=G(i)-T(i)+(1/eta)*B(1);
G_val=simplify(solve(eq1,y));
G(i)=simplify(G_val);
E_val=subs(E(i),y,G_val);
E(i)=E_val
end
C(1)=0
for r=1:i
C(1)=C(1)+T(r)*E(i-r+1);
end
T(i + alpha*beta) = (phi^2*C(1)-b*phi^2*E(i))*(gamma(1+(sym(i-1)/beta))/gamma(1+alpha+(sym(i-1)/beta)));
%T(i+2)=simplify((1/(i*(i+1)))*(phi^2*C(1)-b*phi^2*E(i)));
end
for k=1:3
series(x)=simplify(series(x)+T(k)*(power(x,((k-1)*beta))));
end
series
e1=subs(series,x,1);
format long
accuracy=input(‘enter the accuracy’)
f=e1(x)
g=inline(f)
a=input(‘enter the ist approximation=’)
b=input(‘enter the 2nd approximation=’)
fa=feval(g,a)
fb=feval(g,b)
while fa*fb>0
a=input(‘enter the ist approximation=’)
b=input(‘enter the 2nd approximation=’)
fa=feval(g,a)
fb=feval(g,b)
end
for i=1:50
c=(a+b)/2;
fc=feval(g,c);
disp([i a fa b fb c fc abs(b-a)])
if fc==accuracy
fprintf(‘the root of the equation is %f’,c)
break;
elseif abs(b-a)<=accuracy
fprintf(‘the root of the equation is %f’,c)
break;
elseif fa*fc<=0
b=c;
fb=fc;
else
a=c;
fa=fc;
end
end
fprintf(‘the value of c=%f’, c);
series1(x)=subs(series,m,c)
residualError=sym(zeros(1,1));
residual=sym(zeros(1,1));
residualError(x) = abs(diff(series1,x,2)+ B*phi^2*(1-(series1)/B)*exp((eta*series1)/(eta+series1)))
residual_error=double(subs(residualError,x,0.2))
var =double(residual_error);
x=0:0.1:1
error=zeros(1)
row=0;
for i=1:length(x)
row=row+1;
error(row)=(residualErrorx(i))
max_error=max(error)
end
fprintf(‘The residual error is %fn’, max_error);
%—————————————————————–
the error appear as Error using mupadengine/evalin2double
Unable to convert expression containing symbolic variables into double array. Apply ‘subs’ function first to substitute values for variables.
Error in mupadengine/feval2double
Error in sym/double (line 756)
X = feval2double(symengine, "symobj::doubleDirect", S);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Related documentation
now i substutite the value of m using sysntax series1(x)=subs(series,m,c) but when i later on call series 1 in line residualError(x) = abs(diff(series1,x,2)+ B*phi^2*(1-(series1)/B)*exp((eta*series1)/(eta+series1))) the final expression is having m and y . That is symbolic and craet an error tic
syms x y m %alpha beta b lambda eta phi
phi=sqrt(0.5)
b=10
eta=1
alpha=2;
beta=1;
T=zeros(1,2,’sym’);
G=zeros(1,2,’sym’);
A=zeros(1,’sym’);
B=zeros(1,’sym’);
C=zeros(1,’sym’);
D=zeros(1,’sym’);
E=zeros(1,’sym’);
F=zeros(1,’sym’);
G_val=zeros(1,’sym’);
series(x)=sym(zeros(1,1));
series1(x)=sym(zeros(1,1));
% Transform Initial condition
T(1)=m;
T(2)=0;
% Initial transform value of exp function
for i=1:4
G(i)=y;
if i==1
E(1)=exp((eta*T(1))/(eta+T(1)));
else
A(1)=0;
for j=1:i-1
E(i)=A(1)+(j/(i-1))*G(j)*E(i-j);
end
B(1)=0;
for j=1:i
B(1)=B(1)+T(j)*G(i-j+1);
end
eq1=G(i)-T(i)+(1/eta)*B(1);
G_val=simplify(solve(eq1,y));
G(i)=simplify(G_val);
E_val=subs(E(i),y,G_val);
E(i)=E_val
end
C(1)=0
for r=1:i
C(1)=C(1)+T(r)*E(i-r+1);
end
T(i + alpha*beta) = (phi^2*C(1)-b*phi^2*E(i))*(gamma(1+(sym(i-1)/beta))/gamma(1+alpha+(sym(i-1)/beta)));
%T(i+2)=simplify((1/(i*(i+1)))*(phi^2*C(1)-b*phi^2*E(i)));
end
for k=1:3
series(x)=simplify(series(x)+T(k)*(power(x,((k-1)*beta))));
end
series
e1=subs(series,x,1);
format long
accuracy=input(‘enter the accuracy’)
f=e1(x)
g=inline(f)
a=input(‘enter the ist approximation=’)
b=input(‘enter the 2nd approximation=’)
fa=feval(g,a)
fb=feval(g,b)
while fa*fb>0
a=input(‘enter the ist approximation=’)
b=input(‘enter the 2nd approximation=’)
fa=feval(g,a)
fb=feval(g,b)
end
for i=1:50
c=(a+b)/2;
fc=feval(g,c);
disp([i a fa b fb c fc abs(b-a)])
if fc==accuracy
fprintf(‘the root of the equation is %f’,c)
break;
elseif abs(b-a)<=accuracy
fprintf(‘the root of the equation is %f’,c)
break;
elseif fa*fc<=0
b=c;
fb=fc;
else
a=c;
fa=fc;
end
end
fprintf(‘the value of c=%f’, c);
series1(x)=subs(series,m,c)
residualError=sym(zeros(1,1));
residual=sym(zeros(1,1));
residualError(x) = abs(diff(series1,x,2)+ B*phi^2*(1-(series1)/B)*exp((eta*series1)/(eta+series1)))
residual_error=double(subs(residualError,x,0.2))
var =double(residual_error);
x=0:0.1:1
error=zeros(1)
row=0;
for i=1:length(x)
row=row+1;
error(row)=(residualErrorx(i))
max_error=max(error)
end
fprintf(‘The residual error is %fn’, max_error);
%—————————————————————–
the error appear as Error using mupadengine/evalin2double
Unable to convert expression containing symbolic variables into double array. Apply ‘subs’ function first to substitute values for variables.
Error in mupadengine/feval2double
Error in sym/double (line 756)
X = feval2double(symengine, "symobj::doubleDirect", S);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Related documentation
now i substutite the value of m using sysntax series1(x)=subs(series,m,c) but when i later on call series 1 in line residualError(x) = abs(diff(series1,x,2)+ B*phi^2*(1-(series1)/B)*exp((eta*series1)/(eta+series1))) the final expression is having m and y . That is symbolic and craet an error symbolic compuational MATLAB Answers — New Questions
Why in 2025a figure Export Setup have been removed?
Good morning to everyone,
I have just bought a new laptop, downloaded 2025a, opened a figure I created with 2024b and BOOM I realized (with great regret!) that the "Figure Export Setup" have been removed…
In my academic and professional experience it was an essential feature to produce figures and plots in line with the specific request (journal article, technical report, presentation etc..) and coherent throughout the work for whant concerns font size, figure dimensions and features.
I know that now there’s the "uiexportdlg" https://www.mathworks.com/help/releases/R2025a/matlab/ref/uiexportdlg.html but, in my humble opinion, there is no comparison at all. Is there a way to be able to save profiles for the export of figures as was done in the old “File” > “Export Setup” mode? And, above all, does anyone know the reason why this feature was removed? I simply can’t get the point about it.
I’m not the reactionary kind of software users, but I’m seriously thinking about switching back to 2024b.Good morning to everyone,
I have just bought a new laptop, downloaded 2025a, opened a figure I created with 2024b and BOOM I realized (with great regret!) that the "Figure Export Setup" have been removed…
In my academic and professional experience it was an essential feature to produce figures and plots in line with the specific request (journal article, technical report, presentation etc..) and coherent throughout the work for whant concerns font size, figure dimensions and features.
I know that now there’s the "uiexportdlg" https://www.mathworks.com/help/releases/R2025a/matlab/ref/uiexportdlg.html but, in my humble opinion, there is no comparison at all. Is there a way to be able to save profiles for the export of figures as was done in the old “File” > “Export Setup” mode? And, above all, does anyone know the reason why this feature was removed? I simply can’t get the point about it.
I’m not the reactionary kind of software users, but I’m seriously thinking about switching back to 2024b. Good morning to everyone,
I have just bought a new laptop, downloaded 2025a, opened a figure I created with 2024b and BOOM I realized (with great regret!) that the "Figure Export Setup" have been removed…
In my academic and professional experience it was an essential feature to produce figures and plots in line with the specific request (journal article, technical report, presentation etc..) and coherent throughout the work for whant concerns font size, figure dimensions and features.
I know that now there’s the "uiexportdlg" https://www.mathworks.com/help/releases/R2025a/matlab/ref/uiexportdlg.html but, in my humble opinion, there is no comparison at all. Is there a way to be able to save profiles for the export of figures as was done in the old “File” > “Export Setup” mode? And, above all, does anyone know the reason why this feature was removed? I simply can’t get the point about it.
I’m not the reactionary kind of software users, but I’m seriously thinking about switching back to 2024b. figure export setup MATLAB Answers — New Questions
Can you get matlab to add a really small number to a big number and retain precision
I am trying to calculate small numbers from equations like the one below.
p = -1e17 + sqrt(1e34 + 1e18)
I have tried using ‘vpa(-1e17 + sqrt(1e34 + 1e18), 30) but the output always comes out as p = 0.0. But p is not exactly zero and this propagates errors in subsequent calculations that involve p. Is there another way to retain sig figs to avoid rounding errors?I am trying to calculate small numbers from equations like the one below.
p = -1e17 + sqrt(1e34 + 1e18)
I have tried using ‘vpa(-1e17 + sqrt(1e34 + 1e18), 30) but the output always comes out as p = 0.0. But p is not exactly zero and this propagates errors in subsequent calculations that involve p. Is there another way to retain sig figs to avoid rounding errors? I am trying to calculate small numbers from equations like the one below.
p = -1e17 + sqrt(1e34 + 1e18)
I have tried using ‘vpa(-1e17 + sqrt(1e34 + 1e18), 30) but the output always comes out as p = 0.0. But p is not exactly zero and this propagates errors in subsequent calculations that involve p. Is there another way to retain sig figs to avoid rounding errors? precision, digits MATLAB Answers — New Questions
How do I create a protected model with hidden variables with a mask that provides additional variables?
How do I create a protected model with hidden variables with a mask that provides additional variables? I want to hide the variables I provide to Simulink that would otherwise appear in the base (MATLAB) workspace.How do I create a protected model with hidden variables with a mask that provides additional variables? I want to hide the variables I provide to Simulink that would otherwise appear in the base (MATLAB) workspace. How do I create a protected model with hidden variables with a mask that provides additional variables? I want to hide the variables I provide to Simulink that would otherwise appear in the base (MATLAB) workspace. parameters, mask, modelreference, protected MATLAB Answers — New Questions
Why does backslash behave differently when transposition is used in-line?
Hello, in the process of creating a problem for my students in a numerical methods class I found out that the backslash operation produces different results if you solve A^{T}x=b as "x=(A’)b" when compared to first defining "AT=A’" and then solving as "x=ATb". An example is given below. Order of operations suggests that in the first case, A should be transposed and then the backslash operation performed, which is forced in the second case. One would expect the results to then be the same. Why is there a difference at all?
n = 15;
m = 2*n+1;
t = fliplr(cos(pi/(n)*(0:n))).’;
A = [t.^(0:m);
t.^([0,0:m-1])*diag(max(0,0:m))];
b = (1./((0:m)’+1).*((1).^((0:m)’+1)-(-1).^(((0:m)’+1))));
x = (A’)b;
AT = A’;
x2 = ATb;
difference = norm(x-x2)Hello, in the process of creating a problem for my students in a numerical methods class I found out that the backslash operation produces different results if you solve A^{T}x=b as "x=(A’)b" when compared to first defining "AT=A’" and then solving as "x=ATb". An example is given below. Order of operations suggests that in the first case, A should be transposed and then the backslash operation performed, which is forced in the second case. One would expect the results to then be the same. Why is there a difference at all?
n = 15;
m = 2*n+1;
t = fliplr(cos(pi/(n)*(0:n))).’;
A = [t.^(0:m);
t.^([0,0:m-1])*diag(max(0,0:m))];
b = (1./((0:m)’+1).*((1).^((0:m)’+1)-(-1).^(((0:m)’+1))));
x = (A’)b;
AT = A’;
x2 = ATb;
difference = norm(x-x2) Hello, in the process of creating a problem for my students in a numerical methods class I found out that the backslash operation produces different results if you solve A^{T}x=b as "x=(A’)b" when compared to first defining "AT=A’" and then solving as "x=ATb". An example is given below. Order of operations suggests that in the first case, A should be transposed and then the backslash operation performed, which is forced in the second case. One would expect the results to then be the same. Why is there a difference at all?
n = 15;
m = 2*n+1;
t = fliplr(cos(pi/(n)*(0:n))).’;
A = [t.^(0:m);
t.^([0,0:m-1])*diag(max(0,0:m))];
b = (1./((0:m)’+1).*((1).^((0:m)’+1)-(-1).^(((0:m)’+1))));
x = (A’)b;
AT = A’;
x2 = ATb;
difference = norm(x-x2) backslash, transpose MATLAB Answers — New Questions
Phase unwrapping in 2D
I need to perform phase unwrapping in 2D using MATLAB, but the unwrap function seems to work only in 1D.
I want to have a routine similar to this one, available in a Python library:
http://scikit-image.org/docs/dev/auto_examples/filters/plot_phase_unwrap.html
Any suggestions?I need to perform phase unwrapping in 2D using MATLAB, but the unwrap function seems to work only in 1D.
I want to have a routine similar to this one, available in a Python library:
http://scikit-image.org/docs/dev/auto_examples/filters/plot_phase_unwrap.html
Any suggestions? I need to perform phase unwrapping in 2D using MATLAB, but the unwrap function seems to work only in 1D.
I want to have a routine similar to this one, available in a Python library:
http://scikit-image.org/docs/dev/auto_examples/filters/plot_phase_unwrap.html
Any suggestions? matlab, image analysis, signal processing MATLAB Answers — New Questions
Improving How Outlook Classic Handles Reactions
Reactions For All Types of Microsoft 365 Messages
The announcement about “Improved handling of disallowed and failed email reactions” for Outlook (MC1261593, 25 March 2026, Microsoft 365 roadmap item 558442) got me thinking about how reactions are transmitted and stored by Exchange Online.
Outlook reactions have been around since October 2022. Essentially, instead of responding to a message with another message (the reply), people can respond by selecting an appropriate emoji from a set chosen by Microsoft. You cannot add custom emojis. Figure 1 shows the UI from Outlook classic.

Viva Engage also supports reactions for its conversations, as does Teams, which allows users to select from any of the hundreds of emojis available in a tenant, including custom emojis. Teams even logs a special audit event when people use reactions, which means that it’s possible to report who uses emojis in responses.
Because they are properties of chat and channel messages, Teams also supports reactions via the Graph API. However, reactions are implemented as MAPI properties called MAPIReactionsBlob and ReactionsSummary stored in messages. These properties are not surfaced through the Graph API, which makes it harder to generate reports about the usage of reactions in Outlook.
Suppressing Outlook Reactions with a Transport Rule
Anyway, Exchange Online doesn’t engage in such frippery as customizable emojis for reactions, possibly because reactions can travel outside the tenant and you wouldn’t want custom emojis being shared far and wide. Expressing emotions just six ways is sufficient to convey a response in email. Unless of course you don’t want users to use reactions.
In this scenario, you should follow create a transport rule (mail flow rule) to suppress reactions. The rule sets a “x-ms-reactions” header in email to “disallow.” A transport rule like this does the job:
New-TransportRule –Name "Suppress Outlook Reactions" –Enabled $True –SetHeaderName "x-ms-reactions" -SetHeaderValue "disallow" -FromScope InOrganization –SentToScope InOrganization
The great benefit of transport rules is that Exchange Online runs the rules as messages pass through the transport pipeline en route to recipients. If a rule says that something should be done, it will be. Transport rules are a very effective choke point. In this case, the rule inserts the x-header into any message that it processes (different criteria can be applied to dictate which messages are processed). When Outlook clients display a message with the x-header, the clients should grey out the UI that allows users to respond with reactions. No UI, no responses.
Making Outlook Classic Behave
MC1261593 tell us that Outlook classic has not supported the x-header, which is why an update is needed. Figure 2 shows a message delivered to Outlook classic with the x-header set. The user can still respond with a reaction. For messages sent from the same tenant, people who use other Outlook clients like OWA or the New Outlook won’t see any reactions that are sent for their messages because of the x-header.

According to the notification, Microsoft will release an update in public preview to stop Outlook classic ignoring the x-header in early May 2026. Assuming that nothing problematic is discovered, Microsoft will proceed to update all tenants, including GCC, GCC-High, and DoD in June 2026.
All Change In June
Although my go-to client remains Outlook classic, I must admit that I don’t use reactions to respond to email and would therefore probably not notice that Outlook classic behaves differently to the other clients. After June that won’t be the case and if you’ve implemented a transport rule to insert the x-header to suppress reactions, people who use Outlook clients might notice a change in behavior. Then again, they might not. Or might not care.
Insight like this doesn’t come easily. You’ve got to know the technology and understand how to look behind the scenes. Benefit from the knowledge and experience of the Office 365 for IT Pros team by subscribing to the best eBook covering Office 365 and the wider Microsoft 365 ecosystem.
Input and output process data at different rate. How to match them.
My input sends data at 100ms and output receives at 1s. how do i create a system that collects 10 intevals of data and send it to output after 1 second. I dont want to use rate transition block. I want to use basic blocks. Can someone help me with answer?My input sends data at 100ms and output receives at 1s. how do i create a system that collects 10 intevals of data and send it to output after 1 second. I dont want to use rate transition block. I want to use basic blocks. Can someone help me with answer? My input sends data at 100ms and output receives at 1s. how do i create a system that collects 10 intevals of data and send it to output after 1 second. I dont want to use rate transition block. I want to use basic blocks. Can someone help me with answer? rate transition without using rate transition bloc MATLAB Answers — New Questions
Issue running HIL converting “Design a Guidance System in MATLAB and Simulink” guidance stateflow into HDL using HDL Coder
After set all the data into int16, by using HDL coder advisor i got this error message:
"Error:Error: HDL code generation from Stateflow failed: Entry event for state ‘Target_Search’ implied in ‘aero_guidance_model/Guidance/subsystem/Guidance Processor’. This is not allowed for an HDL target.
HDL code generation failed for ‘Guidance/subsystem/Guidance Processor’ (#59). Consult the Diagnostic Viewer for additional information."
Is it possible to convert the stateflow inside guidance subsystem into HDL for running hardware in the loop? Needing advice to call a stop or continue if its possible.
Example can be obtained https://www.mathworks.com/help/simulink/slref/designing-a-guidance-system-in-matlab-and-simulink.htmlAfter set all the data into int16, by using HDL coder advisor i got this error message:
"Error:Error: HDL code generation from Stateflow failed: Entry event for state ‘Target_Search’ implied in ‘aero_guidance_model/Guidance/subsystem/Guidance Processor’. This is not allowed for an HDL target.
HDL code generation failed for ‘Guidance/subsystem/Guidance Processor’ (#59). Consult the Diagnostic Viewer for additional information."
Is it possible to convert the stateflow inside guidance subsystem into HDL for running hardware in the loop? Needing advice to call a stop or continue if its possible.
Example can be obtained https://www.mathworks.com/help/simulink/slref/designing-a-guidance-system-in-matlab-and-simulink.html After set all the data into int16, by using HDL coder advisor i got this error message:
"Error:Error: HDL code generation from Stateflow failed: Entry event for state ‘Target_Search’ implied in ‘aero_guidance_model/Guidance/subsystem/Guidance Processor’. This is not allowed for an HDL target.
HDL code generation failed for ‘Guidance/subsystem/Guidance Processor’ (#59). Consult the Diagnostic Viewer for additional information."
Is it possible to convert the stateflow inside guidance subsystem into HDL for running hardware in the loop? Needing advice to call a stop or continue if its possible.
Example can be obtained https://www.mathworks.com/help/simulink/slref/designing-a-guidance-system-in-matlab-and-simulink.html hdl coder, hardware-in-the-loop MATLAB Answers — New Questions
BodePlot: Plotting straight lines on the Mag and Phase plots. Can access the phase plot, to do so, but not the mag plot
Hi there
I was customising the standard MATLAB Bode plot to make the gridlines, major and minor bold,
change the x and y label size and bold them and also customise the axis.
Then I tried to plot the straight line approximation, but I can only seem to access the phase plot, and not the magnitude plot.
For the two axes, ax(1) and ax(2), I have called them mag_ax and phase_ax.
I can access the other properties fine, but when I tries to add the lines, my code doesn’t recognise the mag_ax.
Any advice greatly appreciated
close all
s = tf(‘s’);
G_1 = tf(1/(0.1*s + 1));
figure(‘WindowState’,’maximized’);
gg = bodeplot(G_1);
title(‘Bode plot of $frac{1}{0.1s+1}$’,…
‘Interpreter’,’latex’,’FontSize’,18,’FontWeight’,’bold’);
gg.Responses.Color = "blue";
gg.Responses.LineWidth = 2;
gg.XLabel.FontWeight = "bold";
% Get the handles of the axes
ax = findobj(gcf,’type’,’axes’);
mag_ax = ax(1);
phase_ax = ax(2);
mag_ax.XLim = [0.1 1000];
mag_ax.YLim= [-60 +60];
phase_ax.XLim = [0.1 1000];
phase_ax.YLim= [-90 +90];
phase_ax.YTick = (-90:45:90);
grid on
grid minor
phase_ax.GridLineWidth = 1;
mag_ax.GridLineWidth = 1;
phase_ax.MinorGridLineStyle = ‘-‘;
mag_ax.MinorGridLineStyle = ‘-‘;
phase_ax.MinorGridLineWidth = 0.75;
mag_ax.MinorGridLineWidth = 0.75;
phase_ax.MinorGridAlpha = 0.5;
mag_ax.MinorGridAlpha = 0.5;
phase_ax.GridLineWidth = 1;
mag_ax.GridLineWidth = 1;
phase_ax.GridAlpha = 1;
mag_ax.GridAlpha = 1;
mag_ax.YLabel.FontWeight = "bold";
mag_ax.YLabel.FontSize = 12;
phase_ax.YLabel.FontWeight = "bold";
phase_ax.YLabel.FontSize = 12;
for k = 1:length(phase_ax)
xticks(phase_ax(k), [0.1 1 10 100 1000]); % Set desired tick positions
end
for k = 1:length(phase_ax)
phase_ax(k).XTickLabel = arrayfun(@(x) sprintf(‘%.1f’, x), phase_ax(k).XTick, ‘UniformOutput’, false);
end
set(phase_ax,’fontweight’,’bold’)
set(mag_ax,’fontweight’,’bold’)
gg.Responses.Visible = ‘on’;
gg.Responses.Color = ‘blue’;
mag_ax.NextPlot = ‘add’;
line([0.1 10.0],[0 0],’linewidth’,2,’color’,’red’);
line([10.0 1000],[0 -40],’linewidth’,2,’color’,’red’);
phase_ax.NextPlot = ‘add’;
line([0.1 1.0],[0 0],’linewidth’,2,’color’,’red’);
line([1.0 100],[0 -90],’linewidth’,2,’color’,’red’);
line([100 1000],[-90 -90],’linewidth’,2,’color’,’red’);Hi there
I was customising the standard MATLAB Bode plot to make the gridlines, major and minor bold,
change the x and y label size and bold them and also customise the axis.
Then I tried to plot the straight line approximation, but I can only seem to access the phase plot, and not the magnitude plot.
For the two axes, ax(1) and ax(2), I have called them mag_ax and phase_ax.
I can access the other properties fine, but when I tries to add the lines, my code doesn’t recognise the mag_ax.
Any advice greatly appreciated
close all
s = tf(‘s’);
G_1 = tf(1/(0.1*s + 1));
figure(‘WindowState’,’maximized’);
gg = bodeplot(G_1);
title(‘Bode plot of $frac{1}{0.1s+1}$’,…
‘Interpreter’,’latex’,’FontSize’,18,’FontWeight’,’bold’);
gg.Responses.Color = "blue";
gg.Responses.LineWidth = 2;
gg.XLabel.FontWeight = "bold";
% Get the handles of the axes
ax = findobj(gcf,’type’,’axes’);
mag_ax = ax(1);
phase_ax = ax(2);
mag_ax.XLim = [0.1 1000];
mag_ax.YLim= [-60 +60];
phase_ax.XLim = [0.1 1000];
phase_ax.YLim= [-90 +90];
phase_ax.YTick = (-90:45:90);
grid on
grid minor
phase_ax.GridLineWidth = 1;
mag_ax.GridLineWidth = 1;
phase_ax.MinorGridLineStyle = ‘-‘;
mag_ax.MinorGridLineStyle = ‘-‘;
phase_ax.MinorGridLineWidth = 0.75;
mag_ax.MinorGridLineWidth = 0.75;
phase_ax.MinorGridAlpha = 0.5;
mag_ax.MinorGridAlpha = 0.5;
phase_ax.GridLineWidth = 1;
mag_ax.GridLineWidth = 1;
phase_ax.GridAlpha = 1;
mag_ax.GridAlpha = 1;
mag_ax.YLabel.FontWeight = "bold";
mag_ax.YLabel.FontSize = 12;
phase_ax.YLabel.FontWeight = "bold";
phase_ax.YLabel.FontSize = 12;
for k = 1:length(phase_ax)
xticks(phase_ax(k), [0.1 1 10 100 1000]); % Set desired tick positions
end
for k = 1:length(phase_ax)
phase_ax(k).XTickLabel = arrayfun(@(x) sprintf(‘%.1f’, x), phase_ax(k).XTick, ‘UniformOutput’, false);
end
set(phase_ax,’fontweight’,’bold’)
set(mag_ax,’fontweight’,’bold’)
gg.Responses.Visible = ‘on’;
gg.Responses.Color = ‘blue’;
mag_ax.NextPlot = ‘add’;
line([0.1 10.0],[0 0],’linewidth’,2,’color’,’red’);
line([10.0 1000],[0 -40],’linewidth’,2,’color’,’red’);
phase_ax.NextPlot = ‘add’;
line([0.1 1.0],[0 0],’linewidth’,2,’color’,’red’);
line([1.0 100],[0 -90],’linewidth’,2,’color’,’red’);
line([100 1000],[-90 -90],’linewidth’,2,’color’,’red’); Hi there
I was customising the standard MATLAB Bode plot to make the gridlines, major and minor bold,
change the x and y label size and bold them and also customise the axis.
Then I tried to plot the straight line approximation, but I can only seem to access the phase plot, and not the magnitude plot.
For the two axes, ax(1) and ax(2), I have called them mag_ax and phase_ax.
I can access the other properties fine, but when I tries to add the lines, my code doesn’t recognise the mag_ax.
Any advice greatly appreciated
close all
s = tf(‘s’);
G_1 = tf(1/(0.1*s + 1));
figure(‘WindowState’,’maximized’);
gg = bodeplot(G_1);
title(‘Bode plot of $frac{1}{0.1s+1}$’,…
‘Interpreter’,’latex’,’FontSize’,18,’FontWeight’,’bold’);
gg.Responses.Color = "blue";
gg.Responses.LineWidth = 2;
gg.XLabel.FontWeight = "bold";
% Get the handles of the axes
ax = findobj(gcf,’type’,’axes’);
mag_ax = ax(1);
phase_ax = ax(2);
mag_ax.XLim = [0.1 1000];
mag_ax.YLim= [-60 +60];
phase_ax.XLim = [0.1 1000];
phase_ax.YLim= [-90 +90];
phase_ax.YTick = (-90:45:90);
grid on
grid minor
phase_ax.GridLineWidth = 1;
mag_ax.GridLineWidth = 1;
phase_ax.MinorGridLineStyle = ‘-‘;
mag_ax.MinorGridLineStyle = ‘-‘;
phase_ax.MinorGridLineWidth = 0.75;
mag_ax.MinorGridLineWidth = 0.75;
phase_ax.MinorGridAlpha = 0.5;
mag_ax.MinorGridAlpha = 0.5;
phase_ax.GridLineWidth = 1;
mag_ax.GridLineWidth = 1;
phase_ax.GridAlpha = 1;
mag_ax.GridAlpha = 1;
mag_ax.YLabel.FontWeight = "bold";
mag_ax.YLabel.FontSize = 12;
phase_ax.YLabel.FontWeight = "bold";
phase_ax.YLabel.FontSize = 12;
for k = 1:length(phase_ax)
xticks(phase_ax(k), [0.1 1 10 100 1000]); % Set desired tick positions
end
for k = 1:length(phase_ax)
phase_ax(k).XTickLabel = arrayfun(@(x) sprintf(‘%.1f’, x), phase_ax(k).XTick, ‘UniformOutput’, false);
end
set(phase_ax,’fontweight’,’bold’)
set(mag_ax,’fontweight’,’bold’)
gg.Responses.Visible = ‘on’;
gg.Responses.Color = ‘blue’;
mag_ax.NextPlot = ‘add’;
line([0.1 10.0],[0 0],’linewidth’,2,’color’,’red’);
line([10.0 1000],[0 -40],’linewidth’,2,’color’,’red’);
phase_ax.NextPlot = ‘add’;
line([0.1 1.0],[0 0],’linewidth’,2,’color’,’red’);
line([1.0 100],[0 -90],’linewidth’,2,’color’,’red’);
line([100 1000],[-90 -90],’linewidth’,2,’color’,’red’); bodeplot, matlab MATLAB Answers — New Questions
DLP Extends Its Ability to Control Copilot Processing
New DLP Policy for Copilot Action to Block Processing Web Searches
Recently, there’s been a spate of developments to bring Microsoft 365 content into OpenAI and Anthrophic for processing by external AI models. Microsoft is in a bit of a quandary when it comes to competing with OpenAI and Anthrophic. Microsoft badly wants to sell more Microsoft 365 Copilot licenses. At the same time, Microsoft 365 Copilot is dependent on OpenAI and Anthrophic models, so Microsoft can’t criticize the AI technology from its partners.
What Microsoft can do is emphasize the value of deep integration between Copilot and the Microsoft 365 apps, as evident in its comparison between Microsoft 365 Copilot and ChatGPT Enterprise with the tagline “Not all AI is built for work.”
DLP Policy for Copilot
Surprisingly, Purview Data Loss Prevention (DLP) doesn’t feature in the comparison. However, a DLP policy for Copilot has been available since March 2025 and it’s one of the most valuable pieces of the Copilot ecosystem because it blocks Copilot and Copilot agents from processing files protected by specific sensitivity labels.
I guess you could argue that the OpenAI connectors or Anthrophic’s Connector for Claude don’t need DLP to do any blocking for them because neither integration can open Office or PDF files protected by sensitivity labels with encryption because the external programs cannot authenticate to gain access to the protected content. That’s stretching a deficiency to become a strength in a way that doesn’t hold water.
DLP Policy to Protect Sensitive Copilot Interactions
In any case, DLP comes with a default policy called “Default DLP policy – Protect sensitive M365 Copilot interactions” introduced in late 2025 to control the use of sensitive information types in Copilot prompts. The policy comes preconfigured to protect many different sensitive information types from an ABA routing number to a U.S. social security number (Figure 1).

Before putting the policy to use, it’s a good idea to remove sensitive information types that don’t make sense for your organization or maybe add some that are missing from the default set. You should also turn on incident reports so that administrators become aware of attempts to use sensitive information types in Copilot prompts and switch the mode from simulation to “On.”
Once enabled, DLP will detect attempts to use the sensitive information types specified in the policy in Copilot prompts. Users will be told that the organization has blocked Copilot from responding to some types of content and Copilot will do nothing further to process the prompt.
Extending DLP Policy for Copilot Actions to Block Web Searches
Originally, the DLP policy to protect sensitive Copilot interactions had just one action – to block prompts as described above. MC1263277 (27 March 2026, Microsoft 365 roadmap 548671) describes a new action that’s available in preview and due to roll out in general availability in June 2026. The new action blocks Copilot from performing web searches to ground prompts.
Microsoft 365 Copilot can consult both internal and external sources to ground prompts before it generates responses. External sources are consulting by running Bing searches to find relevant web content. The new action allows Copilot to continue process user prompts against Microsoft 365 content (if the user has a Microsoft 365 Copilot license) while stopping Copilot from sending potentially sensitive data to Bing to perform a search.
A DLP policy created for the special Copilot location can only choose one of the available actions for restricting Copilot from processing content (Figure 2). Apart from that, everything works just like for other DLP policies.

Overall, this is a nice change that demonstrates the value of working within an integrated ecosystem. I’m not saying that the OpenAI and Anthrophic connectors for Microsoft 365 are not valuable because that’s obviously not the case. However, organizations that value aspects like compliance and data governance will consider that being to exert control through mechanisms like DLP is very valuable. Isn’t choice wonderful?
Learn how to use Purview DLP and to exploit the data available to Microsoft 365 tenant administrators through the Office 365 for IT Pros eBook. We love figuring out how things work.
How can I verify that the roll-off factors (0.15, 0.10, and 0.05) are correctly implemented in the dvbs2xWaveformGenerator function?
What is the correct way to validate the roll-off factor (0.15, 0.10, 0.05) used by the dvbs2xWaveformGenerator in MATLAB? Is there a way to confirm it from the generated waveform?What is the correct way to validate the roll-off factor (0.15, 0.10, 0.05) used by the dvbs2xWaveformGenerator in MATLAB? Is there a way to confirm it from the generated waveform? What is the correct way to validate the roll-off factor (0.15, 0.10, 0.05) used by the dvbs2xWaveformGenerator in MATLAB? Is there a way to confirm it from the generated waveform? dvb-s2x, signal-processing, communication-toolbox, roll-off, satellite communications toolbox, wireless communications toolbox MATLAB Answers — New Questions
Drawing planes in geology
Dear all
I need help to add an algoritm or modified the exsit one to get the figures annexed in file:the following is my code:
clc; clear; close all;
%% —————- 1. Load Data ————————————
filename = ‘ThreeFaultModel_Modified.xlsx’;
data = xlsread(filename);
x = data(:,1);
g_Bouguer = data(:,2);
x = x(:); g_Bouguer = g_Bouguer(:);
%% —————- 2. User Inputs ———————————
N_layers = input(‘Enter number of layers: ‘);
rho_profiles = zeros(1, N_layers);
for i = 1:N_layers
rho_profiles(i) = input([‘Density of layer ‘ num2str(i) ‘: ‘]);
end
rho_basement = input(‘Basement density: ‘);
rho_contrasts = rho_profiles – rho_basement;
%% —————- 3. Inversion ————————
G = 6.67e-3;
z_inv = bsxfun(@rdivide, g_Bouguer, (2*pi*G*rho_contrasts));
%% —————- 4. Detect ONE Main Fault ————————
VG = gradient(z_inv(:,1), x);
% اختيار أقوى تغير (fault)
[~, idx_fault] = max(abs(VG));
MainFault.x = x(idx_fault);
MainFault.dip = atan2d(VG(idx_fault),1); % تقدير تقريبي
MainFault.throw = max(z_inv(:,1)) * 0.3; % تقدير بسيط
MainFault.type = ‘Normal’;
if MainFault.dip > 0
MainFault.type = ‘Reverse’;
end
if abs(MainFault.dip) > 85
MainFault.type = ‘Vertical’;
end
%% —————- 5. Apply ONE Fault to All Layers —————-
z_layers = z_inv;
for L = 1:N_layers
if strcmp(MainFault.type,’Reverse’)
z_layers(idx_fault:end, L:end) = z_layers(idx_fault:end, L:end) + MainFault.throw;
elseif strcmp(MainFault.type,’Normal’)
z_layers(idx_fault:end, L:end) = z_layers(idx_fault:end, L:end) – MainFault.throw;
else
% Vertical → no vertical shift
end
end
%% —————- 6. Plot Depth ————————
figure; hold on;
for i = 1:N_layers
plot(x, z_layers(:,i),’LineWidth’,2);
end
set(gca,’YDir’,’reverse’);
grid on;
title(‘Depth with Single Fault’);
xlabel(‘Distance (km)’);
ylabel(‘Depth (km)’);
legend(arrayfun(@(k) sprintf(‘Layer %d’,k),1:N_layers,’UniformOutput’,false));
%% —————- 7. Plot Single Fault Plane ————————
z_max = max(z_layers(:));
if strcmp(MainFault.type,’Vertical’)
plot([MainFault.x MainFault.x],[0 z_max],’r–‘,’LineWidth’,2);
else
dx = z_max / tand(MainFault.dip);
if MainFault.dip > 0
x2 = MainFault.x – dx;
else
x2 = MainFault.x + dx;
end
plot([MainFault.x x2],[0 z_max],’r–‘,’LineWidth’,2);
end
%% —————- 8. Dip Line from Surface ————————
figure; hold on;
for i = 1:N_layers
plot(x, z_layers(:,i),’LineWidth’,2);
end
set(gca,’YDir’,’reverse’);
grid on;
title(‘Single Fault Dip Line’);
xlabel(‘Distance (km)’);
ylabel(‘Depth (km)’);
z1 = max(z_layers(:,1));
dip = MainFault.dip;
x0 = MainFault.x;
if abs(dip) > 89
x1 = x0;
else
x1 = x0 + z1 / tand(dip);
end
plot([x0 x1],[0 z1],’r–‘,’LineWidth’,2);
text((x0+x1)/2,0.3,’Main Fault’,’Color’,’r’);
%% —————- 9. Geological Section ————————
figure; hold on;
colors = lines(N_layers);
for i = N_layers:-1:1
if i == 1
top = zeros(size(x));
else
top = z_layers(:,i-1);
end
bot = z_layers(:,i);
fill([x;flipud(x)], [top;flipud(bot)], colors(i,:), …
‘EdgeColor’,’k’,’FaceAlpha’,0.6);
end
% رسم الصدع
if strcmp(MainFault.type,’Vertical’)
plot([MainFault.x MainFault.x],[0 z_max],’k–‘,’LineWidth’,2);
else
dx = z_max / tand(MainFault.dip);
if MainFault.dip > 0
x2 = MainFault.x – dx;
else
x2 = MainFault.x + dx;
end
plot([MainFault.x x2],[0 z_max],’k–‘,’LineWidth’,2);
end
set(gca,’YDir’,’reverse’);
xlabel(‘Distance (km)’);
ylabel(‘Depth (km)’);
title(‘Geological Cross Section with Single Fault’);
legend(arrayfun(@(i) sprintf(‘Layer %d’,i),1:N_layers,’UniformOutput’,false));
we use the following paramters:
Enter number of layers: 3
Density of layer 1: 2.20
Density of layer 2: 2.25
Density of layer 3: 2.30
Basement density: 2.67Dear all
I need help to add an algoritm or modified the exsit one to get the figures annexed in file:the following is my code:
clc; clear; close all;
%% —————- 1. Load Data ————————————
filename = ‘ThreeFaultModel_Modified.xlsx’;
data = xlsread(filename);
x = data(:,1);
g_Bouguer = data(:,2);
x = x(:); g_Bouguer = g_Bouguer(:);
%% —————- 2. User Inputs ———————————
N_layers = input(‘Enter number of layers: ‘);
rho_profiles = zeros(1, N_layers);
for i = 1:N_layers
rho_profiles(i) = input([‘Density of layer ‘ num2str(i) ‘: ‘]);
end
rho_basement = input(‘Basement density: ‘);
rho_contrasts = rho_profiles – rho_basement;
%% —————- 3. Inversion ————————
G = 6.67e-3;
z_inv = bsxfun(@rdivide, g_Bouguer, (2*pi*G*rho_contrasts));
%% —————- 4. Detect ONE Main Fault ————————
VG = gradient(z_inv(:,1), x);
% اختيار أقوى تغير (fault)
[~, idx_fault] = max(abs(VG));
MainFault.x = x(idx_fault);
MainFault.dip = atan2d(VG(idx_fault),1); % تقدير تقريبي
MainFault.throw = max(z_inv(:,1)) * 0.3; % تقدير بسيط
MainFault.type = ‘Normal’;
if MainFault.dip > 0
MainFault.type = ‘Reverse’;
end
if abs(MainFault.dip) > 85
MainFault.type = ‘Vertical’;
end
%% —————- 5. Apply ONE Fault to All Layers —————-
z_layers = z_inv;
for L = 1:N_layers
if strcmp(MainFault.type,’Reverse’)
z_layers(idx_fault:end, L:end) = z_layers(idx_fault:end, L:end) + MainFault.throw;
elseif strcmp(MainFault.type,’Normal’)
z_layers(idx_fault:end, L:end) = z_layers(idx_fault:end, L:end) – MainFault.throw;
else
% Vertical → no vertical shift
end
end
%% —————- 6. Plot Depth ————————
figure; hold on;
for i = 1:N_layers
plot(x, z_layers(:,i),’LineWidth’,2);
end
set(gca,’YDir’,’reverse’);
grid on;
title(‘Depth with Single Fault’);
xlabel(‘Distance (km)’);
ylabel(‘Depth (km)’);
legend(arrayfun(@(k) sprintf(‘Layer %d’,k),1:N_layers,’UniformOutput’,false));
%% —————- 7. Plot Single Fault Plane ————————
z_max = max(z_layers(:));
if strcmp(MainFault.type,’Vertical’)
plot([MainFault.x MainFault.x],[0 z_max],’r–‘,’LineWidth’,2);
else
dx = z_max / tand(MainFault.dip);
if MainFault.dip > 0
x2 = MainFault.x – dx;
else
x2 = MainFault.x + dx;
end
plot([MainFault.x x2],[0 z_max],’r–‘,’LineWidth’,2);
end
%% —————- 8. Dip Line from Surface ————————
figure; hold on;
for i = 1:N_layers
plot(x, z_layers(:,i),’LineWidth’,2);
end
set(gca,’YDir’,’reverse’);
grid on;
title(‘Single Fault Dip Line’);
xlabel(‘Distance (km)’);
ylabel(‘Depth (km)’);
z1 = max(z_layers(:,1));
dip = MainFault.dip;
x0 = MainFault.x;
if abs(dip) > 89
x1 = x0;
else
x1 = x0 + z1 / tand(dip);
end
plot([x0 x1],[0 z1],’r–‘,’LineWidth’,2);
text((x0+x1)/2,0.3,’Main Fault’,’Color’,’r’);
%% —————- 9. Geological Section ————————
figure; hold on;
colors = lines(N_layers);
for i = N_layers:-1:1
if i == 1
top = zeros(size(x));
else
top = z_layers(:,i-1);
end
bot = z_layers(:,i);
fill([x;flipud(x)], [top;flipud(bot)], colors(i,:), …
‘EdgeColor’,’k’,’FaceAlpha’,0.6);
end
% رسم الصدع
if strcmp(MainFault.type,’Vertical’)
plot([MainFault.x MainFault.x],[0 z_max],’k–‘,’LineWidth’,2);
else
dx = z_max / tand(MainFault.dip);
if MainFault.dip > 0
x2 = MainFault.x – dx;
else
x2 = MainFault.x + dx;
end
plot([MainFault.x x2],[0 z_max],’k–‘,’LineWidth’,2);
end
set(gca,’YDir’,’reverse’);
xlabel(‘Distance (km)’);
ylabel(‘Depth (km)’);
title(‘Geological Cross Section with Single Fault’);
legend(arrayfun(@(i) sprintf(‘Layer %d’,i),1:N_layers,’UniformOutput’,false));
we use the following paramters:
Enter number of layers: 3
Density of layer 1: 2.20
Density of layer 2: 2.25
Density of layer 3: 2.30
Basement density: 2.67 Dear all
I need help to add an algoritm or modified the exsit one to get the figures annexed in file:the following is my code:
clc; clear; close all;
%% —————- 1. Load Data ————————————
filename = ‘ThreeFaultModel_Modified.xlsx’;
data = xlsread(filename);
x = data(:,1);
g_Bouguer = data(:,2);
x = x(:); g_Bouguer = g_Bouguer(:);
%% —————- 2. User Inputs ———————————
N_layers = input(‘Enter number of layers: ‘);
rho_profiles = zeros(1, N_layers);
for i = 1:N_layers
rho_profiles(i) = input([‘Density of layer ‘ num2str(i) ‘: ‘]);
end
rho_basement = input(‘Basement density: ‘);
rho_contrasts = rho_profiles – rho_basement;
%% —————- 3. Inversion ————————
G = 6.67e-3;
z_inv = bsxfun(@rdivide, g_Bouguer, (2*pi*G*rho_contrasts));
%% —————- 4. Detect ONE Main Fault ————————
VG = gradient(z_inv(:,1), x);
% اختيار أقوى تغير (fault)
[~, idx_fault] = max(abs(VG));
MainFault.x = x(idx_fault);
MainFault.dip = atan2d(VG(idx_fault),1); % تقدير تقريبي
MainFault.throw = max(z_inv(:,1)) * 0.3; % تقدير بسيط
MainFault.type = ‘Normal’;
if MainFault.dip > 0
MainFault.type = ‘Reverse’;
end
if abs(MainFault.dip) > 85
MainFault.type = ‘Vertical’;
end
%% —————- 5. Apply ONE Fault to All Layers —————-
z_layers = z_inv;
for L = 1:N_layers
if strcmp(MainFault.type,’Reverse’)
z_layers(idx_fault:end, L:end) = z_layers(idx_fault:end, L:end) + MainFault.throw;
elseif strcmp(MainFault.type,’Normal’)
z_layers(idx_fault:end, L:end) = z_layers(idx_fault:end, L:end) – MainFault.throw;
else
% Vertical → no vertical shift
end
end
%% —————- 6. Plot Depth ————————
figure; hold on;
for i = 1:N_layers
plot(x, z_layers(:,i),’LineWidth’,2);
end
set(gca,’YDir’,’reverse’);
grid on;
title(‘Depth with Single Fault’);
xlabel(‘Distance (km)’);
ylabel(‘Depth (km)’);
legend(arrayfun(@(k) sprintf(‘Layer %d’,k),1:N_layers,’UniformOutput’,false));
%% —————- 7. Plot Single Fault Plane ————————
z_max = max(z_layers(:));
if strcmp(MainFault.type,’Vertical’)
plot([MainFault.x MainFault.x],[0 z_max],’r–‘,’LineWidth’,2);
else
dx = z_max / tand(MainFault.dip);
if MainFault.dip > 0
x2 = MainFault.x – dx;
else
x2 = MainFault.x + dx;
end
plot([MainFault.x x2],[0 z_max],’r–‘,’LineWidth’,2);
end
%% —————- 8. Dip Line from Surface ————————
figure; hold on;
for i = 1:N_layers
plot(x, z_layers(:,i),’LineWidth’,2);
end
set(gca,’YDir’,’reverse’);
grid on;
title(‘Single Fault Dip Line’);
xlabel(‘Distance (km)’);
ylabel(‘Depth (km)’);
z1 = max(z_layers(:,1));
dip = MainFault.dip;
x0 = MainFault.x;
if abs(dip) > 89
x1 = x0;
else
x1 = x0 + z1 / tand(dip);
end
plot([x0 x1],[0 z1],’r–‘,’LineWidth’,2);
text((x0+x1)/2,0.3,’Main Fault’,’Color’,’r’);
%% —————- 9. Geological Section ————————
figure; hold on;
colors = lines(N_layers);
for i = N_layers:-1:1
if i == 1
top = zeros(size(x));
else
top = z_layers(:,i-1);
end
bot = z_layers(:,i);
fill([x;flipud(x)], [top;flipud(bot)], colors(i,:), …
‘EdgeColor’,’k’,’FaceAlpha’,0.6);
end
% رسم الصدع
if strcmp(MainFault.type,’Vertical’)
plot([MainFault.x MainFault.x],[0 z_max],’k–‘,’LineWidth’,2);
else
dx = z_max / tand(MainFault.dip);
if MainFault.dip > 0
x2 = MainFault.x – dx;
else
x2 = MainFault.x + dx;
end
plot([MainFault.x x2],[0 z_max],’k–‘,’LineWidth’,2);
end
set(gca,’YDir’,’reverse’);
xlabel(‘Distance (km)’);
ylabel(‘Depth (km)’);
title(‘Geological Cross Section with Single Fault’);
legend(arrayfun(@(i) sprintf(‘Layer %d’,i),1:N_layers,’UniformOutput’,false));
we use the following paramters:
Enter number of layers: 3
Density of layer 1: 2.20
Density of layer 2: 2.25
Density of layer 3: 2.30
Basement density: 2.67 matlab, drawing, plane MATLAB Answers — New Questions









