Tag Archives: matlab
2024a seems to have a graphics bug
A fresh install, on a macbook with the Apple M1 chip, and a total deletion of the ~/Library/Application Support/MathWorks files on Macos 14.6.1, when the first command is
close all
I get the following worring error:
>> close all
Warning: Initializing MATLAB Graphics failed.
This indicates a potentially serious problem in your MATLAB
setup, which should be resolved as soon as possible. Error
detected was:
MATLAB:minrhs
Not enough input arguments.
> In hgrc (line 154)
In matlab.graphics.internal.initialize (line 15)
>> plot(rand(1,10),rand(1,10))
>> close all
>> close all
>>
However, as can be seen, everything is fine once a plot has been made.
Best, JonA fresh install, on a macbook with the Apple M1 chip, and a total deletion of the ~/Library/Application Support/MathWorks files on Macos 14.6.1, when the first command is
close all
I get the following worring error:
>> close all
Warning: Initializing MATLAB Graphics failed.
This indicates a potentially serious problem in your MATLAB
setup, which should be resolved as soon as possible. Error
detected was:
MATLAB:minrhs
Not enough input arguments.
> In hgrc (line 154)
In matlab.graphics.internal.initialize (line 15)
>> plot(rand(1,10),rand(1,10))
>> close all
>> close all
>>
However, as can be seen, everything is fine once a plot has been made.
Best, Jon A fresh install, on a macbook with the Apple M1 chip, and a total deletion of the ~/Library/Application Support/MathWorks files on Macos 14.6.1, when the first command is
close all
I get the following worring error:
>> close all
Warning: Initializing MATLAB Graphics failed.
This indicates a potentially serious problem in your MATLAB
setup, which should be resolved as soon as possible. Error
detected was:
MATLAB:minrhs
Not enough input arguments.
> In hgrc (line 154)
In matlab.graphics.internal.initialize (line 15)
>> plot(rand(1,10),rand(1,10))
>> close all
>> close all
>>
However, as can be seen, everything is fine once a plot has been made.
Best, Jon initialization, graphics, failed, close MATLAB Answers — New Questions
Signal Processing Onramp (Preprocessing Signals — Extract Interesting Regions)
You can extract the data from the surface waves by removing extra points before and after. You can find the Extract Signals option in the Region of Interest section.
TASK
Extract the selected region from the harp, pax, and wanc signals. Make sure that the extracted signals are named harp_ROI, pax_ROI, and wanc_ROI respectively and display them.
Error I’m getting:
Have all three signals been cropped?You can extract the data from the surface waves by removing extra points before and after. You can find the Extract Signals option in the Region of Interest section.
TASK
Extract the selected region from the harp, pax, and wanc signals. Make sure that the extracted signals are named harp_ROI, pax_ROI, and wanc_ROI respectively and display them.
Error I’m getting:
Have all three signals been cropped? You can extract the data from the surface waves by removing extra points before and after. You can find the Extract Signals option in the Region of Interest section.
TASK
Extract the selected region from the harp, pax, and wanc signals. Make sure that the extracted signals are named harp_ROI, pax_ROI, and wanc_ROI respectively and display them.
Error I’m getting:
Have all three signals been cropped? signal processing, matlab MATLAB Answers — New Questions
Error: Index exceeds the number of array elements. Index must not exceed 2 (SIMULINK)
Hi there,
I have been running this simulation for months now but only suddenly is this giving this error. I have not changed it one bit (I think) and it suddenly can’t run. Please help!
run(‘PMDCcontrol.slx’)Hi there,
I have been running this simulation for months now but only suddenly is this giving this error. I have not changed it one bit (I think) and it suddenly can’t run. Please help!
run(‘PMDCcontrol.slx’) Hi there,
I have been running this simulation for months now but only suddenly is this giving this error. I have not changed it one bit (I think) and it suddenly can’t run. Please help!
run(‘PMDCcontrol.slx’) simulink, error MATLAB Answers — New Questions
How to use Aspen Plus – Matlab Link?
Please help me I am new to Matlab and Aspen Plus but have basic knowledge so please guide in detail. Please tell me what steps do I follow to link Aspen file and Matlab.
The Matlab cod file is:
%% Created by Ing. Andrés Felipe Abril. Universidad Nacional de Colombia. Departamento de Ingeniería Química.
%% Linking
Aspen = actxserver(‘Apwn.Document.36.0’); %34.0 —> V8.8; 35.0 —> V9.0; and 36.0 —> V10.0
[stat,mess]=fileattrib; % get attributes of folder (Necessary to establish the location of the simulation)
Simulation_Name = ‘Reactive_Distillation’;% Aspeen Plus Simulation Name
Aspen.invoke(‘InitFromArchive2’,[mess.Name ” Simulation_Name ‘.bkp’]);
Aspen.Visible = 1; % 1 —> Aspen is Visible; 0 —> Aspen is open but not visible
Aspen.SuppressDialogs = 1; % Suppress windows dialogs.
Aspen.Engine.Run2(1); % Run the simulation
while Aspen.Engine.IsRunning == 1 % 1 –> If Aspen is running; 0 —> If Aspen stop.
pause(0.5);
end
%% Example of Application
Reflux_Ratio = [1, 3, 5, 7];
for i = 1:length(Reflux_Ratio)
Aspen.Tree.FindNode("DataBlocksRC-101InputBASIS_RR").Value = Reflux_Ratio(i); % Column Reflux
Aspen.Reinit; % Reinit simulation
Aspen.Engine.Run2(1); %Run the simulation. (1) —> Matlab isnt busy; (0) Matlab is Busy;
time = 1;
while Aspen.Engine.IsRunning == 1 % 1 –> If Aspen is running; 0 —> If Aspen stop.
pause(0.5);
time = time+1;
if time==15 % Control of simulation time.
Aspen.Engine.Stop;
end
end
Simulation_Convergency = Aspen.Tree.FindNode("DataResults SummaryRun-StatusOutputPCESSTAT").Value; % 1 Doesn’t Convergence; 0 Converge
if Simulation_Convergency == 0 && time < 10
Duty(i) = Aspen.Tree.FindNode("DataBlocksRC-101OutputREB_UTL_DUTY").Value; %Duty value of reactive column
else
Duty(i) = inf; % Its Penalized if simulation doesn’t converge;
end
end
%% Plotting
figure()
plot(Reflux_Ratio, Duty, ‘ok’);
Aspen.Close;
Aspen.Quit;Please help me I am new to Matlab and Aspen Plus but have basic knowledge so please guide in detail. Please tell me what steps do I follow to link Aspen file and Matlab.
The Matlab cod file is:
%% Created by Ing. Andrés Felipe Abril. Universidad Nacional de Colombia. Departamento de Ingeniería Química.
%% Linking
Aspen = actxserver(‘Apwn.Document.36.0’); %34.0 —> V8.8; 35.0 —> V9.0; and 36.0 —> V10.0
[stat,mess]=fileattrib; % get attributes of folder (Necessary to establish the location of the simulation)
Simulation_Name = ‘Reactive_Distillation’;% Aspeen Plus Simulation Name
Aspen.invoke(‘InitFromArchive2’,[mess.Name ” Simulation_Name ‘.bkp’]);
Aspen.Visible = 1; % 1 —> Aspen is Visible; 0 —> Aspen is open but not visible
Aspen.SuppressDialogs = 1; % Suppress windows dialogs.
Aspen.Engine.Run2(1); % Run the simulation
while Aspen.Engine.IsRunning == 1 % 1 –> If Aspen is running; 0 —> If Aspen stop.
pause(0.5);
end
%% Example of Application
Reflux_Ratio = [1, 3, 5, 7];
for i = 1:length(Reflux_Ratio)
Aspen.Tree.FindNode("DataBlocksRC-101InputBASIS_RR").Value = Reflux_Ratio(i); % Column Reflux
Aspen.Reinit; % Reinit simulation
Aspen.Engine.Run2(1); %Run the simulation. (1) —> Matlab isnt busy; (0) Matlab is Busy;
time = 1;
while Aspen.Engine.IsRunning == 1 % 1 –> If Aspen is running; 0 —> If Aspen stop.
pause(0.5);
time = time+1;
if time==15 % Control of simulation time.
Aspen.Engine.Stop;
end
end
Simulation_Convergency = Aspen.Tree.FindNode("DataResults SummaryRun-StatusOutputPCESSTAT").Value; % 1 Doesn’t Convergence; 0 Converge
if Simulation_Convergency == 0 && time < 10
Duty(i) = Aspen.Tree.FindNode("DataBlocksRC-101OutputREB_UTL_DUTY").Value; %Duty value of reactive column
else
Duty(i) = inf; % Its Penalized if simulation doesn’t converge;
end
end
%% Plotting
figure()
plot(Reflux_Ratio, Duty, ‘ok’);
Aspen.Close;
Aspen.Quit; Please help me I am new to Matlab and Aspen Plus but have basic knowledge so please guide in detail. Please tell me what steps do I follow to link Aspen file and Matlab.
The Matlab cod file is:
%% Created by Ing. Andrés Felipe Abril. Universidad Nacional de Colombia. Departamento de Ingeniería Química.
%% Linking
Aspen = actxserver(‘Apwn.Document.36.0’); %34.0 —> V8.8; 35.0 —> V9.0; and 36.0 —> V10.0
[stat,mess]=fileattrib; % get attributes of folder (Necessary to establish the location of the simulation)
Simulation_Name = ‘Reactive_Distillation’;% Aspeen Plus Simulation Name
Aspen.invoke(‘InitFromArchive2’,[mess.Name ” Simulation_Name ‘.bkp’]);
Aspen.Visible = 1; % 1 —> Aspen is Visible; 0 —> Aspen is open but not visible
Aspen.SuppressDialogs = 1; % Suppress windows dialogs.
Aspen.Engine.Run2(1); % Run the simulation
while Aspen.Engine.IsRunning == 1 % 1 –> If Aspen is running; 0 —> If Aspen stop.
pause(0.5);
end
%% Example of Application
Reflux_Ratio = [1, 3, 5, 7];
for i = 1:length(Reflux_Ratio)
Aspen.Tree.FindNode("DataBlocksRC-101InputBASIS_RR").Value = Reflux_Ratio(i); % Column Reflux
Aspen.Reinit; % Reinit simulation
Aspen.Engine.Run2(1); %Run the simulation. (1) —> Matlab isnt busy; (0) Matlab is Busy;
time = 1;
while Aspen.Engine.IsRunning == 1 % 1 –> If Aspen is running; 0 —> If Aspen stop.
pause(0.5);
time = time+1;
if time==15 % Control of simulation time.
Aspen.Engine.Stop;
end
end
Simulation_Convergency = Aspen.Tree.FindNode("DataResults SummaryRun-StatusOutputPCESSTAT").Value; % 1 Doesn’t Convergence; 0 Converge
if Simulation_Convergency == 0 && time < 10
Duty(i) = Aspen.Tree.FindNode("DataBlocksRC-101OutputREB_UTL_DUTY").Value; %Duty value of reactive column
else
Duty(i) = inf; % Its Penalized if simulation doesn’t converge;
end
end
%% Plotting
figure()
plot(Reflux_Ratio, Duty, ‘ok’);
Aspen.Close;
Aspen.Quit; aspen plus MATLAB Answers — New Questions
how to model heat transfer to a pipe from furnace
Hello
I am trying to model a thermal fluid system where a furnace provides heat to pipe TL in simscape. at the moment, the mass flow rate of the fuel is 0, but i get the following errors:
At time 20.000000, one or more assertions are triggered. Temperature at port A must be less than or equal to Maximum valid temperature. The assertion comes from: Block path: pumpandpipe07082024/Pipe (TL)Assert location: o (location information is protected) o (location information is protected)
Ungroup 25 similar
Component:Simulink | Category:Model warning
An error occurred while running the simulation and the simulation was terminated
Caused by:
Derivative of state ‘pumpandpipe07082024.Pipe_TL.segment.p_I’ in block ‘pumpandpipe07082024/Pipe (TL)’ at time 50.0 is not finite. The simulation will be stopped. There may be a singularity in the solution. If not, try reducing the step size (either by reducing the fixed step size or by tightening the error tolerances)Hello
I am trying to model a thermal fluid system where a furnace provides heat to pipe TL in simscape. at the moment, the mass flow rate of the fuel is 0, but i get the following errors:
At time 20.000000, one or more assertions are triggered. Temperature at port A must be less than or equal to Maximum valid temperature. The assertion comes from: Block path: pumpandpipe07082024/Pipe (TL)Assert location: o (location information is protected) o (location information is protected)
Ungroup 25 similar
Component:Simulink | Category:Model warning
An error occurred while running the simulation and the simulation was terminated
Caused by:
Derivative of state ‘pumpandpipe07082024.Pipe_TL.segment.p_I’ in block ‘pumpandpipe07082024/Pipe (TL)’ at time 50.0 is not finite. The simulation will be stopped. There may be a singularity in the solution. If not, try reducing the step size (either by reducing the fixed step size or by tightening the error tolerances) Hello
I am trying to model a thermal fluid system where a furnace provides heat to pipe TL in simscape. at the moment, the mass flow rate of the fuel is 0, but i get the following errors:
At time 20.000000, one or more assertions are triggered. Temperature at port A must be less than or equal to Maximum valid temperature. The assertion comes from: Block path: pumpandpipe07082024/Pipe (TL)Assert location: o (location information is protected) o (location information is protected)
Ungroup 25 similar
Component:Simulink | Category:Model warning
An error occurred while running the simulation and the simulation was terminated
Caused by:
Derivative of state ‘pumpandpipe07082024.Pipe_TL.segment.p_I’ in block ‘pumpandpipe07082024/Pipe (TL)’ at time 50.0 is not finite. The simulation will be stopped. There may be a singularity in the solution. If not, try reducing the step size (either by reducing the fixed step size or by tightening the error tolerances) simscape, fluids, furnace MATLAB Answers — New Questions
Newton’s method gives NaN. Can someone improve my code?
Hello everybody. I’m using Newton’s method to solve a liner equation whose solution should be in [0 1]. Unfortunately, the coe I’m using gives NaN as a result for a specific combination of parameters and I would like to understand if I can improve the code I wrote for my Newton’s method. In the specific case I’m considering, I reach the maximum iterations even if the tolerance is very low.
function [x,n,ier] = newton(f,fd,x0,nmax,tol)
% Newton’s method for non-linear equations
ier = 0;
for n = 1:nmax
x = x0-f(x0)/fd(x0);
if abs(x-x0) <= tol
ier = 1;
break
end
x0 = x;
end
% % % % Script for solving NaN
mNAN= 16.1;
lNAN= 10^-4;
f= @(x) mNAN*x+lNAN*exp(mNAN*x)-lNAN*exp(mNAN);
Fd= @(x) mNAN*(1+lNAN*exp(mNAN*x));
tolNaN=10^-1;
nmax=10^8;
AB0 = 0.5;
[amNAN,nNAN,ierNAN]=newton(f,Fd,AB0,nmax,tolNaN);
amNAN
Llimit=f(0)
Ulimit=f(1)
fplot(@(x) mNAN*x+lNAN*exp(mNAN*x)-lNAN*exp(mNAN),[0 1.1])Hello everybody. I’m using Newton’s method to solve a liner equation whose solution should be in [0 1]. Unfortunately, the coe I’m using gives NaN as a result for a specific combination of parameters and I would like to understand if I can improve the code I wrote for my Newton’s method. In the specific case I’m considering, I reach the maximum iterations even if the tolerance is very low.
function [x,n,ier] = newton(f,fd,x0,nmax,tol)
% Newton’s method for non-linear equations
ier = 0;
for n = 1:nmax
x = x0-f(x0)/fd(x0);
if abs(x-x0) <= tol
ier = 1;
break
end
x0 = x;
end
% % % % Script for solving NaN
mNAN= 16.1;
lNAN= 10^-4;
f= @(x) mNAN*x+lNAN*exp(mNAN*x)-lNAN*exp(mNAN);
Fd= @(x) mNAN*(1+lNAN*exp(mNAN*x));
tolNaN=10^-1;
nmax=10^8;
AB0 = 0.5;
[amNAN,nNAN,ierNAN]=newton(f,Fd,AB0,nmax,tolNaN);
amNAN
Llimit=f(0)
Ulimit=f(1)
fplot(@(x) mNAN*x+lNAN*exp(mNAN*x)-lNAN*exp(mNAN),[0 1.1]) Hello everybody. I’m using Newton’s method to solve a liner equation whose solution should be in [0 1]. Unfortunately, the coe I’m using gives NaN as a result for a specific combination of parameters and I would like to understand if I can improve the code I wrote for my Newton’s method. In the specific case I’m considering, I reach the maximum iterations even if the tolerance is very low.
function [x,n,ier] = newton(f,fd,x0,nmax,tol)
% Newton’s method for non-linear equations
ier = 0;
for n = 1:nmax
x = x0-f(x0)/fd(x0);
if abs(x-x0) <= tol
ier = 1;
break
end
x0 = x;
end
% % % % Script for solving NaN
mNAN= 16.1;
lNAN= 10^-4;
f= @(x) mNAN*x+lNAN*exp(mNAN*x)-lNAN*exp(mNAN);
Fd= @(x) mNAN*(1+lNAN*exp(mNAN*x));
tolNaN=10^-1;
nmax=10^8;
AB0 = 0.5;
[amNAN,nNAN,ierNAN]=newton(f,Fd,AB0,nmax,tolNaN);
amNAN
Llimit=f(0)
Ulimit=f(1)
fplot(@(x) mNAN*x+lNAN*exp(mNAN*x)-lNAN*exp(mNAN),[0 1.1]) transferred MATLAB Answers — New Questions
Challenge with Simulating Loader Mechanism with Closed Kinematic Loop
I’m currently working on simulating a loader mechanism that includes a closed kinematic loop in its arm, actuated by two jacks. From my research, I understand that conducting a full multibody simulation in systems with a closed kinematic loop while all joints are actuated is impossible. Therefore, one of the actuators must be converted to an unactuated joint (Here is the Link for reference).
To address this, I left the right jack of the loader unactuated in my simulation and forced the left side to stay in a specific position, effectively conducting a static analysis (inverse dynamic) and recording the calculated forces on other joints, such as those between the chassis and the arm. Something like pictue below:
Here is my challenge:
When simulating the arm with only one active jack, the forces generated on the unactuated side of the loader are not accurate because the unactuated jack does not apply any force to the mechanism, which it does in reality. Am I correct in this understanding?
If so, how do others typically address this issue in their simulations?
Any insights or suggestions on how to properly simulate this mechanism would be greatly appreciated!I’m currently working on simulating a loader mechanism that includes a closed kinematic loop in its arm, actuated by two jacks. From my research, I understand that conducting a full multibody simulation in systems with a closed kinematic loop while all joints are actuated is impossible. Therefore, one of the actuators must be converted to an unactuated joint (Here is the Link for reference).
To address this, I left the right jack of the loader unactuated in my simulation and forced the left side to stay in a specific position, effectively conducting a static analysis (inverse dynamic) and recording the calculated forces on other joints, such as those between the chassis and the arm. Something like pictue below:
Here is my challenge:
When simulating the arm with only one active jack, the forces generated on the unactuated side of the loader are not accurate because the unactuated jack does not apply any force to the mechanism, which it does in reality. Am I correct in this understanding?
If so, how do others typically address this issue in their simulations?
Any insights or suggestions on how to properly simulate this mechanism would be greatly appreciated! I’m currently working on simulating a loader mechanism that includes a closed kinematic loop in its arm, actuated by two jacks. From my research, I understand that conducting a full multibody simulation in systems with a closed kinematic loop while all joints are actuated is impossible. Therefore, one of the actuators must be converted to an unactuated joint (Here is the Link for reference).
To address this, I left the right jack of the loader unactuated in my simulation and forced the left side to stay in a specific position, effectively conducting a static analysis (inverse dynamic) and recording the calculated forces on other joints, such as those between the chassis and the arm. Something like pictue below:
Here is my challenge:
When simulating the arm with only one active jack, the forces generated on the unactuated side of the loader are not accurate because the unactuated jack does not apply any force to the mechanism, which it does in reality. Am I correct in this understanding?
If so, how do others typically address this issue in their simulations?
Any insights or suggestions on how to properly simulate this mechanism would be greatly appreciated! simscape, simulation, guide MATLAB Answers — New Questions
Evaluate classification/regression performance against noisy annotation
Is there a way to evaluate classification/regression performance accounting of noisy annotations.
Let’s say I have a cat/dog detector and 1000 cat/dog test images. The 1000 images are human annotated, so it’s likely there are annotation errors, e.g. some bounding box may be incorrect and some class label may be wrong. Simply draw a confusion matrix or derive an IoU just compare the detector performance with the noisy data, and I don’t think such way is appropriate.
So my questions are
What’s the appropriate way to estimate the bbox and class error margin in the data set, given it’s not possible to go through each of them?
How to incorporate the above annotation error when reporting the performance of the cat/dog detector?
Thanks.Is there a way to evaluate classification/regression performance accounting of noisy annotations.
Let’s say I have a cat/dog detector and 1000 cat/dog test images. The 1000 images are human annotated, so it’s likely there are annotation errors, e.g. some bounding box may be incorrect and some class label may be wrong. Simply draw a confusion matrix or derive an IoU just compare the detector performance with the noisy data, and I don’t think such way is appropriate.
So my questions are
What’s the appropriate way to estimate the bbox and class error margin in the data set, given it’s not possible to go through each of them?
How to incorporate the above annotation error when reporting the performance of the cat/dog detector?
Thanks. Is there a way to evaluate classification/regression performance accounting of noisy annotations.
Let’s say I have a cat/dog detector and 1000 cat/dog test images. The 1000 images are human annotated, so it’s likely there are annotation errors, e.g. some bounding box may be incorrect and some class label may be wrong. Simply draw a confusion matrix or derive an IoU just compare the detector performance with the noisy data, and I don’t think such way is appropriate.
So my questions are
What’s the appropriate way to estimate the bbox and class error margin in the data set, given it’s not possible to go through each of them?
How to incorporate the above annotation error when reporting the performance of the cat/dog detector?
Thanks. annotation, classification, regression, noise, evaluation MATLAB Answers — New Questions
why my training results are repeated even after i run my code again and again ??
% ANN model for ukraine with all inputs
%% Data loading to the matlab environment
train_data = xlsread(‘Train_M.xlsx’);
input_train = xlsread(‘Train_M’,’input’);
X_train = input_train’;
target_train = xlsread(‘Train_M’,’target’);
T_train = target_train’;
test_data = xlsread(‘Test_M.xlsx’);
input_test = xlsread(‘Test_M’,’input’);
X_test = input_test’;
target_test = xlsread(‘Test_M’,’target’);
T_test = target_test’;
%% normalization of training and testing data
%for training
[Tr_i ps] = mapminmax(X_train,-1,1);
[Tr_t ps] = mapminmax(T_train,-1,1);
%for testing
[Tst_i pp] = mapminmax(X_test,-1,1);
[Tst_t pp] = mapminmax(T_test,-1,1);
%clear
%clc
%load Best_Dataset (need to save our datadivision for avoiding
%randomization)
%% GRNN model development
%% model formulation
spread = 0.42;
net = newgrnn(Tr_i,Tr_t,spread);
view(net);
%% prediction outputs of the model
y_tr = net(Tr_i);
y_tst = net(Tst_i);
%% renormalization process
% Model outputs(forecasted data)
Renorm_train_out = mapminmax(‘reverse’,y_tr,ps);
Renorm_test_out = mapminmax(‘reverse’,y_tst,pp);
%for model inputs(observed data)
Renorm_train_inp = mapminmax(‘reverse’,Tr_t,ps);
Renorm_test_inp = mapminmax(‘reverse’,Tst_t,pp);
%% performance of the ANN model
%Training performance and testing performance
plot(Renorm_test_inp,Renorm_test_out,’x’)%curves is ok
plot(Renorm_train_inp,Renorm_train_out,’x’)%curve is ok
%% statistical measure of the model
%% model performance command
mdl = fitlm(Renorm_test_inp,Renorm_test_out)%testing performance
mdl = fitlm(Renorm_train_inp,Renorm_train_out)%training performance
%% saving the trained model
save(‘GRNN_allinputs.mat’,’net’);
%% the results for the above code repeates.
R2 is 0.68, RMSE 10.8 – training
R2 is 0.639 ,RMSE 3.03 -testing
these results are again shown for the second run and so on
AM i missing something here ???
please help !!!!% ANN model for ukraine with all inputs
%% Data loading to the matlab environment
train_data = xlsread(‘Train_M.xlsx’);
input_train = xlsread(‘Train_M’,’input’);
X_train = input_train’;
target_train = xlsread(‘Train_M’,’target’);
T_train = target_train’;
test_data = xlsread(‘Test_M.xlsx’);
input_test = xlsread(‘Test_M’,’input’);
X_test = input_test’;
target_test = xlsread(‘Test_M’,’target’);
T_test = target_test’;
%% normalization of training and testing data
%for training
[Tr_i ps] = mapminmax(X_train,-1,1);
[Tr_t ps] = mapminmax(T_train,-1,1);
%for testing
[Tst_i pp] = mapminmax(X_test,-1,1);
[Tst_t pp] = mapminmax(T_test,-1,1);
%clear
%clc
%load Best_Dataset (need to save our datadivision for avoiding
%randomization)
%% GRNN model development
%% model formulation
spread = 0.42;
net = newgrnn(Tr_i,Tr_t,spread);
view(net);
%% prediction outputs of the model
y_tr = net(Tr_i);
y_tst = net(Tst_i);
%% renormalization process
% Model outputs(forecasted data)
Renorm_train_out = mapminmax(‘reverse’,y_tr,ps);
Renorm_test_out = mapminmax(‘reverse’,y_tst,pp);
%for model inputs(observed data)
Renorm_train_inp = mapminmax(‘reverse’,Tr_t,ps);
Renorm_test_inp = mapminmax(‘reverse’,Tst_t,pp);
%% performance of the ANN model
%Training performance and testing performance
plot(Renorm_test_inp,Renorm_test_out,’x’)%curves is ok
plot(Renorm_train_inp,Renorm_train_out,’x’)%curve is ok
%% statistical measure of the model
%% model performance command
mdl = fitlm(Renorm_test_inp,Renorm_test_out)%testing performance
mdl = fitlm(Renorm_train_inp,Renorm_train_out)%training performance
%% saving the trained model
save(‘GRNN_allinputs.mat’,’net’);
%% the results for the above code repeates.
R2 is 0.68, RMSE 10.8 – training
R2 is 0.639 ,RMSE 3.03 -testing
these results are again shown for the second run and so on
AM i missing something here ???
please help !!!! % ANN model for ukraine with all inputs
%% Data loading to the matlab environment
train_data = xlsread(‘Train_M.xlsx’);
input_train = xlsread(‘Train_M’,’input’);
X_train = input_train’;
target_train = xlsread(‘Train_M’,’target’);
T_train = target_train’;
test_data = xlsread(‘Test_M.xlsx’);
input_test = xlsread(‘Test_M’,’input’);
X_test = input_test’;
target_test = xlsread(‘Test_M’,’target’);
T_test = target_test’;
%% normalization of training and testing data
%for training
[Tr_i ps] = mapminmax(X_train,-1,1);
[Tr_t ps] = mapminmax(T_train,-1,1);
%for testing
[Tst_i pp] = mapminmax(X_test,-1,1);
[Tst_t pp] = mapminmax(T_test,-1,1);
%clear
%clc
%load Best_Dataset (need to save our datadivision for avoiding
%randomization)
%% GRNN model development
%% model formulation
spread = 0.42;
net = newgrnn(Tr_i,Tr_t,spread);
view(net);
%% prediction outputs of the model
y_tr = net(Tr_i);
y_tst = net(Tst_i);
%% renormalization process
% Model outputs(forecasted data)
Renorm_train_out = mapminmax(‘reverse’,y_tr,ps);
Renorm_test_out = mapminmax(‘reverse’,y_tst,pp);
%for model inputs(observed data)
Renorm_train_inp = mapminmax(‘reverse’,Tr_t,ps);
Renorm_test_inp = mapminmax(‘reverse’,Tst_t,pp);
%% performance of the ANN model
%Training performance and testing performance
plot(Renorm_test_inp,Renorm_test_out,’x’)%curves is ok
plot(Renorm_train_inp,Renorm_train_out,’x’)%curve is ok
%% statistical measure of the model
%% model performance command
mdl = fitlm(Renorm_test_inp,Renorm_test_out)%testing performance
mdl = fitlm(Renorm_train_inp,Renorm_train_out)%training performance
%% saving the trained model
save(‘GRNN_allinputs.mat’,’net’);
%% the results for the above code repeates.
R2 is 0.68, RMSE 10.8 – training
R2 is 0.639 ,RMSE 3.03 -testing
these results are again shown for the second run and so on
AM i missing something here ???
please help !!!! regression, general regression neural network, matlab, programming MATLAB Answers — New Questions
Why do I get “Maximum variable size allowed on the device is exceeded.” error when running the “semanticseg” function on my image and custom network?
I am trying to run the "semanticseg" function on an image with size (8557×11377) and my own custom network, and I receive the error:
ERROR: Error using nnet.internal.cnngpu.convolveForward2D
Maximum variable size allowed on the device is exceeded.
I expect MATLAB to tile the image, run the semantic segmentation, and reassemble the tile, but I am receiving this error on a windows laptop with a GTX 1070 card.
The two questions I have are:
1) Why do I receive this error message?
2) I would like to know what the maximum allowed image size I can have with my own custom network when running the "semanticseg" function.I am trying to run the "semanticseg" function on an image with size (8557×11377) and my own custom network, and I receive the error:
ERROR: Error using nnet.internal.cnngpu.convolveForward2D
Maximum variable size allowed on the device is exceeded.
I expect MATLAB to tile the image, run the semantic segmentation, and reassemble the tile, but I am receiving this error on a windows laptop with a GTX 1070 card.
The two questions I have are:
1) Why do I receive this error message?
2) I would like to know what the maximum allowed image size I can have with my own custom network when running the "semanticseg" function. I am trying to run the "semanticseg" function on an image with size (8557×11377) and my own custom network, and I receive the error:
ERROR: Error using nnet.internal.cnngpu.convolveForward2D
Maximum variable size allowed on the device is exceeded.
I expect MATLAB to tile the image, run the semantic segmentation, and reassemble the tile, but I am receiving this error on a windows laptop with a GTX 1070 card.
The two questions I have are:
1) Why do I receive this error message?
2) I would like to know what the maximum allowed image size I can have with my own custom network when running the "semanticseg" function. convolveforward2d, semanticseg MATLAB Answers — New Questions
ANSYS Fluent and Simulink co-simulation in real time.
Hello,
I want to test a temperature and air flow pattern in a room in ANSYS Fluent but the same time i want a co-simulation with Simulink so that i can modify parameters in Simulink and observe the variation in Fluent. How to do that….??
thanxHello,
I want to test a temperature and air flow pattern in a room in ANSYS Fluent but the same time i want a co-simulation with Simulink so that i can modify parameters in Simulink and observe the variation in Fluent. How to do that….??
thanx Hello,
I want to test a temperature and air flow pattern in a room in ANSYS Fluent but the same time i want a co-simulation with Simulink so that i can modify parameters in Simulink and observe the variation in Fluent. How to do that….??
thanx ansys fluent and simulink co-simulation in real ti MATLAB Answers — New Questions
how to make the numbers on the matrix with alternative sign?
I want to create a matrix that the main diagonal of K are alternatively 2 and -2’s, the sub- and sup-diagonal of K alternatively
1 and -1’s, and everywhere else 0. The size of K is 2n by 2n.
Here is what I got so far.
x=ones(1,5);
y=ones(1,4);
x2=2*x;
y2=y*-1;
z=diag(x2,0)
[rows, columns] = size(z)
z(1:2*rows+2:end) = -z(1:2*rows+2:end)
b=diag(y2,+1)
d=diag(y2,-1)
g=z+b+dI want to create a matrix that the main diagonal of K are alternatively 2 and -2’s, the sub- and sup-diagonal of K alternatively
1 and -1’s, and everywhere else 0. The size of K is 2n by 2n.
Here is what I got so far.
x=ones(1,5);
y=ones(1,4);
x2=2*x;
y2=y*-1;
z=diag(x2,0)
[rows, columns] = size(z)
z(1:2*rows+2:end) = -z(1:2*rows+2:end)
b=diag(y2,+1)
d=diag(y2,-1)
g=z+b+d I want to create a matrix that the main diagonal of K are alternatively 2 and -2’s, the sub- and sup-diagonal of K alternatively
1 and -1’s, and everywhere else 0. The size of K is 2n by 2n.
Here is what I got so far.
x=ones(1,5);
y=ones(1,4);
x2=2*x;
y2=y*-1;
z=diag(x2,0)
[rows, columns] = size(z)
z(1:2*rows+2:end) = -z(1:2*rows+2:end)
b=diag(y2,+1)
d=diag(y2,-1)
g=z+b+d matrix manipulation MATLAB Answers — New Questions
what toolbox functions can i use for shape and object recognition
Hi, i have a question about an assignment i have to do. In a assigment i need to do 3 things:
I take a picture of a IC integrated circuit on a black piece of paper. Then i imread it into my program.
1 – Count the amount of pins on a IC (integrated circuit) – DONE with thresholding a bw image + dilation + labeling and regionprops. That is can sort of do.
2 – The program needs to recognize if its NOT a picture of a IC (integrated circuit).
I know is asked but i dont know what toolbox function would me suited.
I guess some toolbox function do shape / object recognition? but i cant determin what is best.
3 – The program need to check if all the pins are connected to the body of the ic.
IC’s always have a even number of pins so that shall be a if else construction.
I especially need help with 2.
code can be providedHi, i have a question about an assignment i have to do. In a assigment i need to do 3 things:
I take a picture of a IC integrated circuit on a black piece of paper. Then i imread it into my program.
1 – Count the amount of pins on a IC (integrated circuit) – DONE with thresholding a bw image + dilation + labeling and regionprops. That is can sort of do.
2 – The program needs to recognize if its NOT a picture of a IC (integrated circuit).
I know is asked but i dont know what toolbox function would me suited.
I guess some toolbox function do shape / object recognition? but i cant determin what is best.
3 – The program need to check if all the pins are connected to the body of the ic.
IC’s always have a even number of pins so that shall be a if else construction.
I especially need help with 2.
code can be provided Hi, i have a question about an assignment i have to do. In a assigment i need to do 3 things:
I take a picture of a IC integrated circuit on a black piece of paper. Then i imread it into my program.
1 – Count the amount of pins on a IC (integrated circuit) – DONE with thresholding a bw image + dilation + labeling and regionprops. That is can sort of do.
2 – The program needs to recognize if its NOT a picture of a IC (integrated circuit).
I know is asked but i dont know what toolbox function would me suited.
I guess some toolbox function do shape / object recognition? but i cant determin what is best.
3 – The program need to check if all the pins are connected to the body of the ic.
IC’s always have a even number of pins so that shall be a if else construction.
I especially need help with 2.
code can be provided image processing, shape recognition, object recognition, integrated cicuit MATLAB Answers — New Questions
Dealing with .NET arrays and MarshalByRefObjects
I’m using an API from an Audio Precision to detect the available channels from an ASIO device. The API outputs a .NET array of type IChannelInfo[] that I can’t seem to get information from. If I create the array as chanInfo and try to access the first object either with chanInfo(1) or chanInfo.GetValue(1) or any other number of Methods, it just returns a "MarshalByRefObject" with no properties that I can’t figure out how to actually use. I would expect it to either just return a string like "Analog 2 (1)" or to return another .NET object that includes the name, channel number, etc.I’m using an API from an Audio Precision to detect the available channels from an ASIO device. The API outputs a .NET array of type IChannelInfo[] that I can’t seem to get information from. If I create the array as chanInfo and try to access the first object either with chanInfo(1) or chanInfo.GetValue(1) or any other number of Methods, it just returns a "MarshalByRefObject" with no properties that I can’t figure out how to actually use. I would expect it to either just return a string like "Analog 2 (1)" or to return another .NET object that includes the name, channel number, etc. I’m using an API from an Audio Precision to detect the available channels from an ASIO device. The API outputs a .NET array of type IChannelInfo[] that I can’t seem to get information from. If I create the array as chanInfo and try to access the first object either with chanInfo(1) or chanInfo.GetValue(1) or any other number of Methods, it just returns a "MarshalByRefObject" with no properties that I can’t figure out how to actually use. I would expect it to either just return a string like "Analog 2 (1)" or to return another .NET object that includes the name, channel number, etc. .net, system MATLAB Answers — New Questions
Simscape Multibody Link in Online Matlab platform
Hello, I’m using the online MATLAB interface with a school license, and I’d like to utilize Simscape Multibody Link to upload a Solidworks file and simulate the model. How can I achieve this on the online platform? I tried installing the latest Linux (glnxa64) version, but it didn’t work. Thank you in advance for your assistance!Hello, I’m using the online MATLAB interface with a school license, and I’d like to utilize Simscape Multibody Link to upload a Solidworks file and simulate the model. How can I achieve this on the online platform? I tried installing the latest Linux (glnxa64) version, but it didn’t work. Thank you in advance for your assistance! Hello, I’m using the online MATLAB interface with a school license, and I’d like to utilize Simscape Multibody Link to upload a Solidworks file and simulate the model. How can I achieve this on the online platform? I tried installing the latest Linux (glnxa64) version, but it didn’t work. Thank you in advance for your assistance! simscape MATLAB Answers — New Questions
How to give one x and y axis label when using tiled layout(‘flow’)?
I am using tiled layout(‘flow’) to plot a series of 20 plots on one figure. I want to have just one x and one y label for the entire figure, but when I try using the following code I get a figure that plots every subplot over each other.
figure()
t=tiledlayout(‘flow’);
autoCorr = zeros(ceil(length(dataSource)),N);
lag = zeros(ceil(length(dataSource)),N);
for ii=1:N
[autoCorr(:,ii),lag(:,ii)] = autocorrelation(dataSource(:,ii));
nexttile(t)
plot(lag(:,ii),autoCorr(:,ii))
end
title(t,’title’)
xlabel(t,’xlabel’)
ylabel(t,’ylabel’)
When I use this code the plot works fine but I’m not sure how to add the x and y axis labels.
autoCorr = zeros(ceil(length(dataSource)),N);
lag = zeros(ceil(length(dataSource)),N);
figure()
tiledlayout(‘flow’)
for ii=1:N
[autoCorr(:,ii),lag(:,ii)] = autocorrelation(dataSource(:,ii));
nexttile
plot(lag(:,ii),autoCorr(:,ii))
% xlim([100,fmax])
endI am using tiled layout(‘flow’) to plot a series of 20 plots on one figure. I want to have just one x and one y label for the entire figure, but when I try using the following code I get a figure that plots every subplot over each other.
figure()
t=tiledlayout(‘flow’);
autoCorr = zeros(ceil(length(dataSource)),N);
lag = zeros(ceil(length(dataSource)),N);
for ii=1:N
[autoCorr(:,ii),lag(:,ii)] = autocorrelation(dataSource(:,ii));
nexttile(t)
plot(lag(:,ii),autoCorr(:,ii))
end
title(t,’title’)
xlabel(t,’xlabel’)
ylabel(t,’ylabel’)
When I use this code the plot works fine but I’m not sure how to add the x and y axis labels.
autoCorr = zeros(ceil(length(dataSource)),N);
lag = zeros(ceil(length(dataSource)),N);
figure()
tiledlayout(‘flow’)
for ii=1:N
[autoCorr(:,ii),lag(:,ii)] = autocorrelation(dataSource(:,ii));
nexttile
plot(lag(:,ii),autoCorr(:,ii))
% xlim([100,fmax])
end I am using tiled layout(‘flow’) to plot a series of 20 plots on one figure. I want to have just one x and one y label for the entire figure, but when I try using the following code I get a figure that plots every subplot over each other.
figure()
t=tiledlayout(‘flow’);
autoCorr = zeros(ceil(length(dataSource)),N);
lag = zeros(ceil(length(dataSource)),N);
for ii=1:N
[autoCorr(:,ii),lag(:,ii)] = autocorrelation(dataSource(:,ii));
nexttile(t)
plot(lag(:,ii),autoCorr(:,ii))
end
title(t,’title’)
xlabel(t,’xlabel’)
ylabel(t,’ylabel’)
When I use this code the plot works fine but I’m not sure how to add the x and y axis labels.
autoCorr = zeros(ceil(length(dataSource)),N);
lag = zeros(ceil(length(dataSource)),N);
figure()
tiledlayout(‘flow’)
for ii=1:N
[autoCorr(:,ii),lag(:,ii)] = autocorrelation(dataSource(:,ii));
nexttile
plot(lag(:,ii),autoCorr(:,ii))
% xlim([100,fmax])
end tiled layout, tiledlayout, tiles, plot, subplot MATLAB Answers — New Questions
Dynamic Correction Factor Adjustment in Matlab to Match Slope (Power) in Log-Log Plot
Hello everyone,
I am working on a data analysis task where I need to dynamically adjust a correction factor for a dataset to match a specific slope in a log-log plot. The dataset consists of two main columns: Time (s) and Corrected Data (Factor 0.98578). My objective is to apply a rolling correction factor to the Corrected Data (Factor 0.98578) such that its slope in a log-log plot matches the slope of a reference dataset (which I have as Corrected Data (Factor 0.98578)).
Dynamic Adjustment: The correction factor should start with a 0.98578 and decrease dynamically over time to ensure the slope of the corrected Corrected Data (Factor 0.98578) aligns with the target slope (not necessarly).
I am seeking advice or suggestions on how to implement this in Matlab. Any guidance on formulas, functions, or scripting approaches that could effectively handle this task would be greatly appreciated.
Thank you in advance for your help!Hello everyone,
I am working on a data analysis task where I need to dynamically adjust a correction factor for a dataset to match a specific slope in a log-log plot. The dataset consists of two main columns: Time (s) and Corrected Data (Factor 0.98578). My objective is to apply a rolling correction factor to the Corrected Data (Factor 0.98578) such that its slope in a log-log plot matches the slope of a reference dataset (which I have as Corrected Data (Factor 0.98578)).
Dynamic Adjustment: The correction factor should start with a 0.98578 and decrease dynamically over time to ensure the slope of the corrected Corrected Data (Factor 0.98578) aligns with the target slope (not necessarly).
I am seeking advice or suggestions on how to implement this in Matlab. Any guidance on formulas, functions, or scripting approaches that could effectively handle this task would be greatly appreciated.
Thank you in advance for your help! Hello everyone,
I am working on a data analysis task where I need to dynamically adjust a correction factor for a dataset to match a specific slope in a log-log plot. The dataset consists of two main columns: Time (s) and Corrected Data (Factor 0.98578). My objective is to apply a rolling correction factor to the Corrected Data (Factor 0.98578) such that its slope in a log-log plot matches the slope of a reference dataset (which I have as Corrected Data (Factor 0.98578)).
Dynamic Adjustment: The correction factor should start with a 0.98578 and decrease dynamically over time to ensure the slope of the corrected Corrected Data (Factor 0.98578) aligns with the target slope (not necessarly).
I am seeking advice or suggestions on how to implement this in Matlab. Any guidance on formulas, functions, or scripting approaches that could effectively handle this task would be greatly appreciated.
Thank you in advance for your help! data, importing excel data, slope, data analysis, curve fitting MATLAB Answers — New Questions
Sequence oder Featureinput layer ?
Hello dear Community,
i am currently trying to use a Feed-Forward Neural Network for a regression problem.
The input data i want to feed in are "rotational speed", "torque" and "time".
The target data is the temperature of an electrical drive.
And then i will have different operating points dependend on speed:
2000 rpm, 4000 rpm ….
The torque and time however stays the same for each point.
Right now, i am using a sequenceInputLayer and arranged the Data in 4 cells, where each cell contains 3 columns of data. One cell represents one OP.
The results are not good, and my gut tells me, that i might have a misunderstanding the way i treat the input data.
I am using MATLAB r24a and am training the network with the "trainnet"-function.
If you have any Suggestions to do this in a different way, go ahead.
Thank you very much in advance.Hello dear Community,
i am currently trying to use a Feed-Forward Neural Network for a regression problem.
The input data i want to feed in are "rotational speed", "torque" and "time".
The target data is the temperature of an electrical drive.
And then i will have different operating points dependend on speed:
2000 rpm, 4000 rpm ….
The torque and time however stays the same for each point.
Right now, i am using a sequenceInputLayer and arranged the Data in 4 cells, where each cell contains 3 columns of data. One cell represents one OP.
The results are not good, and my gut tells me, that i might have a misunderstanding the way i treat the input data.
I am using MATLAB r24a and am training the network with the "trainnet"-function.
If you have any Suggestions to do this in a different way, go ahead.
Thank you very much in advance. Hello dear Community,
i am currently trying to use a Feed-Forward Neural Network for a regression problem.
The input data i want to feed in are "rotational speed", "torque" and "time".
The target data is the temperature of an electrical drive.
And then i will have different operating points dependend on speed:
2000 rpm, 4000 rpm ….
The torque and time however stays the same for each point.
Right now, i am using a sequenceInputLayer and arranged the Data in 4 cells, where each cell contains 3 columns of data. One cell represents one OP.
The results are not good, and my gut tells me, that i might have a misunderstanding the way i treat the input data.
I am using MATLAB r24a and am training the network with the "trainnet"-function.
If you have any Suggestions to do this in a different way, go ahead.
Thank you very much in advance. deep learning, neural network, regression, data MATLAB Answers — New Questions
is it possible to Stepper Motor Drive simulate at 10 milisecond fixed time step
is it possible to Stepper Motor Drive simulate at 10 milisecond fixed time stepis it possible to Stepper Motor Drive simulate at 10 milisecond fixed time step is it possible to Stepper Motor Drive simulate at 10 milisecond fixed time step transferred MATLAB Answers — New Questions
Why does the Mathworks provided model for See-in-the-Dark Data Set not give as good results as the original Tensorflow equivalent?
Please refer to the Matlab example (https://www.mathworks.com/help/images/learning-to-see-in-the-dark.html), This page itself acknowledges that "The colors of the network prediction are less saturated and vibrant than in the ground truth". I have compared it against the original TF model as provided by the original authors (https://github.com/cchen156/Learning-to-See-in-the-Dark) which DOES provide a very good reconstruction of the ground truth with vibrant colors. I have tried retraining the model in Matlab and got similarly poor results as the Matlab-provided pretrained model. Could someone please throw light on what could be causing this? I am afraid without a solution, Matlab example is not useful at all compared to the Tensorflow solution.Please refer to the Matlab example (https://www.mathworks.com/help/images/learning-to-see-in-the-dark.html), This page itself acknowledges that "The colors of the network prediction are less saturated and vibrant than in the ground truth". I have compared it against the original TF model as provided by the original authors (https://github.com/cchen156/Learning-to-See-in-the-Dark) which DOES provide a very good reconstruction of the ground truth with vibrant colors. I have tried retraining the model in Matlab and got similarly poor results as the Matlab-provided pretrained model. Could someone please throw light on what could be causing this? I am afraid without a solution, Matlab example is not useful at all compared to the Tensorflow solution. Please refer to the Matlab example (https://www.mathworks.com/help/images/learning-to-see-in-the-dark.html), This page itself acknowledges that "The colors of the network prediction are less saturated and vibrant than in the ground truth". I have compared it against the original TF model as provided by the original authors (https://github.com/cchen156/Learning-to-See-in-the-Dark) which DOES provide a very good reconstruction of the ground truth with vibrant colors. I have tried retraining the model in Matlab and got similarly poor results as the Matlab-provided pretrained model. Could someone please throw light on what could be causing this? I am afraid without a solution, Matlab example is not useful at all compared to the Tensorflow solution. see in the light dataset, image regression, low light enhancement MATLAB Answers — New Questions