Category: Matlab
Category Archives: Matlab
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
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
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
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
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
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
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
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
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
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
Comparing one 3D point cloud with a selection of collected 3D point clouds?
Hello,
I am relatively new to MATLAB and coding. I am working on a project in which I hope to compare the point cloud of an individual CT scan to a collection of CT scans of the same structure. I would like to be able to receive a "closest-match" output. Basically: You put your scan in, its compared to the existing scans and you are provided with statistical and visual data on which existing scans match the closest.
I am currently in the planning phase for this project and am trying to identify which steps to take and which tools to consider, as well as to see if there i already existing code that can help me. I would really appreciate some ideas, related content or tips, as well as some questions I should ask myself and consider on how to achieve the first steps of this project, which would be to get a comparison going.
I appreciate all the help and pointing in the right direction I can get.
Thanks,
AnileHello,
I am relatively new to MATLAB and coding. I am working on a project in which I hope to compare the point cloud of an individual CT scan to a collection of CT scans of the same structure. I would like to be able to receive a "closest-match" output. Basically: You put your scan in, its compared to the existing scans and you are provided with statistical and visual data on which existing scans match the closest.
I am currently in the planning phase for this project and am trying to identify which steps to take and which tools to consider, as well as to see if there i already existing code that can help me. I would really appreciate some ideas, related content or tips, as well as some questions I should ask myself and consider on how to achieve the first steps of this project, which would be to get a comparison going.
I appreciate all the help and pointing in the right direction I can get.
Thanks,
Anile Hello,
I am relatively new to MATLAB and coding. I am working on a project in which I hope to compare the point cloud of an individual CT scan to a collection of CT scans of the same structure. I would like to be able to receive a "closest-match" output. Basically: You put your scan in, its compared to the existing scans and you are provided with statistical and visual data on which existing scans match the closest.
I am currently in the planning phase for this project and am trying to identify which steps to take and which tools to consider, as well as to see if there i already existing code that can help me. I would really appreciate some ideas, related content or tips, as well as some questions I should ask myself and consider on how to achieve the first steps of this project, which would be to get a comparison going.
I appreciate all the help and pointing in the right direction I can get.
Thanks,
Anile point cloud, image comparison, point set matching MATLAB Answers — New Questions
Please help me to run this simple relation
I want to draw relation between T ( y-axis) and x ( x-axis) with change parameter B1.
Constant:
B2=0.01;B4=0.1;
vector
Parameter
B1=0.1:0.1:0.5I want to draw relation between T ( y-axis) and x ( x-axis) with change parameter B1.
Constant:
B2=0.01;B4=0.1;
vector
Parameter
B1=0.1:0.1:0.5 I want to draw relation between T ( y-axis) and x ( x-axis) with change parameter B1.
Constant:
B2=0.01;B4=0.1;
vector
Parameter
B1=0.1:0.1:0.5 plot MATLAB Answers — New Questions
Integrating MMC in IEEE 9 bus system
Hello to fellow MATLAB users. I am studying electrical engineering and not so familiar with MATLAB and Simulink. Therefore I need your help.
I want to integrate a MMC system into IEEE 9 bus system to study how fault current behaves when an AC transmission line is replaced with a HVDC link. More specifically I want to integrate simscapeelectrical/ModularMultilevelConverterHVDCTransExample between bus 4 and bus 6 in simscapeelectrical/IEEE9BusSystemExample. However, I am at a dead end right now, no matter what I try I can’t get it right. I’d appreciate if you could guide me on how to tackle this problem.Hello to fellow MATLAB users. I am studying electrical engineering and not so familiar with MATLAB and Simulink. Therefore I need your help.
I want to integrate a MMC system into IEEE 9 bus system to study how fault current behaves when an AC transmission line is replaced with a HVDC link. More specifically I want to integrate simscapeelectrical/ModularMultilevelConverterHVDCTransExample between bus 4 and bus 6 in simscapeelectrical/IEEE9BusSystemExample. However, I am at a dead end right now, no matter what I try I can’t get it right. I’d appreciate if you could guide me on how to tackle this problem. Hello to fellow MATLAB users. I am studying electrical engineering and not so familiar with MATLAB and Simulink. Therefore I need your help.
I want to integrate a MMC system into IEEE 9 bus system to study how fault current behaves when an AC transmission line is replaced with a HVDC link. More specifically I want to integrate simscapeelectrical/ModularMultilevelConverterHVDCTransExample between bus 4 and bus 6 in simscapeelectrical/IEEE9BusSystemExample. However, I am at a dead end right now, no matter what I try I can’t get it right. I’d appreciate if you could guide me on how to tackle this problem. mmc, hvdc, ieee 9 bus, ac transmission MATLAB Answers — New Questions
UAV code simulation not showing the output properly
I am working on project on UAV. MATLAB code is working fine, but generated output does not show any UAVs. I can share some code here if someone is interested.I am working on project on UAV. MATLAB code is working fine, but generated output does not show any UAVs. I can share some code here if someone is interested. I am working on project on UAV. MATLAB code is working fine, but generated output does not show any UAVs. I can share some code here if someone is interested. aerial vehicle MATLAB Answers — New Questions
Disable reset of Jacobian
I’m trying to switch from the old “black” Simcape Specialized Power System library to the new “blue” Simcape library. I’m using the phasor solution and the fast calculation method, but the problem lies with the phasor solver itself. The solver resets the Jacobian matrix much more frequently than the Specilaized Power library solver. Any tips on how to reduce the frequency of these resets?
See attached report from Simulink Profiler:I’m trying to switch from the old “black” Simcape Specialized Power System library to the new “blue” Simcape library. I’m using the phasor solution and the fast calculation method, but the problem lies with the phasor solver itself. The solver resets the Jacobian matrix much more frequently than the Specilaized Power library solver. Any tips on how to reduce the frequency of these resets?
See attached report from Simulink Profiler: I’m trying to switch from the old “black” Simcape Specialized Power System library to the new “blue” Simcape library. I’m using the phasor solution and the fast calculation method, but the problem lies with the phasor solver itself. The solver resets the Jacobian matrix much more frequently than the Specilaized Power library solver. Any tips on how to reduce the frequency of these resets?
See attached report from Simulink Profiler: reset, jacobian MATLAB Answers — New Questions
Finding all eigen value between two given eigen value.
Suppose there are two square symmetric matrices [K] and [M]. Since my work is related with structural analysis so they are typically stiffness and mass matrices. I am doing wave propagation study for a narrow band input load. In frequency domain, load amplitude is significant only between frequency [omega1 omega2]. So I am interested to find all eigen value and corresponding eigen vector only in this range.
The eigen value problem statement is
[K]=lambda[M]Suppose there are two square symmetric matrices [K] and [M]. Since my work is related with structural analysis so they are typically stiffness and mass matrices. I am doing wave propagation study for a narrow band input load. In frequency domain, load amplitude is significant only between frequency [omega1 omega2]. So I am interested to find all eigen value and corresponding eigen vector only in this range.
The eigen value problem statement is
[K]=lambda[M] Suppose there are two square symmetric matrices [K] and [M]. Since my work is related with structural analysis so they are typically stiffness and mass matrices. I am doing wave propagation study for a narrow band input load. In frequency domain, load amplitude is significant only between frequency [omega1 omega2]. So I am interested to find all eigen value and corresponding eigen vector only in this range.
The eigen value problem statement is
[K]=lambda[M] all eigen value between given range MATLAB Answers — New Questions
2026a Release Date?
Good morning,
does someone know when full 2026a will be released? Normal release month is March, I did not see or hear something about a planned delayed release. Would be nice to use a more stable version than 2025a for app buiding (pls don’t tell me to use 2025b)…
greetingsGood morning,
does someone know when full 2026a will be released? Normal release month is March, I did not see or hear something about a planned delayed release. Would be nice to use a more stable version than 2025a for app buiding (pls don’t tell me to use 2025b)…
greetings Good morning,
does someone know when full 2026a will be released? Normal release month is March, I did not see or hear something about a planned delayed release. Would be nice to use a more stable version than 2025a for app buiding (pls don’t tell me to use 2025b)…
greetings release MATLAB Answers — New Questions









