Category: Matlab
Category Archives: Matlab
How to upgrade A2L file version in MATLAB2017b embedded coder?
Hi,
The latest ASAP2 (A2L file) version is 1.7 and above, which is required for my selected hardware and application. But embedded coder generates ASAP2 version 1.31 format. Is there any way to upgrade the ASAP2 version in MATLAB2017b?
If not possible kindly provide alternatives.
Thanks.Hi,
The latest ASAP2 (A2L file) version is 1.7 and above, which is required for my selected hardware and application. But embedded coder generates ASAP2 version 1.31 format. Is there any way to upgrade the ASAP2 version in MATLAB2017b?
If not possible kindly provide alternatives.
Thanks. Hi,
The latest ASAP2 (A2L file) version is 1.7 and above, which is required for my selected hardware and application. But embedded coder generates ASAP2 version 1.31 format. Is there any way to upgrade the ASAP2 version in MATLAB2017b?
If not possible kindly provide alternatives.
Thanks. asap2, embedded coder, a2l MATLAB Answers — New Questions
How can I plot the same output without default pattern function?
In Phased Array Toolbox, pattern function helps me plot the 3D response pattern. But I want to know how it is done and can someone teach me how to draw this?
I can only give out this outcome.In Phased Array Toolbox, pattern function helps me plot the 3D response pattern. But I want to know how it is done and can someone teach me how to draw this?
I can only give out this outcome. In Phased Array Toolbox, pattern function helps me plot the 3D response pattern. But I want to know how it is done and can someone teach me how to draw this?
I can only give out this outcome. phased array toolbox, 3d plots MATLAB Answers — New Questions
How do you make predictions with a trained Neural Network (NAR)?]
I want to make a network that takes temperature readings and gives a prediction of the diseases caused by these valuesI want to make a network that takes temperature readings and gives a prediction of the diseases caused by these values I want to make a network that takes temperature readings and gives a prediction of the diseases caused by these values prediction, neural network MATLAB Answers — New Questions
meshquality: What does it represent and what is a good number?
According to the documentation:
meshQuality evaluates the shape quality of mesh elements and returns numbers from 0 to 1 for each mesh element. The value 1 corresponds to the optimal shape of the element. By default, the meshQuality function combines several criteria when evaluating the shape quality.
What are these "criteria"? I believe it should a combination of aspect ratio, max/min size, angle, Jacobian, etc. But it would be good to see how it is calculated…
And what is considered to be a "good" mesh? above 0.3, or 0.5, or 0.7?
Q = meshQuality(model.Mesh);
elemIDs = find(Q < 0.5);
My idea is to find all elements with a quality lower than a certain threshold and locally refine the mesh. Which brings me to another question….
I know that you can locally refine mesh using ‘Hvertex’ and ‘Hedge’. But can you do the same thing based on elemIDs?
m3 = generateMesh(model,’Hedge’,{1,0.001},’Hvertex’,{[6 7],0.002})
This would require the generateMesh function to refer to model.Mesh rather than model itself … which doesn’t seem to work:
Check for incorrect argument data type or missing argument in call to function ‘generateMesh’.According to the documentation:
meshQuality evaluates the shape quality of mesh elements and returns numbers from 0 to 1 for each mesh element. The value 1 corresponds to the optimal shape of the element. By default, the meshQuality function combines several criteria when evaluating the shape quality.
What are these "criteria"? I believe it should a combination of aspect ratio, max/min size, angle, Jacobian, etc. But it would be good to see how it is calculated…
And what is considered to be a "good" mesh? above 0.3, or 0.5, or 0.7?
Q = meshQuality(model.Mesh);
elemIDs = find(Q < 0.5);
My idea is to find all elements with a quality lower than a certain threshold and locally refine the mesh. Which brings me to another question….
I know that you can locally refine mesh using ‘Hvertex’ and ‘Hedge’. But can you do the same thing based on elemIDs?
m3 = generateMesh(model,’Hedge’,{1,0.001},’Hvertex’,{[6 7],0.002})
This would require the generateMesh function to refer to model.Mesh rather than model itself … which doesn’t seem to work:
Check for incorrect argument data type or missing argument in call to function ‘generateMesh’. According to the documentation:
meshQuality evaluates the shape quality of mesh elements and returns numbers from 0 to 1 for each mesh element. The value 1 corresponds to the optimal shape of the element. By default, the meshQuality function combines several criteria when evaluating the shape quality.
What are these "criteria"? I believe it should a combination of aspect ratio, max/min size, angle, Jacobian, etc. But it would be good to see how it is calculated…
And what is considered to be a "good" mesh? above 0.3, or 0.5, or 0.7?
Q = meshQuality(model.Mesh);
elemIDs = find(Q < 0.5);
My idea is to find all elements with a quality lower than a certain threshold and locally refine the mesh. Which brings me to another question….
I know that you can locally refine mesh using ‘Hvertex’ and ‘Hedge’. But can you do the same thing based on elemIDs?
m3 = generateMesh(model,’Hedge’,{1,0.001},’Hvertex’,{[6 7],0.002})
This would require the generateMesh function to refer to model.Mesh rather than model itself … which doesn’t seem to work:
Check for incorrect argument data type or missing argument in call to function ‘generateMesh’. mesh, pde MATLAB Answers — New Questions
Error in enhanceSpeech for audio enhancement
I am using enhanceSpeech (https://www.mathworks.com/help/audio/ref/enhancespeech.html) to proceed an audio file and encountered the following problem.
Index in position 1 exceeds array bounds. Index must not exceed 256384.
Error in audio.ai.metricgan.postprocess (line 39)
audioOut = audioOut(1:size(audioIn,1),1);
Error in enhanceSpeech (line 58)
audioOut = audio.ai.metricgan.postprocess(audioIn,fs,reconstructionPhase,netOutput,win);
I looked at the signal. It has certain noise in the very beginning.
I think this is the major reason because if I run:
enhancedSpeech = enhanceSpeech(noisySpeech(3000:end),fs);
there is no error. But if I run:
enhancedSpeech = enhanceSpeech(noisySpeech(2900:end),fs);
there will errors as shown above.I am using enhanceSpeech (https://www.mathworks.com/help/audio/ref/enhancespeech.html) to proceed an audio file and encountered the following problem.
Index in position 1 exceeds array bounds. Index must not exceed 256384.
Error in audio.ai.metricgan.postprocess (line 39)
audioOut = audioOut(1:size(audioIn,1),1);
Error in enhanceSpeech (line 58)
audioOut = audio.ai.metricgan.postprocess(audioIn,fs,reconstructionPhase,netOutput,win);
I looked at the signal. It has certain noise in the very beginning.
I think this is the major reason because if I run:
enhancedSpeech = enhanceSpeech(noisySpeech(3000:end),fs);
there is no error. But if I run:
enhancedSpeech = enhanceSpeech(noisySpeech(2900:end),fs);
there will errors as shown above. I am using enhanceSpeech (https://www.mathworks.com/help/audio/ref/enhancespeech.html) to proceed an audio file and encountered the following problem.
Index in position 1 exceeds array bounds. Index must not exceed 256384.
Error in audio.ai.metricgan.postprocess (line 39)
audioOut = audioOut(1:size(audioIn,1),1);
Error in enhanceSpeech (line 58)
audioOut = audio.ai.metricgan.postprocess(audioIn,fs,reconstructionPhase,netOutput,win);
I looked at the signal. It has certain noise in the very beginning.
I think this is the major reason because if I run:
enhancedSpeech = enhanceSpeech(noisySpeech(3000:end),fs);
there is no error. But if I run:
enhancedSpeech = enhanceSpeech(noisySpeech(2900:end),fs);
there will errors as shown above. audio, signal processing MATLAB Answers — New Questions
I am trying to solve Nonlinear systems of equations using Newton-Raphson method, having problem while using newtmult function. Please guide me to correct my code.
function [J,f]=jfreact(x,varargin)
del=0.000001;
df1dx1=(u(x(1)+del*x(1),x(2))-u(x(1),x(2)))/(del*x(1));
df1dx2=(u(x(1),x(2)+del*x(2))-u(x(1),x(2)))/(del*x(2));
df2dx1=(v(x(1)+del*x(1),x(2))-v(x(1),x(2)))/(del*x(1));
df2dx2=(v(x(1),x(2)+del*x(2))-v(x(1),x(2)))/(del*x(2));
J=[df1dx1 df1dx2;df2dx1 df2dx2];
f1=u(x(1),x(2));
f2=v(x(1),x(2));
f=[f1;f2];
function f=u(x,y)
f = (5 + x + y) / (50 – 2 * x – y) ^ 2 / (20 – x) – 0.0004;
function f=v(x,y)
f = (5 + x + y) / (50 – 2 * x – y) / (10 – y) – 0.037;
solver function used:- (Initial guesses are x1=x2=3)
function [x,f,ea,iter]= newtmult(@jfreact,[3;3],es,maxit,varargin);
es=50;
if nargin<2,error(‘at least 2 input arguments required’),end
if nargin<3||isempty(es),es=0.0001;end
if nargin<4||isempty(maxit),maxit=50;end
iter = 0;
x=x0;
while (1)
[J,f]=jfreact(x,varargin{:});
dx=Jf;
x=x-dx;
iter = iter + 1;
ea=100*max(abs(dx./x));
if iter>=maxit||ea<=es, break, end
end
endfunction [J,f]=jfreact(x,varargin)
del=0.000001;
df1dx1=(u(x(1)+del*x(1),x(2))-u(x(1),x(2)))/(del*x(1));
df1dx2=(u(x(1),x(2)+del*x(2))-u(x(1),x(2)))/(del*x(2));
df2dx1=(v(x(1)+del*x(1),x(2))-v(x(1),x(2)))/(del*x(1));
df2dx2=(v(x(1),x(2)+del*x(2))-v(x(1),x(2)))/(del*x(2));
J=[df1dx1 df1dx2;df2dx1 df2dx2];
f1=u(x(1),x(2));
f2=v(x(1),x(2));
f=[f1;f2];
function f=u(x,y)
f = (5 + x + y) / (50 – 2 * x – y) ^ 2 / (20 – x) – 0.0004;
function f=v(x,y)
f = (5 + x + y) / (50 – 2 * x – y) / (10 – y) – 0.037;
solver function used:- (Initial guesses are x1=x2=3)
function [x,f,ea,iter]= newtmult(@jfreact,[3;3],es,maxit,varargin);
es=50;
if nargin<2,error(‘at least 2 input arguments required’),end
if nargin<3||isempty(es),es=0.0001;end
if nargin<4||isempty(maxit),maxit=50;end
iter = 0;
x=x0;
while (1)
[J,f]=jfreact(x,varargin{:});
dx=Jf;
x=x-dx;
iter = iter + 1;
ea=100*max(abs(dx./x));
if iter>=maxit||ea<=es, break, end
end
end function [J,f]=jfreact(x,varargin)
del=0.000001;
df1dx1=(u(x(1)+del*x(1),x(2))-u(x(1),x(2)))/(del*x(1));
df1dx2=(u(x(1),x(2)+del*x(2))-u(x(1),x(2)))/(del*x(2));
df2dx1=(v(x(1)+del*x(1),x(2))-v(x(1),x(2)))/(del*x(1));
df2dx2=(v(x(1),x(2)+del*x(2))-v(x(1),x(2)))/(del*x(2));
J=[df1dx1 df1dx2;df2dx1 df2dx2];
f1=u(x(1),x(2));
f2=v(x(1),x(2));
f=[f1;f2];
function f=u(x,y)
f = (5 + x + y) / (50 – 2 * x – y) ^ 2 / (20 – x) – 0.0004;
function f=v(x,y)
f = (5 + x + y) / (50 – 2 * x – y) / (10 – y) – 0.037;
solver function used:- (Initial guesses are x1=x2=3)
function [x,f,ea,iter]= newtmult(@jfreact,[3;3],es,maxit,varargin);
es=50;
if nargin<2,error(‘at least 2 input arguments required’),end
if nargin<3||isempty(es),es=0.0001;end
if nargin<4||isempty(maxit),maxit=50;end
iter = 0;
x=x0;
while (1)
[J,f]=jfreact(x,varargin{:});
dx=Jf;
x=x-dx;
iter = iter + 1;
ea=100*max(abs(dx./x));
if iter>=maxit||ea<=es, break, end
end
end non linear equations, newton raphson method, iteration MATLAB Answers — New Questions
How to declare the weight and bias values for a convolution layer?
Greetings,
I want to add a convolution layer in the existing squeezenet network. However the errors shown like this:
Error using assembleNetwork (line 47)
Invalid network.
Error in trainyolov3 (line 80)
newbaseNetwork = assembleNetwork(lgraph); % for tiny-yolov3-coco
Caused by:
Layer ‘add_conv’: Empty Weights property. Specify a nonempty value for the Weights property.
Layer ‘add_conv’: Empty Bias property. Specify a nonempty value for the Bias property.
Therefore, I want to ask on how to declare the weights and bias value for that layer? My code is as shown below:
lgraph = disconnectLayers(lgraph,’fire8-concat’,’fire9-squeeze1x1′);
layer = [
maxPooling2dLayer([3 3],"Name","pool6","Padding","same","Stride",[2 2])
convolution2dLayer([1 1],512,"Name","add_conv","Padding",[1 1 1 1],"Stride",[2 2])
reluLayer("Name","relu_add_conv")];
lgraph = addLayers(lgraph, layer);
lgraph = connectLayers(lgraph,’fire8-concat’,’pool6′);
lgraph = connectLayers(lgraph,’relu_add_conv’,’fire9-squeeze1x1′);
newbaseNetwork = assembleNetwork(lgraph);Greetings,
I want to add a convolution layer in the existing squeezenet network. However the errors shown like this:
Error using assembleNetwork (line 47)
Invalid network.
Error in trainyolov3 (line 80)
newbaseNetwork = assembleNetwork(lgraph); % for tiny-yolov3-coco
Caused by:
Layer ‘add_conv’: Empty Weights property. Specify a nonempty value for the Weights property.
Layer ‘add_conv’: Empty Bias property. Specify a nonempty value for the Bias property.
Therefore, I want to ask on how to declare the weights and bias value for that layer? My code is as shown below:
lgraph = disconnectLayers(lgraph,’fire8-concat’,’fire9-squeeze1x1′);
layer = [
maxPooling2dLayer([3 3],"Name","pool6","Padding","same","Stride",[2 2])
convolution2dLayer([1 1],512,"Name","add_conv","Padding",[1 1 1 1],"Stride",[2 2])
reluLayer("Name","relu_add_conv")];
lgraph = addLayers(lgraph, layer);
lgraph = connectLayers(lgraph,’fire8-concat’,’pool6′);
lgraph = connectLayers(lgraph,’relu_add_conv’,’fire9-squeeze1x1′);
newbaseNetwork = assembleNetwork(lgraph); Greetings,
I want to add a convolution layer in the existing squeezenet network. However the errors shown like this:
Error using assembleNetwork (line 47)
Invalid network.
Error in trainyolov3 (line 80)
newbaseNetwork = assembleNetwork(lgraph); % for tiny-yolov3-coco
Caused by:
Layer ‘add_conv’: Empty Weights property. Specify a nonempty value for the Weights property.
Layer ‘add_conv’: Empty Bias property. Specify a nonempty value for the Bias property.
Therefore, I want to ask on how to declare the weights and bias value for that layer? My code is as shown below:
lgraph = disconnectLayers(lgraph,’fire8-concat’,’fire9-squeeze1x1′);
layer = [
maxPooling2dLayer([3 3],"Name","pool6","Padding","same","Stride",[2 2])
convolution2dLayer([1 1],512,"Name","add_conv","Padding",[1 1 1 1],"Stride",[2 2])
reluLayer("Name","relu_add_conv")];
lgraph = addLayers(lgraph, layer);
lgraph = connectLayers(lgraph,’fire8-concat’,’pool6′);
lgraph = connectLayers(lgraph,’relu_add_conv’,’fire9-squeeze1x1′);
newbaseNetwork = assembleNetwork(lgraph); deep learning MATLAB Answers — New Questions
I’m trying to obtain a the transfer function of a circuit but keep getting “Unable to find explicit solution”
I’m trying to solve a group of equations to find the transfer function of a circuit, nontheless I get the banner of "Unable to find explicit solution" and Empty sym: 0-by-1. If I remove the "ReturnConditions=true" then I do get a solution but I’m not sure if it is the correct one. its just that I tried solving a more easy circuit and the "ReturnConditions=true" was necesary in that case.
I planned on solving an even more complex one so I wanted to know if I was doing something wrong.
syms R0 R1 R2 R3 R4 R5 C1 C2 C3 Vin I1 I2 I3 I4 Vout s H
eq1= Vin==I1*R0+I1/(C2*s)-I2/(C2*s)+I1*R3-I3*R3+I1/(C1*s)-I4/(C1*s);
eq2=0==I2*R1+I2/(C3*s)-I4/(C3*s)+I2*R4-I3*R4+I2/(C2*s)-I1/(C2*s);
eq3=0==I3*R3-I1*R3+I3*R4-I2*R4+I3*R5-I4*R5;
eq4=0==I4*R2+I4/(C1*s)-I1/(C1*s)+I4*R5-I3*R5+I4/(C3*s)-I2/(C3*s);
eq5=Vout==I4*R2;
eq6=H==Vout/Vin;
result=solve([eq1,eq2,eq3,eq4,eq5,eq6],[Vin,I1,I2,I3,I4,Vout,H],ReturnConditions=true);
H=collect(result.H,s)I’m trying to solve a group of equations to find the transfer function of a circuit, nontheless I get the banner of "Unable to find explicit solution" and Empty sym: 0-by-1. If I remove the "ReturnConditions=true" then I do get a solution but I’m not sure if it is the correct one. its just that I tried solving a more easy circuit and the "ReturnConditions=true" was necesary in that case.
I planned on solving an even more complex one so I wanted to know if I was doing something wrong.
syms R0 R1 R2 R3 R4 R5 C1 C2 C3 Vin I1 I2 I3 I4 Vout s H
eq1= Vin==I1*R0+I1/(C2*s)-I2/(C2*s)+I1*R3-I3*R3+I1/(C1*s)-I4/(C1*s);
eq2=0==I2*R1+I2/(C3*s)-I4/(C3*s)+I2*R4-I3*R4+I2/(C2*s)-I1/(C2*s);
eq3=0==I3*R3-I1*R3+I3*R4-I2*R4+I3*R5-I4*R5;
eq4=0==I4*R2+I4/(C1*s)-I1/(C1*s)+I4*R5-I3*R5+I4/(C3*s)-I2/(C3*s);
eq5=Vout==I4*R2;
eq6=H==Vout/Vin;
result=solve([eq1,eq2,eq3,eq4,eq5,eq6],[Vin,I1,I2,I3,I4,Vout,H],ReturnConditions=true);
H=collect(result.H,s) I’m trying to solve a group of equations to find the transfer function of a circuit, nontheless I get the banner of "Unable to find explicit solution" and Empty sym: 0-by-1. If I remove the "ReturnConditions=true" then I do get a solution but I’m not sure if it is the correct one. its just that I tried solving a more easy circuit and the "ReturnConditions=true" was necesary in that case.
I planned on solving an even more complex one so I wanted to know if I was doing something wrong.
syms R0 R1 R2 R3 R4 R5 C1 C2 C3 Vin I1 I2 I3 I4 Vout s H
eq1= Vin==I1*R0+I1/(C2*s)-I2/(C2*s)+I1*R3-I3*R3+I1/(C1*s)-I4/(C1*s);
eq2=0==I2*R1+I2/(C3*s)-I4/(C3*s)+I2*R4-I3*R4+I2/(C2*s)-I1/(C2*s);
eq3=0==I3*R3-I1*R3+I3*R4-I2*R4+I3*R5-I4*R5;
eq4=0==I4*R2+I4/(C1*s)-I1/(C1*s)+I4*R5-I3*R5+I4/(C3*s)-I2/(C3*s);
eq5=Vout==I4*R2;
eq6=H==Vout/Vin;
result=solve([eq1,eq2,eq3,eq4,eq5,eq6],[Vin,I1,I2,I3,I4,Vout,H],ReturnConditions=true);
H=collect(result.H,s) transfer function, equation, solve MATLAB Answers — New Questions
PLOTING DATA INTO GRAPHICS
EXECUTE THE RESULTS OF NUMBER, MATRIX, VECTOR OPERATIONS AND CONVERT THEM INTO GRAPHICS?
form book: Menke, W., 2024, Geophysical Data Analysis and Inverse Theory, Academic Press.EXECUTE THE RESULTS OF NUMBER, MATRIX, VECTOR OPERATIONS AND CONVERT THEM INTO GRAPHICS?
form book: Menke, W., 2024, Geophysical Data Analysis and Inverse Theory, Academic Press. EXECUTE THE RESULTS OF NUMBER, MATRIX, VECTOR OPERATIONS AND CONVERT THEM INTO GRAPHICS?
form book: Menke, W., 2024, Geophysical Data Analysis and Inverse Theory, Academic Press. #homework #help MATLAB Answers — New Questions
Local functions are not working in MatLab R2022a
I’m trying to write local functions in the way instructed in this video: https://www.youtube.com/watch?v=f0zKcuP3Wc0&list=PLlvaivyRxHmdTvpNBe4gKWrOBrcuxhpsl&index=48, beginning at 5:50. When running the code below, my MatLab R2022a says Unrecognized function or variable ‘mymean’. What am I missing here?
x = 1:10;
n = length(x);
avg = mymean(x,n)
function a = mymean(v,n)
a = sum(v)/n;
endI’m trying to write local functions in the way instructed in this video: https://www.youtube.com/watch?v=f0zKcuP3Wc0&list=PLlvaivyRxHmdTvpNBe4gKWrOBrcuxhpsl&index=48, beginning at 5:50. When running the code below, my MatLab R2022a says Unrecognized function or variable ‘mymean’. What am I missing here?
x = 1:10;
n = length(x);
avg = mymean(x,n)
function a = mymean(v,n)
a = sum(v)/n;
end I’m trying to write local functions in the way instructed in this video: https://www.youtube.com/watch?v=f0zKcuP3Wc0&list=PLlvaivyRxHmdTvpNBe4gKWrOBrcuxhpsl&index=48, beginning at 5:50. When running the code below, my MatLab R2022a says Unrecognized function or variable ‘mymean’. What am I missing here?
x = 1:10;
n = length(x);
avg = mymean(x,n)
function a = mymean(v,n)
a = sum(v)/n;
end function MATLAB Answers — New Questions
I am not able to load in my files when using the lidar labeler app
I have .las/laz, .ply files downloaded that I have successfully imported and worked with in the lidar viewer app however, I am not able to import them in the lidar labeler app. They do not show up when it is time to load the files in.
What could be the issue?
Thank you.I have .las/laz, .ply files downloaded that I have successfully imported and worked with in the lidar viewer app however, I am not able to import them in the lidar labeler app. They do not show up when it is time to load the files in.
What could be the issue?
Thank you. I have .las/laz, .ply files downloaded that I have successfully imported and worked with in the lidar viewer app however, I am not able to import them in the lidar labeler app. They do not show up when it is time to load the files in.
What could be the issue?
Thank you. lidar toolbox MATLAB Answers — New Questions
How to call matlab functions from a C/C++ project..???
I have a project written in C/C++ and I want to access some functions from the MATLAB. Is this possible and how.??/I have a project written in C/C++ and I want to access some functions from the MATLAB. Is this possible and how.??/ I have a project written in C/C++ and I want to access some functions from the MATLAB. Is this possible and how.??/ call matlab functions from a c/c++ project. MATLAB Answers — New Questions
How to integrate MATLAB .m file in Python script to run it in OPAL-RT Platform?
I am trying to run a simulink model which has two PVs connected with grid. The simulation will tun multiple times, the PV irradiance, temperature will be fed to each simulation through running a matlab file which will randomly select the irradiance, temparature and load values. The data will be saved after eaxh simulation. As I am relatively new using Python Script in Opal RT,can anyone suggest me how can I write the MATLAB file in the script and what would be the best way to write the code?
And ,if there is any example available like this , can you share it to me?I am trying to run a simulink model which has two PVs connected with grid. The simulation will tun multiple times, the PV irradiance, temperature will be fed to each simulation through running a matlab file which will randomly select the irradiance, temparature and load values. The data will be saved after eaxh simulation. As I am relatively new using Python Script in Opal RT,can anyone suggest me how can I write the MATLAB file in the script and what would be the best way to write the code?
And ,if there is any example available like this , can you share it to me? I am trying to run a simulink model which has two PVs connected with grid. The simulation will tun multiple times, the PV irradiance, temperature will be fed to each simulation through running a matlab file which will randomly select the irradiance, temparature and load values. The data will be saved after eaxh simulation. As I am relatively new using Python Script in Opal RT,can anyone suggest me how can I write the MATLAB file in the script and what would be the best way to write the code?
And ,if there is any example available like this , can you share it to me? opal rt MATLAB Answers — New Questions
Python process terminated unexpectedly after snapping 100-150 photos
Hey All
Basically as the title suggests, I am using MATLAB to call a opython function that snaps raw images and creates plots, however, when I snap close to 100-150 photos I tend to get an error that says process terminated unexpectedly. Any Sort of help would be much appreciated!Hey All
Basically as the title suggests, I am using MATLAB to call a opython function that snaps raw images and creates plots, however, when I snap close to 100-150 photos I tend to get an error that says process terminated unexpectedly. Any Sort of help would be much appreciated! Hey All
Basically as the title suggests, I am using MATLAB to call a opython function that snaps raw images and creates plots, however, when I snap close to 100-150 photos I tend to get an error that says process terminated unexpectedly. Any Sort of help would be much appreciated! python, image analyst, unexpected error, python interpreter, appdesigner MATLAB Answers — New Questions
Can we impose geometry constraints on fisheye lens calibration and rectification?
Assuming that the distorted lines generated by fisheye projection should be straight after rectification, can we use deep neural network to impose explicit geometry constraints onto processes of the fisheye lens calibration and the distorted image rectification?Assuming that the distorted lines generated by fisheye projection should be straight after rectification, can we use deep neural network to impose explicit geometry constraints onto processes of the fisheye lens calibration and the distorted image rectification? Assuming that the distorted lines generated by fisheye projection should be straight after rectification, can we use deep neural network to impose explicit geometry constraints onto processes of the fisheye lens calibration and the distorted image rectification? image processing, deep learning MATLAB Answers — New Questions
How can i plot PI controller step respone
I used the following steps to plot the step response using (step) function:
-> num2_PI=conv(395.5*[1 1/8],[0 -0.0005854 -0.01121 0.0003176]);
den2_PI=[ 1 1.117 10.18 0.0005226 0]+num2_PI;
TF2_PI=tf(num2_PI,den2_PI);
step(TF2_PI)
the plot was :
So , how can I read the overshoot, final value and other readings from this plotI used the following steps to plot the step response using (step) function:
-> num2_PI=conv(395.5*[1 1/8],[0 -0.0005854 -0.01121 0.0003176]);
den2_PI=[ 1 1.117 10.18 0.0005226 0]+num2_PI;
TF2_PI=tf(num2_PI,den2_PI);
step(TF2_PI)
the plot was :
So , how can I read the overshoot, final value and other readings from this plot I used the following steps to plot the step response using (step) function:
-> num2_PI=conv(395.5*[1 1/8],[0 -0.0005854 -0.01121 0.0003176]);
den2_PI=[ 1 1.117 10.18 0.0005226 0]+num2_PI;
TF2_PI=tf(num2_PI,den2_PI);
step(TF2_PI)
the plot was :
So , how can I read the overshoot, final value and other readings from this plot #step, #response, #tunning, #controller MATLAB Answers — New Questions
Running into error when using pwelch for FFT
I am trying to conduct a FFT on a wav file in order to then calculate SPL within a bandwidth (120-450hz). I am using code from another answered question and I get hung up on an error:
Error using signal.internal.spectral.welchparse>segment_info
The length of the segments cannot be greater than the length of the input signal.
Error in signal.internal.spectral.welchparse (line 34)
[L,noverlap,win] = segment_info(M,win1,noverlap1);
Error in welch (line 55)
signal.internal.spectral.welchparse(x,esttype,args{:});
Error in pwelch (line 170)
[welchOut{1:nargout}] = welch(x,funcName,inputArgs{:});
Error in snip_extractor (line 16)
[sensor_spectrum, freq] = pwelch(samples,w,NOVERLAP,NFFT,Fs);
My code follows. I am loading a 30sec wav file and then selecting a 5sec period with the file for analysis. Any help here would be most appreciated:
[y,Fs]=audioread(‘67649542.060120201700.wav’) %Load fullfile
snips = y([163840:327680], [1]) %Extract data from period of interest
%%%Borrowed code from https://www.mathworks.com/matlabcentral/answers/636155-plotting-fft-for-audio-wav-file
NFFT = (Fs/2);
NOVERLAP = round(0.75*NFFT);
w = hanning(NFFT);
samples = length(snips)
dt = 1/Fs
t = (0:dt:(samples-1)*dt)
[sensor_spectrum, freq] = pwelch(samples,w,NOVERLAP,NFFT,Fs);
sensor_spectrum_dB = 20*log10(sensor_spectrum);
figure(1),semilogx(freq,sensor_spectrum_dB);grid
title([‘Averaged FFT Spectrum / Fs = ‘ num2str(Fs) ‘ Hz / Delta f = ‘ num2str(freq(2)-freq(1)) ‘ Hz ‘]);
xlabel(‘Frequency (Hz)’);ylabel(my_ylabel);I am trying to conduct a FFT on a wav file in order to then calculate SPL within a bandwidth (120-450hz). I am using code from another answered question and I get hung up on an error:
Error using signal.internal.spectral.welchparse>segment_info
The length of the segments cannot be greater than the length of the input signal.
Error in signal.internal.spectral.welchparse (line 34)
[L,noverlap,win] = segment_info(M,win1,noverlap1);
Error in welch (line 55)
signal.internal.spectral.welchparse(x,esttype,args{:});
Error in pwelch (line 170)
[welchOut{1:nargout}] = welch(x,funcName,inputArgs{:});
Error in snip_extractor (line 16)
[sensor_spectrum, freq] = pwelch(samples,w,NOVERLAP,NFFT,Fs);
My code follows. I am loading a 30sec wav file and then selecting a 5sec period with the file for analysis. Any help here would be most appreciated:
[y,Fs]=audioread(‘67649542.060120201700.wav’) %Load fullfile
snips = y([163840:327680], [1]) %Extract data from period of interest
%%%Borrowed code from https://www.mathworks.com/matlabcentral/answers/636155-plotting-fft-for-audio-wav-file
NFFT = (Fs/2);
NOVERLAP = round(0.75*NFFT);
w = hanning(NFFT);
samples = length(snips)
dt = 1/Fs
t = (0:dt:(samples-1)*dt)
[sensor_spectrum, freq] = pwelch(samples,w,NOVERLAP,NFFT,Fs);
sensor_spectrum_dB = 20*log10(sensor_spectrum);
figure(1),semilogx(freq,sensor_spectrum_dB);grid
title([‘Averaged FFT Spectrum / Fs = ‘ num2str(Fs) ‘ Hz / Delta f = ‘ num2str(freq(2)-freq(1)) ‘ Hz ‘]);
xlabel(‘Frequency (Hz)’);ylabel(my_ylabel); I am trying to conduct a FFT on a wav file in order to then calculate SPL within a bandwidth (120-450hz). I am using code from another answered question and I get hung up on an error:
Error using signal.internal.spectral.welchparse>segment_info
The length of the segments cannot be greater than the length of the input signal.
Error in signal.internal.spectral.welchparse (line 34)
[L,noverlap,win] = segment_info(M,win1,noverlap1);
Error in welch (line 55)
signal.internal.spectral.welchparse(x,esttype,args{:});
Error in pwelch (line 170)
[welchOut{1:nargout}] = welch(x,funcName,inputArgs{:});
Error in snip_extractor (line 16)
[sensor_spectrum, freq] = pwelch(samples,w,NOVERLAP,NFFT,Fs);
My code follows. I am loading a 30sec wav file and then selecting a 5sec period with the file for analysis. Any help here would be most appreciated:
[y,Fs]=audioread(‘67649542.060120201700.wav’) %Load fullfile
snips = y([163840:327680], [1]) %Extract data from period of interest
%%%Borrowed code from https://www.mathworks.com/matlabcentral/answers/636155-plotting-fft-for-audio-wav-file
NFFT = (Fs/2);
NOVERLAP = round(0.75*NFFT);
w = hanning(NFFT);
samples = length(snips)
dt = 1/Fs
t = (0:dt:(samples-1)*dt)
[sensor_spectrum, freq] = pwelch(samples,w,NOVERLAP,NFFT,Fs);
sensor_spectrum_dB = 20*log10(sensor_spectrum);
figure(1),semilogx(freq,sensor_spectrum_dB);grid
title([‘Averaged FFT Spectrum / Fs = ‘ num2str(Fs) ‘ Hz / Delta f = ‘ num2str(freq(2)-freq(1)) ‘ Hz ‘]);
xlabel(‘Frequency (Hz)’);ylabel(my_ylabel); fft MATLAB Answers — New Questions
How to use genetic algorithm optimization on a 1D nonlinear periodic electrical networks with spatially-discrete unit cells?
For the attached 1D nonlinear periodic electrical networks with spatially-discrete unit cell, how to use the genetic algorithm optimization routine available in the MATLAB Global Optimization Toolbox such that spectral power in each of the first 5 harmonics is no less than −6 dB with respect to the fundamental frequency, f = 500 MHz? I am very new to this and would appreciate any help on how to solve this problem. Thanks.For the attached 1D nonlinear periodic electrical networks with spatially-discrete unit cell, how to use the genetic algorithm optimization routine available in the MATLAB Global Optimization Toolbox such that spectral power in each of the first 5 harmonics is no less than −6 dB with respect to the fundamental frequency, f = 500 MHz? I am very new to this and would appreciate any help on how to solve this problem. Thanks. For the attached 1D nonlinear periodic electrical networks with spatially-discrete unit cell, how to use the genetic algorithm optimization routine available in the MATLAB Global Optimization Toolbox such that spectral power in each of the first 5 harmonics is no less than −6 dB with respect to the fundamental frequency, f = 500 MHz? I am very new to this and would appreciate any help on how to solve this problem. Thanks. optimization, genetic algorithm, nonlinear MATLAB Answers — New Questions
Creation of colorbar for given points
Dear all
I am attaching a file with a color transition that I want to use as the color palette for a imagesc plot. How can I do that?Dear all
I am attaching a file with a color transition that I want to use as the color palette for a imagesc plot. How can I do that? Dear all
I am attaching a file with a color transition that I want to use as the color palette for a imagesc plot. How can I do that? customized colorbar MATLAB Answers — New Questions
nested parallel optimization and parfor loops
I would like to run a code having this structure:
Parallel Optimization 1(Particle swarm):
— Par for loop (length ~ 20):
— — Parallel Optimization 2(Particle swarm)
— calculate a cost function based on the 20 results of the parfor loop and use it in the Parallel Optimization 1
Is it possible to connect to a cluster and make a such complicated nested parallel compuitation?
I am doing this:
Par for loop
Parallel Optimization 2(Particle swarm)
on my computer for now but i am not sure the particle swarms actually works in parallel.
Please tell me if it is doable. Thank you.I would like to run a code having this structure:
Parallel Optimization 1(Particle swarm):
— Par for loop (length ~ 20):
— — Parallel Optimization 2(Particle swarm)
— calculate a cost function based on the 20 results of the parfor loop and use it in the Parallel Optimization 1
Is it possible to connect to a cluster and make a such complicated nested parallel compuitation?
I am doing this:
Par for loop
Parallel Optimization 2(Particle swarm)
on my computer for now but i am not sure the particle swarms actually works in parallel.
Please tell me if it is doable. Thank you. I would like to run a code having this structure:
Parallel Optimization 1(Particle swarm):
— Par for loop (length ~ 20):
— — Parallel Optimization 2(Particle swarm)
— calculate a cost function based on the 20 results of the parfor loop and use it in the Parallel Optimization 1
Is it possible to connect to a cluster and make a such complicated nested parallel compuitation?
I am doing this:
Par for loop
Parallel Optimization 2(Particle swarm)
on my computer for now but i am not sure the particle swarms actually works in parallel.
Please tell me if it is doable. Thank you. parallel computing, parallel computing toolbox, optimization, particle swarm, parfor MATLAB Answers — New Questions