Category: Matlab
Category Archives: Matlab
Simulink error: Size of data type ‘CAN_MESSAGE’ has not been set
Hello everyone, I am working on a model using CAN bus to receive data.But when building the model it pops out an ERROR:"Size of data type ‘CAN_MESSAGE’ has not been set" and I can’t find solution anywhere.
My environment: Matlab2018b, Visual Studio 2015, Freescale s32ds v1.0. I am coding for a VCU which contains a MPC5744 as CPU (perhaps)
And I have asked the guy from the VCU company, he said the model seems to be fine, the problem may be about my environment or something else…
Sincere appreciation for any advice!!Hello everyone, I am working on a model using CAN bus to receive data.But when building the model it pops out an ERROR:"Size of data type ‘CAN_MESSAGE’ has not been set" and I can’t find solution anywhere.
My environment: Matlab2018b, Visual Studio 2015, Freescale s32ds v1.0. I am coding for a VCU which contains a MPC5744 as CPU (perhaps)
And I have asked the guy from the VCU company, he said the model seems to be fine, the problem may be about my environment or something else…
Sincere appreciation for any advice!! Hello everyone, I am working on a model using CAN bus to receive data.But when building the model it pops out an ERROR:"Size of data type ‘CAN_MESSAGE’ has not been set" and I can’t find solution anywhere.
My environment: Matlab2018b, Visual Studio 2015, Freescale s32ds v1.0. I am coding for a VCU which contains a MPC5744 as CPU (perhaps)
And I have asked the guy from the VCU company, he said the model seems to be fine, the problem may be about my environment or something else…
Sincere appreciation for any advice!! can communication, simulink vehicle network toolbox MATLAB Answers — New Questions
Plot intersection between two surfaces and a plane.
I would like to plot the xy intersection of two surfaces coming from
surf command and a plane from the patch command.
I tried with the contourf, but it seems to be not possible.
Can this be done?I would like to plot the xy intersection of two surfaces coming from
surf command and a plane from the patch command.
I tried with the contourf, but it seems to be not possible.
Can this be done? I would like to plot the xy intersection of two surfaces coming from
surf command and a plane from the patch command.
I tried with the contourf, but it seems to be not possible.
Can this be done? plane, intersection, xyplot, double surface MATLAB Answers — New Questions
PPO | RL | Training for 10000 rounds still doesn’t get effective training, and the reward curve is very flat
With reinforcement learning using PPO algorithm, the Episode reward will oscillate in a wide range all the time, and the average reward curve will change very little.
My question is whether the Episode reward value for such oscillations is due to the large difference in the initial random environment settings, the large difference in the rewards obtained per episode, or the unreasonable parameter settings of the training.
The initial environment generates random locations through distance and angle variables
angle=-4*pi/8+sign(2*rand(1)-1)*rand(1)*pi/8;
dist=10000+rand(1)*4000;
The current agent settings and training settings are as follows:
actorOpts = rlOptimizerOptions(LearnRate=1e-4,GradientThreshold=1);
criticOpts = rlOptimizerOptions(LearnRate=1e-4,GradientThreshold=1);
agentOpts = rlPPOAgentOptions(…
ActorOptimizerOptions=actorOpts,…
CriticOptimizerOptions=criticOpts,…
ExperienceHorizon=2500,…
ClipFactor=0.1,…
EntropyLossWeight=0.02,…
MiniBatchSize=256,…
NumEpoch=9,…
AdvantageEstimateMethod="gae",…
GAEFactor=0.95,…
SampleTime=0.01,…
DiscountFactor=0.99);
trainOpts = rlTrainingOptions(…
‘MaxEpisodes’,100000, …
‘MaxStepsPerEpisode’,2500, …
‘Verbose’,false, …
‘StopTrainingCriteria’,"AverageReward",…
‘StopTrainingValue’,1000,…
‘ScoreAveragingWindowLength’,1000);
trainOpts.UseParallel = true;
trainOpts.ParallelizationOptions.StepsUntilDataIsSent = 2^11;With reinforcement learning using PPO algorithm, the Episode reward will oscillate in a wide range all the time, and the average reward curve will change very little.
My question is whether the Episode reward value for such oscillations is due to the large difference in the initial random environment settings, the large difference in the rewards obtained per episode, or the unreasonable parameter settings of the training.
The initial environment generates random locations through distance and angle variables
angle=-4*pi/8+sign(2*rand(1)-1)*rand(1)*pi/8;
dist=10000+rand(1)*4000;
The current agent settings and training settings are as follows:
actorOpts = rlOptimizerOptions(LearnRate=1e-4,GradientThreshold=1);
criticOpts = rlOptimizerOptions(LearnRate=1e-4,GradientThreshold=1);
agentOpts = rlPPOAgentOptions(…
ActorOptimizerOptions=actorOpts,…
CriticOptimizerOptions=criticOpts,…
ExperienceHorizon=2500,…
ClipFactor=0.1,…
EntropyLossWeight=0.02,…
MiniBatchSize=256,…
NumEpoch=9,…
AdvantageEstimateMethod="gae",…
GAEFactor=0.95,…
SampleTime=0.01,…
DiscountFactor=0.99);
trainOpts = rlTrainingOptions(…
‘MaxEpisodes’,100000, …
‘MaxStepsPerEpisode’,2500, …
‘Verbose’,false, …
‘StopTrainingCriteria’,"AverageReward",…
‘StopTrainingValue’,1000,…
‘ScoreAveragingWindowLength’,1000);
trainOpts.UseParallel = true;
trainOpts.ParallelizationOptions.StepsUntilDataIsSent = 2^11; With reinforcement learning using PPO algorithm, the Episode reward will oscillate in a wide range all the time, and the average reward curve will change very little.
My question is whether the Episode reward value for such oscillations is due to the large difference in the initial random environment settings, the large difference in the rewards obtained per episode, or the unreasonable parameter settings of the training.
The initial environment generates random locations through distance and angle variables
angle=-4*pi/8+sign(2*rand(1)-1)*rand(1)*pi/8;
dist=10000+rand(1)*4000;
The current agent settings and training settings are as follows:
actorOpts = rlOptimizerOptions(LearnRate=1e-4,GradientThreshold=1);
criticOpts = rlOptimizerOptions(LearnRate=1e-4,GradientThreshold=1);
agentOpts = rlPPOAgentOptions(…
ActorOptimizerOptions=actorOpts,…
CriticOptimizerOptions=criticOpts,…
ExperienceHorizon=2500,…
ClipFactor=0.1,…
EntropyLossWeight=0.02,…
MiniBatchSize=256,…
NumEpoch=9,…
AdvantageEstimateMethod="gae",…
GAEFactor=0.95,…
SampleTime=0.01,…
DiscountFactor=0.99);
trainOpts = rlTrainingOptions(…
‘MaxEpisodes’,100000, …
‘MaxStepsPerEpisode’,2500, …
‘Verbose’,false, …
‘StopTrainingCriteria’,"AverageReward",…
‘StopTrainingValue’,1000,…
‘ScoreAveragingWindowLength’,1000);
trainOpts.UseParallel = true;
trainOpts.ParallelizationOptions.StepsUntilDataIsSent = 2^11; ppo, reinforcement learning, reward curve MATLAB Answers — New Questions
Issues with Converting Binary Array to Decimal Value in MATLAB DLL for C++ Integration
Hello everyone,
I want to convert a binary array to a decimal value. When using MATLAB functions like bi2de and bit2int and then compiling them into a DLL using the library compiler, calling them from C++ results in errors indicating that the library could not be initialized. Is there an alternative MATLAB function that can be compiled into a DLL and called from C++ without issues?
I have also tried using a combination of bin2dec(num2str()), which loads the DLL correctly after compilation, but the execution results are incorrect. The result is displayed as a huge decimal number. What could be the reason for this?Hello everyone,
I want to convert a binary array to a decimal value. When using MATLAB functions like bi2de and bit2int and then compiling them into a DLL using the library compiler, calling them from C++ results in errors indicating that the library could not be initialized. Is there an alternative MATLAB function that can be compiled into a DLL and called from C++ without issues?
I have also tried using a combination of bin2dec(num2str()), which loads the DLL correctly after compilation, but the execution results are incorrect. The result is displayed as a huge decimal number. What could be the reason for this? Hello everyone,
I want to convert a binary array to a decimal value. When using MATLAB functions like bi2de and bit2int and then compiling them into a DLL using the library compiler, calling them from C++ results in errors indicating that the library could not be initialized. Is there an alternative MATLAB function that can be compiled into a DLL and called from C++ without issues?
I have also tried using a combination of bin2dec(num2str()), which loads the DLL correctly after compilation, but the execution results are incorrect. The result is displayed as a huge decimal number. What could be the reason for this? binary array, decimal value, matlab compiler, dll MATLAB Answers — New Questions
Calculate the volume of shape descibed by 3d points.
Given a set of 3d data points, without using the Image Processing Toolbox, what is the best method for working put the volume of the object described by the points?Given a set of 3d data points, without using the Image Processing Toolbox, what is the best method for working put the volume of the object described by the points? Given a set of 3d data points, without using the Image Processing Toolbox, what is the best method for working put the volume of the object described by the points? convex hull, convhull, trisurf MATLAB Answers — New Questions
finding 4 neighbor of pixel in grayscale image.
i am trying to find the 4 neighbor of pixel x0,y0 in grayscale image but i getting empty x,y . her is the code i am using
function [x,y]= neighbours(image,x0,y0,thres)
image=double(image);
interest = image(x0,y0);
pixel =zeros(size(image));
pixel(x0,y0)=1;
x=[];
y=[];
up= image(conv2(pixel,[0 1 0; 0 0 0; 0 0 0],’same’)>0);
if abs(up- interest)<=thres
if isempty(up)~=1
x(1)=x0;
y(1)=y0-1;
end
end
down= image(conv2(pixel,[0 0 0; 0 0 0; 0 1 0],’same’)>0);
if abs(down- interest)<=thres
if isempty(down)~=1
x(2)=x0;
y(2)=y0+1;
end
end
left= image(conv2(pixel,[0 0 0; 1 0 0; 0 0 0],’same’)>0);
if abs(left- interest)<=thres
if isempty(left)~=1
x(3)=x0-1;
y(3)=y0;
end
end
right= image(conv2(pixel,[0 0 0; 0 0 1; 0 0 0],’same’)>0);
if abs(right- interest)<=thres
if isempty(right)~=1
x(4)=x0+1;
y(4)=y0;
end
end
endi am trying to find the 4 neighbor of pixel x0,y0 in grayscale image but i getting empty x,y . her is the code i am using
function [x,y]= neighbours(image,x0,y0,thres)
image=double(image);
interest = image(x0,y0);
pixel =zeros(size(image));
pixel(x0,y0)=1;
x=[];
y=[];
up= image(conv2(pixel,[0 1 0; 0 0 0; 0 0 0],’same’)>0);
if abs(up- interest)<=thres
if isempty(up)~=1
x(1)=x0;
y(1)=y0-1;
end
end
down= image(conv2(pixel,[0 0 0; 0 0 0; 0 1 0],’same’)>0);
if abs(down- interest)<=thres
if isempty(down)~=1
x(2)=x0;
y(2)=y0+1;
end
end
left= image(conv2(pixel,[0 0 0; 1 0 0; 0 0 0],’same’)>0);
if abs(left- interest)<=thres
if isempty(left)~=1
x(3)=x0-1;
y(3)=y0;
end
end
right= image(conv2(pixel,[0 0 0; 0 0 1; 0 0 0],’same’)>0);
if abs(right- interest)<=thres
if isempty(right)~=1
x(4)=x0+1;
y(4)=y0;
end
end
end i am trying to find the 4 neighbor of pixel x0,y0 in grayscale image but i getting empty x,y . her is the code i am using
function [x,y]= neighbours(image,x0,y0,thres)
image=double(image);
interest = image(x0,y0);
pixel =zeros(size(image));
pixel(x0,y0)=1;
x=[];
y=[];
up= image(conv2(pixel,[0 1 0; 0 0 0; 0 0 0],’same’)>0);
if abs(up- interest)<=thres
if isempty(up)~=1
x(1)=x0;
y(1)=y0-1;
end
end
down= image(conv2(pixel,[0 0 0; 0 0 0; 0 1 0],’same’)>0);
if abs(down- interest)<=thres
if isempty(down)~=1
x(2)=x0;
y(2)=y0+1;
end
end
left= image(conv2(pixel,[0 0 0; 1 0 0; 0 0 0],’same’)>0);
if abs(left- interest)<=thres
if isempty(left)~=1
x(3)=x0-1;
y(3)=y0;
end
end
right= image(conv2(pixel,[0 0 0; 0 0 1; 0 0 0],’same’)>0);
if abs(right- interest)<=thres
if isempty(right)~=1
x(4)=x0+1;
y(4)=y0;
end
end
end image segmentation, image processing, image analysis, matlab, digital image processing MATLAB Answers — New Questions
i have made a code which finds a specific value ‘no’ from the excel sheet but it does the job one by one. i want to automate it so it gives all values with ‘no’ at once.
this is the code i’m using.
data = readtable(‘FINALconvergencecheck_ksst.xlsx’);
data.Properties.VariableNames(1) = "an6cd";
data.Properties.VariableNames(3) = "an6cl";
data.Properties.VariableNames(5) = "an6cm";
data.Properties.VariableNames(7) = "ap0cd";
data.Properties.VariableNames(9) = "ap0cl";
data.Properties.VariableNames(11) = "ap0cm";
data.Properties.VariableNames(13) = "ap3cd";
data.Properties.VariableNames(15) = "ap3cl";
data.Properties.VariableNames(17) = "ap3cm";
data.Properties.VariableNames(19) = "ap7cd";
data.Properties.VariableNames(21) = "ap7cl";
data.Properties.VariableNames(23) = "ap7cm";
data.Properties.VariableNames(25) = "ap10cd";
data.Properties.VariableNames(27) = "ap10cl";
data.Properties.VariableNames(29) = "ap10cm";
data.Properties.VariableNames(31) = "ap12cd";
data.Properties.VariableNames(33) = "ap12cl";
data.Properties.VariableNames(35) = "ap12cm";
data.Properties.VariableNames(37) = "ap14cd";
data.Properties.VariableNames(39) = "ap14cl";
data.Properties.VariableNames(41) = "ap14cm";
data.Properties.VariableNames(43) = "ap15cd";
data.Properties.VariableNames(45) = "ap15cl";
data.Properties.VariableNames(47) = "ap15cm";
data.Properties.VariableNames(49) = "ap17cd";
data.Properties.VariableNames(51) = "ap17cl";
data.Properties.VariableNames(53) = "ap17cm";
data.Properties.VariableNames(2) = "an6cd_r";
data.Properties.VariableNames(4) = "an6cl_r";
data.Properties.VariableNames(6) = "an6cm_r";
data.Properties.VariableNames(8) = "ap0cd_r";
data.Properties.VariableNames(10) = "ap0cl_r";
data.Properties.VariableNames(12) = "ap0cm_r";
data.Properties.VariableNames(14) = "ap3cd_r";
data.Properties.VariableNames(16) = "ap3cl_r";
data.Properties.VariableNames(18) = "ap3cm_r";
data.Properties.VariableNames(20) = "ap7cd_r";
data.Properties.VariableNames(22) = "ap7cl_r";
data.Properties.VariableNames(24) = "ap7cm_r";
data.Properties.VariableNames(26) = "ap10cd_r";
data.Properties.VariableNames(28) = "ap10cl_r";
data.Properties.VariableNames(30) = "ap10cm_r";
data.Properties.VariableNames(32) = "ap12cd_r";
data.Properties.VariableNames(34) = "ap12cl_r";
data.Properties.VariableNames(36) = "ap12cm_r";
data.Properties.VariableNames(38) = "ap14cd_r";
data.Properties.VariableNames(40) = "ap14cl_r";
data.Properties.VariableNames(42) = "ap14cm_r";
data.Properties.VariableNames(44) = "ap15cd_r";
data.Properties.VariableNames(46) = "ap15cl_r";
data.Properties.VariableNames(48) = "ap15cm_r";
data.Properties.VariableNames(50) = "ap17cd_r";
data.Properties.VariableNames(52) = "ap17cl_r";
data.Properties.VariableNames(54) = "ap17cm_r";
display = find(data.ap10cl_r=="no");
k=display;
k1=string(k);
switch k1
case "yes"
disp(‘convereged’)
case "no"
disp(‘not convereged’)
end
here, i have to change the coulum again and again. i want to automate it in a way that it gives all the values where ‘no’ is at once.
kindly help.this is the code i’m using.
data = readtable(‘FINALconvergencecheck_ksst.xlsx’);
data.Properties.VariableNames(1) = "an6cd";
data.Properties.VariableNames(3) = "an6cl";
data.Properties.VariableNames(5) = "an6cm";
data.Properties.VariableNames(7) = "ap0cd";
data.Properties.VariableNames(9) = "ap0cl";
data.Properties.VariableNames(11) = "ap0cm";
data.Properties.VariableNames(13) = "ap3cd";
data.Properties.VariableNames(15) = "ap3cl";
data.Properties.VariableNames(17) = "ap3cm";
data.Properties.VariableNames(19) = "ap7cd";
data.Properties.VariableNames(21) = "ap7cl";
data.Properties.VariableNames(23) = "ap7cm";
data.Properties.VariableNames(25) = "ap10cd";
data.Properties.VariableNames(27) = "ap10cl";
data.Properties.VariableNames(29) = "ap10cm";
data.Properties.VariableNames(31) = "ap12cd";
data.Properties.VariableNames(33) = "ap12cl";
data.Properties.VariableNames(35) = "ap12cm";
data.Properties.VariableNames(37) = "ap14cd";
data.Properties.VariableNames(39) = "ap14cl";
data.Properties.VariableNames(41) = "ap14cm";
data.Properties.VariableNames(43) = "ap15cd";
data.Properties.VariableNames(45) = "ap15cl";
data.Properties.VariableNames(47) = "ap15cm";
data.Properties.VariableNames(49) = "ap17cd";
data.Properties.VariableNames(51) = "ap17cl";
data.Properties.VariableNames(53) = "ap17cm";
data.Properties.VariableNames(2) = "an6cd_r";
data.Properties.VariableNames(4) = "an6cl_r";
data.Properties.VariableNames(6) = "an6cm_r";
data.Properties.VariableNames(8) = "ap0cd_r";
data.Properties.VariableNames(10) = "ap0cl_r";
data.Properties.VariableNames(12) = "ap0cm_r";
data.Properties.VariableNames(14) = "ap3cd_r";
data.Properties.VariableNames(16) = "ap3cl_r";
data.Properties.VariableNames(18) = "ap3cm_r";
data.Properties.VariableNames(20) = "ap7cd_r";
data.Properties.VariableNames(22) = "ap7cl_r";
data.Properties.VariableNames(24) = "ap7cm_r";
data.Properties.VariableNames(26) = "ap10cd_r";
data.Properties.VariableNames(28) = "ap10cl_r";
data.Properties.VariableNames(30) = "ap10cm_r";
data.Properties.VariableNames(32) = "ap12cd_r";
data.Properties.VariableNames(34) = "ap12cl_r";
data.Properties.VariableNames(36) = "ap12cm_r";
data.Properties.VariableNames(38) = "ap14cd_r";
data.Properties.VariableNames(40) = "ap14cl_r";
data.Properties.VariableNames(42) = "ap14cm_r";
data.Properties.VariableNames(44) = "ap15cd_r";
data.Properties.VariableNames(46) = "ap15cl_r";
data.Properties.VariableNames(48) = "ap15cm_r";
data.Properties.VariableNames(50) = "ap17cd_r";
data.Properties.VariableNames(52) = "ap17cl_r";
data.Properties.VariableNames(54) = "ap17cm_r";
display = find(data.ap10cl_r=="no");
k=display;
k1=string(k);
switch k1
case "yes"
disp(‘convereged’)
case "no"
disp(‘not convereged’)
end
here, i have to change the coulum again and again. i want to automate it in a way that it gives all the values where ‘no’ is at once.
kindly help. this is the code i’m using.
data = readtable(‘FINALconvergencecheck_ksst.xlsx’);
data.Properties.VariableNames(1) = "an6cd";
data.Properties.VariableNames(3) = "an6cl";
data.Properties.VariableNames(5) = "an6cm";
data.Properties.VariableNames(7) = "ap0cd";
data.Properties.VariableNames(9) = "ap0cl";
data.Properties.VariableNames(11) = "ap0cm";
data.Properties.VariableNames(13) = "ap3cd";
data.Properties.VariableNames(15) = "ap3cl";
data.Properties.VariableNames(17) = "ap3cm";
data.Properties.VariableNames(19) = "ap7cd";
data.Properties.VariableNames(21) = "ap7cl";
data.Properties.VariableNames(23) = "ap7cm";
data.Properties.VariableNames(25) = "ap10cd";
data.Properties.VariableNames(27) = "ap10cl";
data.Properties.VariableNames(29) = "ap10cm";
data.Properties.VariableNames(31) = "ap12cd";
data.Properties.VariableNames(33) = "ap12cl";
data.Properties.VariableNames(35) = "ap12cm";
data.Properties.VariableNames(37) = "ap14cd";
data.Properties.VariableNames(39) = "ap14cl";
data.Properties.VariableNames(41) = "ap14cm";
data.Properties.VariableNames(43) = "ap15cd";
data.Properties.VariableNames(45) = "ap15cl";
data.Properties.VariableNames(47) = "ap15cm";
data.Properties.VariableNames(49) = "ap17cd";
data.Properties.VariableNames(51) = "ap17cl";
data.Properties.VariableNames(53) = "ap17cm";
data.Properties.VariableNames(2) = "an6cd_r";
data.Properties.VariableNames(4) = "an6cl_r";
data.Properties.VariableNames(6) = "an6cm_r";
data.Properties.VariableNames(8) = "ap0cd_r";
data.Properties.VariableNames(10) = "ap0cl_r";
data.Properties.VariableNames(12) = "ap0cm_r";
data.Properties.VariableNames(14) = "ap3cd_r";
data.Properties.VariableNames(16) = "ap3cl_r";
data.Properties.VariableNames(18) = "ap3cm_r";
data.Properties.VariableNames(20) = "ap7cd_r";
data.Properties.VariableNames(22) = "ap7cl_r";
data.Properties.VariableNames(24) = "ap7cm_r";
data.Properties.VariableNames(26) = "ap10cd_r";
data.Properties.VariableNames(28) = "ap10cl_r";
data.Properties.VariableNames(30) = "ap10cm_r";
data.Properties.VariableNames(32) = "ap12cd_r";
data.Properties.VariableNames(34) = "ap12cl_r";
data.Properties.VariableNames(36) = "ap12cm_r";
data.Properties.VariableNames(38) = "ap14cd_r";
data.Properties.VariableNames(40) = "ap14cl_r";
data.Properties.VariableNames(42) = "ap14cm_r";
data.Properties.VariableNames(44) = "ap15cd_r";
data.Properties.VariableNames(46) = "ap15cl_r";
data.Properties.VariableNames(48) = "ap15cm_r";
data.Properties.VariableNames(50) = "ap17cd_r";
data.Properties.VariableNames(52) = "ap17cl_r";
data.Properties.VariableNames(54) = "ap17cm_r";
display = find(data.ap10cl_r=="no");
k=display;
k1=string(k);
switch k1
case "yes"
disp(‘convereged’)
case "no"
disp(‘not convereged’)
end
here, i have to change the coulum again and again. i want to automate it in a way that it gives all the values where ‘no’ is at once.
kindly help. excel, loop MATLAB Answers — New Questions
Process gain in System Identification seems off by 100
Hello,
Running a simple first order test process through System Identification, to make sure I understand the results.
The .mat file is attached with data, after which I import into a iddata.
The output of my data changes from 1000 down to 0 (data does not run far enough to get all the way to 0) and the input changes from 6 to 5.
I would expect a process gain of 1000 / 1 = 1000. However, SI is giving me 10?
Time constant is correct at 0.71sec. Delay is correct at 0.
load ("data.mat", "import");
model = iddata(import.out, import.co, 0.001)Hello,
Running a simple first order test process through System Identification, to make sure I understand the results.
The .mat file is attached with data, after which I import into a iddata.
The output of my data changes from 1000 down to 0 (data does not run far enough to get all the way to 0) and the input changes from 6 to 5.
I would expect a process gain of 1000 / 1 = 1000. However, SI is giving me 10?
Time constant is correct at 0.71sec. Delay is correct at 0.
load ("data.mat", "import");
model = iddata(import.out, import.co, 0.001) Hello,
Running a simple first order test process through System Identification, to make sure I understand the results.
The .mat file is attached with data, after which I import into a iddata.
The output of my data changes from 1000 down to 0 (data does not run far enough to get all the way to 0) and the input changes from 6 to 5.
I would expect a process gain of 1000 / 1 = 1000. However, SI is giving me 10?
Time constant is correct at 0.71sec. Delay is correct at 0.
load ("data.mat", "import");
model = iddata(import.out, import.co, 0.001) process gain, fopdt, handles MATLAB Answers — New Questions
Prevent Windows Update from shutting down Matlab session
I run Matlab simulations that sometimes take weeks to finish and, when Windows restarts due to an auto update, I lose all my work so I really need a way to stop auto restarts from interrupting my Matlab simulation.
Windows has an API that enables a process that has a window to block a system shutdown indefinitely until the user manually chooses what to do next. Applications like Matlab receive shutdown notifications through the WM_QUERYENDSESSION and WM_ENDSESSION messages.
How can I use this to stop my simulations from shutting down and trashing all my work?
Sometimes my sims are straightforward and easy to start up again where I left off but often they are very complex simulations with lots of complex states using vast amounts of memory that it would be very difficult to get back to without running from the start again.I run Matlab simulations that sometimes take weeks to finish and, when Windows restarts due to an auto update, I lose all my work so I really need a way to stop auto restarts from interrupting my Matlab simulation.
Windows has an API that enables a process that has a window to block a system shutdown indefinitely until the user manually chooses what to do next. Applications like Matlab receive shutdown notifications through the WM_QUERYENDSESSION and WM_ENDSESSION messages.
How can I use this to stop my simulations from shutting down and trashing all my work?
Sometimes my sims are straightforward and easy to start up again where I left off but often they are very complex simulations with lots of complex states using vast amounts of memory that it would be very difficult to get back to without running from the start again. I run Matlab simulations that sometimes take weeks to finish and, when Windows restarts due to an auto update, I lose all my work so I really need a way to stop auto restarts from interrupting my Matlab simulation.
Windows has an API that enables a process that has a window to block a system shutdown indefinitely until the user manually chooses what to do next. Applications like Matlab receive shutdown notifications through the WM_QUERYENDSESSION and WM_ENDSESSION messages.
How can I use this to stop my simulations from shutting down and trashing all my work?
Sometimes my sims are straightforward and easy to start up again where I left off but often they are very complex simulations with lots of complex states using vast amounts of memory that it would be very difficult to get back to without running from the start again. windows, restart, shutdown, auto update MATLAB Answers — New Questions
I need Matlab code for vibrating system with base excitation
I need Matlab code for vibrating system with base excitationI need Matlab code for vibrating system with base excitation I need Matlab code for vibrating system with base excitation vibrating system, base excitation MATLAB Answers — New Questions
how to do Open mouth detection
i m working on yawning detection system for that i need open mouth detection code using matlab 2013 version. please helpi m working on yawning detection system for that i need open mouth detection code using matlab 2013 version. please help i m working on yawning detection system for that i need open mouth detection code using matlab 2013 version. please help open mouth detection, yawning detection MATLAB Answers — New Questions
Error on simbiology: Unable to load the project because the project format is not compatible with SimBiology. Error using load.
I have been working on a project for some time, and today I installed the R2024a version of matlab, and continued working on it. I had no issues in the morning or afternoon, but for some reason when I tried to save my changes made today, it returned an error that it could not be saved. So I closed the program to try and get the last version saved before the error. However, when trying to open it again, I now get the following error:
"Unable to load the project. The following error occurred: Unable to load project because the project format is not compatible with Simbiology. The following error occurred: Error using load. File name is empty."
I have no idea of what could have caused it. Is there a way to recover my project?I have been working on a project for some time, and today I installed the R2024a version of matlab, and continued working on it. I had no issues in the morning or afternoon, but for some reason when I tried to save my changes made today, it returned an error that it could not be saved. So I closed the program to try and get the last version saved before the error. However, when trying to open it again, I now get the following error:
"Unable to load the project. The following error occurred: Unable to load project because the project format is not compatible with Simbiology. The following error occurred: Error using load. File name is empty."
I have no idea of what could have caused it. Is there a way to recover my project? I have been working on a project for some time, and today I installed the R2024a version of matlab, and continued working on it. I had no issues in the morning or afternoon, but for some reason when I tried to save my changes made today, it returned an error that it could not be saved. So I closed the program to try and get the last version saved before the error. However, when trying to open it again, I now get the following error:
"Unable to load the project. The following error occurred: Unable to load project because the project format is not compatible with Simbiology. The following error occurred: Error using load. File name is empty."
I have no idea of what could have caused it. Is there a way to recover my project? simbiology, error, load project MATLAB Answers — New Questions
How to convert a 1×1 struct to double matrix (error using pan tompkin)?
I’m trying to use Pan Tompkins code to detect QRS from ECG signal, and I’m facing a problem, the code defines ecg as vector, but there’s part of the code function that uses this line:
ecg_h = filtfilt(a,b,ecg);
But ecg has to be a double matrix for filtfilt function to work. I tried loading the signal before defining it as ecg because it gets loaded as double matrix, but that didn’t work, I kept getting undevined variable error.
% Load data
ecg=load(‘ECGdata.mat’);
fs = 500; % Sampling frequency
t = (0:length(ecg)-1) /fs;
gr=1;
QRS=pan_tompkin(ecg,fs,gr);I’m trying to use Pan Tompkins code to detect QRS from ECG signal, and I’m facing a problem, the code defines ecg as vector, but there’s part of the code function that uses this line:
ecg_h = filtfilt(a,b,ecg);
But ecg has to be a double matrix for filtfilt function to work. I tried loading the signal before defining it as ecg because it gets loaded as double matrix, but that didn’t work, I kept getting undevined variable error.
% Load data
ecg=load(‘ECGdata.mat’);
fs = 500; % Sampling frequency
t = (0:length(ecg)-1) /fs;
gr=1;
QRS=pan_tompkin(ecg,fs,gr); I’m trying to use Pan Tompkins code to detect QRS from ECG signal, and I’m facing a problem, the code defines ecg as vector, but there’s part of the code function that uses this line:
ecg_h = filtfilt(a,b,ecg);
But ecg has to be a double matrix for filtfilt function to work. I tried loading the signal before defining it as ecg because it gets loaded as double matrix, but that didn’t work, I kept getting undevined variable error.
% Load data
ecg=load(‘ECGdata.mat’);
fs = 500; % Sampling frequency
t = (0:length(ecg)-1) /fs;
gr=1;
QRS=pan_tompkin(ecg,fs,gr); pan_tompkin, ecg, qrs, vector, matrix, reshape MATLAB Answers — New Questions
OBTENTION OF AN ABSORBANCE SPECTRA FROM AN IMAGE
I want to process images from light spectra to obtain an absorbance vs wavelength plot. However, the ligth spectra is only a small part of the image, and i do not understand how to set the wavelengths at the pixels they correspond. That is to say, only the light spectra is half of the image (for example), how do i know when wavelengths start to count in the visible spectra.I want to process images from light spectra to obtain an absorbance vs wavelength plot. However, the ligth spectra is only a small part of the image, and i do not understand how to set the wavelengths at the pixels they correspond. That is to say, only the light spectra is half of the image (for example), how do i know when wavelengths start to count in the visible spectra. I want to process images from light spectra to obtain an absorbance vs wavelength plot. However, the ligth spectra is only a small part of the image, and i do not understand how to set the wavelengths at the pixels they correspond. That is to say, only the light spectra is half of the image (for example), how do i know when wavelengths start to count in the visible spectra. spectroscopy, image processing, wavelength MATLAB Answers — New Questions
how to install supported CUDA Toolkit 10.2 on Ubuntu 20.04 LTS Linux
As you can see here, the CUDA Toolkit currently suported by R2020b is 10.2. But, as you can see here , the only supported version of Ubuntu Linux by CUDA Toolkit 10.2 is Ubuntu 16.04 and 18.04, not 20.04.
How can I install supported version of CUDA toolkit 10.2 on clean installation of Ubuntu 20.04? What is the official install procedure for Ubuntu 20.04 Linux??? Where can I find detailed description of CUDA toolkit 10.2 installation procedure for already officially supported Ubuntu 20.04?
The situatiion is even worst, because different versions of CUDA Toolkit requires different versions of GCC compilers, which are not officially supported by current version of MATLAB, see here. CUDA Toolkit 10.2 requires GCC 7, but GCC version supported GPU (CUDA) for R2020b is GCC 8.
So, I think that this situation is, at least, a bit confusing. But the fact is, that is absolutely not clear how to install currently supported CUDA toolkit (version 10.2) on currently supported linux distribution (Ubuntu 20.04), which is really strange?!As you can see here, the CUDA Toolkit currently suported by R2020b is 10.2. But, as you can see here , the only supported version of Ubuntu Linux by CUDA Toolkit 10.2 is Ubuntu 16.04 and 18.04, not 20.04.
How can I install supported version of CUDA toolkit 10.2 on clean installation of Ubuntu 20.04? What is the official install procedure for Ubuntu 20.04 Linux??? Where can I find detailed description of CUDA toolkit 10.2 installation procedure for already officially supported Ubuntu 20.04?
The situatiion is even worst, because different versions of CUDA Toolkit requires different versions of GCC compilers, which are not officially supported by current version of MATLAB, see here. CUDA Toolkit 10.2 requires GCC 7, but GCC version supported GPU (CUDA) for R2020b is GCC 8.
So, I think that this situation is, at least, a bit confusing. But the fact is, that is absolutely not clear how to install currently supported CUDA toolkit (version 10.2) on currently supported linux distribution (Ubuntu 20.04), which is really strange?! As you can see here, the CUDA Toolkit currently suported by R2020b is 10.2. But, as you can see here , the only supported version of Ubuntu Linux by CUDA Toolkit 10.2 is Ubuntu 16.04 and 18.04, not 20.04.
How can I install supported version of CUDA toolkit 10.2 on clean installation of Ubuntu 20.04? What is the official install procedure for Ubuntu 20.04 Linux??? Where can I find detailed description of CUDA toolkit 10.2 installation procedure for already officially supported Ubuntu 20.04?
The situatiion is even worst, because different versions of CUDA Toolkit requires different versions of GCC compilers, which are not officially supported by current version of MATLAB, see here. CUDA Toolkit 10.2 requires GCC 7, but GCC version supported GPU (CUDA) for R2020b is GCC 8.
So, I think that this situation is, at least, a bit confusing. But the fact is, that is absolutely not clear how to install currently supported CUDA toolkit (version 10.2) on currently supported linux distribution (Ubuntu 20.04), which is really strange?! cuda toolkit MATLAB Answers — New Questions
wrong type variable in uitable
function startupFcn(app, set)
app.InstrumTab=LoadInstrum_Struct(set);
app.Setting=set;
app.UITable.Data=app.InstrumTab;
app.UITable.ColumnName=["ProductName";"Ticker";"PointValue";"IntradayMargin";"OvernightMargin";"Slippage(x trade)";"MiniContractTicker";"PointValue1";"IntradayMargin1";"OvernightMargin1";"Slippage1(x trade)";"MicroContractTicker";"PointValue2";"IntradayMargin2";"OvernightMargin2";"Slippage2(x trade)";"Group";"Currency";"ExtraMinUnit"];
app.UITable.ColumnEditable=true;
app.UITable.VariableTypes={‘char’,’char’,’double’,’double’,’double’,’double’,’char’,’double’,’double’,’double’,’double’,’char’,’double’,’double’,’double’,’double’,’char’,’char’,’double’,’logical’};
%questo-…(poi occorre salvarlo)
end
function SaveButtonPushed(app, event)
app.UITableCellSelection();
Instrum_Tab=app.InstrumTab;
disp(Instrum_Tab)
Instrument=string(app.Setting.Instrument);
save(Instrument,’Instrum_Tab’);
end
i add data in a table(row 35) and i save it (SaveButtonPushed)
But i see it’s a char and not a double (in app.uitable i set :
app.UITable.VariableTypes={‘char’,’char’,’double’,’double’,’double’,’double’,’char’,’double’,’double’,’double’,’double’,’char’,’double’,’double’,’double’,’double’,’char’,’char’,’double’,’logical’};)function startupFcn(app, set)
app.InstrumTab=LoadInstrum_Struct(set);
app.Setting=set;
app.UITable.Data=app.InstrumTab;
app.UITable.ColumnName=["ProductName";"Ticker";"PointValue";"IntradayMargin";"OvernightMargin";"Slippage(x trade)";"MiniContractTicker";"PointValue1";"IntradayMargin1";"OvernightMargin1";"Slippage1(x trade)";"MicroContractTicker";"PointValue2";"IntradayMargin2";"OvernightMargin2";"Slippage2(x trade)";"Group";"Currency";"ExtraMinUnit"];
app.UITable.ColumnEditable=true;
app.UITable.VariableTypes={‘char’,’char’,’double’,’double’,’double’,’double’,’char’,’double’,’double’,’double’,’double’,’char’,’double’,’double’,’double’,’double’,’char’,’char’,’double’,’logical’};
%questo-…(poi occorre salvarlo)
end
function SaveButtonPushed(app, event)
app.UITableCellSelection();
Instrum_Tab=app.InstrumTab;
disp(Instrum_Tab)
Instrument=string(app.Setting.Instrument);
save(Instrument,’Instrum_Tab’);
end
i add data in a table(row 35) and i save it (SaveButtonPushed)
But i see it’s a char and not a double (in app.uitable i set :
app.UITable.VariableTypes={‘char’,’char’,’double’,’double’,’double’,’double’,’char’,’double’,’double’,’double’,’double’,’char’,’double’,’double’,’double’,’double’,’char’,’char’,’double’,’logical’};) function startupFcn(app, set)
app.InstrumTab=LoadInstrum_Struct(set);
app.Setting=set;
app.UITable.Data=app.InstrumTab;
app.UITable.ColumnName=["ProductName";"Ticker";"PointValue";"IntradayMargin";"OvernightMargin";"Slippage(x trade)";"MiniContractTicker";"PointValue1";"IntradayMargin1";"OvernightMargin1";"Slippage1(x trade)";"MicroContractTicker";"PointValue2";"IntradayMargin2";"OvernightMargin2";"Slippage2(x trade)";"Group";"Currency";"ExtraMinUnit"];
app.UITable.ColumnEditable=true;
app.UITable.VariableTypes={‘char’,’char’,’double’,’double’,’double’,’double’,’char’,’double’,’double’,’double’,’double’,’char’,’double’,’double’,’double’,’double’,’char’,’char’,’double’,’logical’};
%questo-…(poi occorre salvarlo)
end
function SaveButtonPushed(app, event)
app.UITableCellSelection();
Instrum_Tab=app.InstrumTab;
disp(Instrum_Tab)
Instrument=string(app.Setting.Instrument);
save(Instrument,’Instrum_Tab’);
end
i add data in a table(row 35) and i save it (SaveButtonPushed)
But i see it’s a char and not a double (in app.uitable i set :
app.UITable.VariableTypes={‘char’,’char’,’double’,’double’,’double’,’double’,’char’,’double’,’double’,’double’,’double’,’char’,’double’,’double’,’double’,’double’,’char’,’char’,’double’,’logical’};) wrong type variable in uitable MATLAB Answers — New Questions
KdV ODE third-order
It is necessary to find a solution that satisfies the boundary conditions:
u′′′+u′+λu=f.
initial conditions:
u′′(0)=u′(0)+u(0),
u′′(1)=u(1),
u′(1)=u(1),
How to define and in matlab?
where λ>0, ;, , and – given numbers.
≤
where C is a positive constant independent of 𝑢 and f
clear;
syms y(x) y0 lambda u
Dy = diff(y);
D2y = diff(y,2);
D2y_2 = diff(y,2);
D3y = diff(y,3);
ode = D3y + lambda*u == y(x);
ySol(x) = dsolve(ode);It is necessary to find a solution that satisfies the boundary conditions:
u′′′+u′+λu=f.
initial conditions:
u′′(0)=u′(0)+u(0),
u′′(1)=u(1),
u′(1)=u(1),
How to define and in matlab?
where λ>0, ;, , and – given numbers.
≤
where C is a positive constant independent of 𝑢 and f
clear;
syms y(x) y0 lambda u
Dy = diff(y);
D2y = diff(y,2);
D2y_2 = diff(y,2);
D3y = diff(y,3);
ode = D3y + lambda*u == y(x);
ySol(x) = dsolve(ode); It is necessary to find a solution that satisfies the boundary conditions:
u′′′+u′+λu=f.
initial conditions:
u′′(0)=u′(0)+u(0),
u′′(1)=u(1),
u′(1)=u(1),
How to define and in matlab?
where λ>0, ;, , and – given numbers.
≤
where C is a positive constant independent of 𝑢 and f
clear;
syms y(x) y0 lambda u
Dy = diff(y);
D2y = diff(y,2);
D2y_2 = diff(y,2);
D3y = diff(y,3);
ode = D3y + lambda*u == y(x);
ySol(x) = dsolve(ode); ode, kdv, third-order, sobol-dim, matlab MATLAB Answers — New Questions
how to set variable type in uitable
function startupFcn(app, set)
app.InstrumTab=LoadInstrum_Struct(set);
app.Setting=set;
app.UITable.Data=app.InstrumTab;
app.UITable.ColumnName=["ProductName";"Ticker";"PointValue";"IntradayMargin";"OvernightMargin";"Slippage(x trade)";"MiniContractTicker";"PointValue1";"IntradayMargin1";"OvernightMargin1";"Slippage1(x trade)";"MicroContractTicker";"PointValue2";"IntradayMargin2";"OvernightMargin2";"Slippage2(x trade)";"Group";"Currency";"ExtraMinUnit"];
app.UITable.ColumnEditable=true;
%questo-…(poi occorre salvarlo)
how do I save values in table using variable typo: Example: [double,’char’]function startupFcn(app, set)
app.InstrumTab=LoadInstrum_Struct(set);
app.Setting=set;
app.UITable.Data=app.InstrumTab;
app.UITable.ColumnName=["ProductName";"Ticker";"PointValue";"IntradayMargin";"OvernightMargin";"Slippage(x trade)";"MiniContractTicker";"PointValue1";"IntradayMargin1";"OvernightMargin1";"Slippage1(x trade)";"MicroContractTicker";"PointValue2";"IntradayMargin2";"OvernightMargin2";"Slippage2(x trade)";"Group";"Currency";"ExtraMinUnit"];
app.UITable.ColumnEditable=true;
%questo-…(poi occorre salvarlo)
how do I save values in table using variable typo: Example: [double,’char’] function startupFcn(app, set)
app.InstrumTab=LoadInstrum_Struct(set);
app.Setting=set;
app.UITable.Data=app.InstrumTab;
app.UITable.ColumnName=["ProductName";"Ticker";"PointValue";"IntradayMargin";"OvernightMargin";"Slippage(x trade)";"MiniContractTicker";"PointValue1";"IntradayMargin1";"OvernightMargin1";"Slippage1(x trade)";"MicroContractTicker";"PointValue2";"IntradayMargin2";"OvernightMargin2";"Slippage2(x trade)";"Group";"Currency";"ExtraMinUnit"];
app.UITable.ColumnEditable=true;
%questo-…(poi occorre salvarlo)
how do I save values in table using variable typo: Example: [double,’char’] how to set variable type in uitable MATLAB Answers — New Questions
Image classification Deep Learning on ARM
I have a surface pro 9 with snapdragon chip that has an in-built neural processing unit. I need to perform image classification on that which should be as fast as possible. But currently on surface it is taking way longer than expected. I need matlab to use NPU for the classification. Can it be done?I have a surface pro 9 with snapdragon chip that has an in-built neural processing unit. I need to perform image classification on that which should be as fast as possible. But currently on surface it is taking way longer than expected. I need matlab to use NPU for the classification. Can it be done? I have a surface pro 9 with snapdragon chip that has an in-built neural processing unit. I need to perform image classification on that which should be as fast as possible. But currently on surface it is taking way longer than expected. I need matlab to use NPU for the classification. Can it be done? deep learning, image, ms surface pro, snapdragon cpu with nn unit, image classification MATLAB Answers — New Questions
combine spectrogram result in one figure
I have 20 min signal and would like to combine its sepectogram become one spectrogram consecutively. my idea is put index of each S, P, T value and then joining together in one array then using imagesc. But I don’t know if this flow is effective, since I have to combine for each 20 minutes into a month.
I write part of coding but I don’t know how to looping index for spectogram result.
Please help me.
%% SPECTROGRAM
clc, close all, clear all
set(0,’DefaultFigureWindowStyle’,’docked’)
datafold = uigetdir(pwd,’Select data Folder’);
myfiles=dir([datafold ‘/*.DAT’]);
N = length(myfiles) ; % total number of files
data = cell(N,1)
for i = 1:N
thisfile = myfiles(i).name ;
y = importdata(thisfile);
t=(0:length(y)-1)’;
Nspec=512;
wspec=hamming(Nspec);
Noverlap=Nspec/2;
fs=100;
[Si,Fi,Ti,P]=spectrogram(y,wspec,Noverlap,Nspec,fs,’xaxis’);
% nexttile
% imagesc(T/60,F,10*log10(P));
% axis xy;
% axesHandle.YLim = [0.1 10000];
% colormap default;
% cbar = colorbar;
% cbar.Label.String = {‘Intensity in dB’};
% xlabel(‘Time (s)’);
% ylabel(‘Freqwency(Hz)’);
% title(‘Spectrogram with RemInsRes’);
endI have 20 min signal and would like to combine its sepectogram become one spectrogram consecutively. my idea is put index of each S, P, T value and then joining together in one array then using imagesc. But I don’t know if this flow is effective, since I have to combine for each 20 minutes into a month.
I write part of coding but I don’t know how to looping index for spectogram result.
Please help me.
%% SPECTROGRAM
clc, close all, clear all
set(0,’DefaultFigureWindowStyle’,’docked’)
datafold = uigetdir(pwd,’Select data Folder’);
myfiles=dir([datafold ‘/*.DAT’]);
N = length(myfiles) ; % total number of files
data = cell(N,1)
for i = 1:N
thisfile = myfiles(i).name ;
y = importdata(thisfile);
t=(0:length(y)-1)’;
Nspec=512;
wspec=hamming(Nspec);
Noverlap=Nspec/2;
fs=100;
[Si,Fi,Ti,P]=spectrogram(y,wspec,Noverlap,Nspec,fs,’xaxis’);
% nexttile
% imagesc(T/60,F,10*log10(P));
% axis xy;
% axesHandle.YLim = [0.1 10000];
% colormap default;
% cbar = colorbar;
% cbar.Label.String = {‘Intensity in dB’};
% xlabel(‘Time (s)’);
% ylabel(‘Freqwency(Hz)’);
% title(‘Spectrogram with RemInsRes’);
end I have 20 min signal and would like to combine its sepectogram become one spectrogram consecutively. my idea is put index of each S, P, T value and then joining together in one array then using imagesc. But I don’t know if this flow is effective, since I have to combine for each 20 minutes into a month.
I write part of coding but I don’t know how to looping index for spectogram result.
Please help me.
%% SPECTROGRAM
clc, close all, clear all
set(0,’DefaultFigureWindowStyle’,’docked’)
datafold = uigetdir(pwd,’Select data Folder’);
myfiles=dir([datafold ‘/*.DAT’]);
N = length(myfiles) ; % total number of files
data = cell(N,1)
for i = 1:N
thisfile = myfiles(i).name ;
y = importdata(thisfile);
t=(0:length(y)-1)’;
Nspec=512;
wspec=hamming(Nspec);
Noverlap=Nspec/2;
fs=100;
[Si,Fi,Ti,P]=spectrogram(y,wspec,Noverlap,Nspec,fs,’xaxis’);
% nexttile
% imagesc(T/60,F,10*log10(P));
% axis xy;
% axesHandle.YLim = [0.1 10000];
% colormap default;
% cbar = colorbar;
% cbar.Label.String = {‘Intensity in dB’};
% xlabel(‘Time (s)’);
% ylabel(‘Freqwency(Hz)’);
% title(‘Spectrogram with RemInsRes’);
end combine spectrogram, spectrogram MATLAB Answers — New Questions