Category: Matlab
Category Archives: Matlab
HELP PLEASE xpected Servo Input to be one of these types: numeric
PLEASE HELP I GOT THIS ERRORPLEASE HELP I GOT THIS ERROR PLEASE HELP I GOT THIS ERROR simulink, servo, potentiometer MATLAB Answers — New Questions
Struggling with FMU Exporting Simscape components, they work fine in simscape, but when I export to FMU and resimulate to test, the model fails.
I’m currently making a simple physical system (Gas, Mechanical in Simscape, consisting of a reservoir, two Compressors (G) (with an ideal angular velocity source), a Pipe (G) with a controlled heat flow source providing cooling, and a reservoir downstream to sink to. It’s a very simple system and more just being used as a high level model to test out FMU exports. None of the components are changed from default except for the Reservoirs, Heat Flow Sources providing some BCs, and the Compressor has Analytical parameterization and is being set to a specific design point based on a compressor data set that’s being used.
The model works fine in Simscape, I have a controller that admittedly takes a while to reach steady state but aside from that I’ve not seen any issues. When I export this model as an FMU, the model seems to break. I use the inputs that I’ve had before but they seem to break the model and give the following error:
Log from FMU: [category:logStatusError, status:fmi2Error] fmi2ExitInitializationMode(Output): : The co-simulation model block ‘FMU_Testbed/FMU’ is not running.
Log from FMU: [category:logAll, status:fmi2OK] CommunicationPoint=0, communicationStepSize=100.
Log from FMU: [category:logStatusError, status:fmi2Error] fmi2DoStep(Output): : The co-simulation model block ‘FMU_Testbed/FMU’ is not running.
Log from FMU: [category:logStatusError, status:fmi2Error] fmi2FreeInstance: The following error occurred while simulating model ‘PASS_nodata_fmu_draft’ : Initial conditions solve failed to converge.
…Here is the set of components with unconverged equations:
‘PASS_nodata_fmu_draft/Pipe (G)1’
Equation location is:
‘C:/Program Files/MATLAB/R2024a/toolbox/physmod/simscape/library/m/+foundation/+gas/+elements/pipe.ssc’ (line 351)
‘PASS_nodata_fmu_draft/Compressor (G)1’
Equation location is:
‘C:/Program Files/MATLAB/R2024a/toolbox/physmod/fluids/fluids/+fluids/+gas/+turbomachinery/compressor.sscp'(no line number info)
Equation location is:
‘C:/Program Files/MATLAB/R2024a/toolbox/physmod/fluids/fluids/+fluids/+gas/+turbomachinery/compressor.sscp'(no l
Component:Simulink | Category:Model
An error occurred during simulation and the simulation was terminated
Caused by:
Error in supplied FMU: An error occurred in function ‘fmi2DoStep’ for block ‘FMU_Testbed/FMU’ during simulation. For more information, see the FMU troubleshooting documentation.
Component:Simulink | Category:Block error
One theory I have is that because I’ve used Analytical mode as opposed to Tabulated parameterization, the compressor is struggling. This would explain why the FMU does seem to work after I increase the Speed, but the results are inaccurate (going from 0.3 kg/s to 14.3, and going from 101.3kPa to 10*4kPa)
Original Simscape Model:
FMU Block test (Constant inputs from Simscape were turned into inports and I’ve just been testing the FMU to see if they work):
Produces error mentioned earlier
FMU Block test, increased Speed:
Any help here would be appreciatedI’m currently making a simple physical system (Gas, Mechanical in Simscape, consisting of a reservoir, two Compressors (G) (with an ideal angular velocity source), a Pipe (G) with a controlled heat flow source providing cooling, and a reservoir downstream to sink to. It’s a very simple system and more just being used as a high level model to test out FMU exports. None of the components are changed from default except for the Reservoirs, Heat Flow Sources providing some BCs, and the Compressor has Analytical parameterization and is being set to a specific design point based on a compressor data set that’s being used.
The model works fine in Simscape, I have a controller that admittedly takes a while to reach steady state but aside from that I’ve not seen any issues. When I export this model as an FMU, the model seems to break. I use the inputs that I’ve had before but they seem to break the model and give the following error:
Log from FMU: [category:logStatusError, status:fmi2Error] fmi2ExitInitializationMode(Output): : The co-simulation model block ‘FMU_Testbed/FMU’ is not running.
Log from FMU: [category:logAll, status:fmi2OK] CommunicationPoint=0, communicationStepSize=100.
Log from FMU: [category:logStatusError, status:fmi2Error] fmi2DoStep(Output): : The co-simulation model block ‘FMU_Testbed/FMU’ is not running.
Log from FMU: [category:logStatusError, status:fmi2Error] fmi2FreeInstance: The following error occurred while simulating model ‘PASS_nodata_fmu_draft’ : Initial conditions solve failed to converge.
…Here is the set of components with unconverged equations:
‘PASS_nodata_fmu_draft/Pipe (G)1’
Equation location is:
‘C:/Program Files/MATLAB/R2024a/toolbox/physmod/simscape/library/m/+foundation/+gas/+elements/pipe.ssc’ (line 351)
‘PASS_nodata_fmu_draft/Compressor (G)1’
Equation location is:
‘C:/Program Files/MATLAB/R2024a/toolbox/physmod/fluids/fluids/+fluids/+gas/+turbomachinery/compressor.sscp'(no line number info)
Equation location is:
‘C:/Program Files/MATLAB/R2024a/toolbox/physmod/fluids/fluids/+fluids/+gas/+turbomachinery/compressor.sscp'(no l
Component:Simulink | Category:Model
An error occurred during simulation and the simulation was terminated
Caused by:
Error in supplied FMU: An error occurred in function ‘fmi2DoStep’ for block ‘FMU_Testbed/FMU’ during simulation. For more information, see the FMU troubleshooting documentation.
Component:Simulink | Category:Block error
One theory I have is that because I’ve used Analytical mode as opposed to Tabulated parameterization, the compressor is struggling. This would explain why the FMU does seem to work after I increase the Speed, but the results are inaccurate (going from 0.3 kg/s to 14.3, and going from 101.3kPa to 10*4kPa)
Original Simscape Model:
FMU Block test (Constant inputs from Simscape were turned into inports and I’ve just been testing the FMU to see if they work):
Produces error mentioned earlier
FMU Block test, increased Speed:
Any help here would be appreciated I’m currently making a simple physical system (Gas, Mechanical in Simscape, consisting of a reservoir, two Compressors (G) (with an ideal angular velocity source), a Pipe (G) with a controlled heat flow source providing cooling, and a reservoir downstream to sink to. It’s a very simple system and more just being used as a high level model to test out FMU exports. None of the components are changed from default except for the Reservoirs, Heat Flow Sources providing some BCs, and the Compressor has Analytical parameterization and is being set to a specific design point based on a compressor data set that’s being used.
The model works fine in Simscape, I have a controller that admittedly takes a while to reach steady state but aside from that I’ve not seen any issues. When I export this model as an FMU, the model seems to break. I use the inputs that I’ve had before but they seem to break the model and give the following error:
Log from FMU: [category:logStatusError, status:fmi2Error] fmi2ExitInitializationMode(Output): : The co-simulation model block ‘FMU_Testbed/FMU’ is not running.
Log from FMU: [category:logAll, status:fmi2OK] CommunicationPoint=0, communicationStepSize=100.
Log from FMU: [category:logStatusError, status:fmi2Error] fmi2DoStep(Output): : The co-simulation model block ‘FMU_Testbed/FMU’ is not running.
Log from FMU: [category:logStatusError, status:fmi2Error] fmi2FreeInstance: The following error occurred while simulating model ‘PASS_nodata_fmu_draft’ : Initial conditions solve failed to converge.
…Here is the set of components with unconverged equations:
‘PASS_nodata_fmu_draft/Pipe (G)1’
Equation location is:
‘C:/Program Files/MATLAB/R2024a/toolbox/physmod/simscape/library/m/+foundation/+gas/+elements/pipe.ssc’ (line 351)
‘PASS_nodata_fmu_draft/Compressor (G)1’
Equation location is:
‘C:/Program Files/MATLAB/R2024a/toolbox/physmod/fluids/fluids/+fluids/+gas/+turbomachinery/compressor.sscp'(no line number info)
Equation location is:
‘C:/Program Files/MATLAB/R2024a/toolbox/physmod/fluids/fluids/+fluids/+gas/+turbomachinery/compressor.sscp'(no l
Component:Simulink | Category:Model
An error occurred during simulation and the simulation was terminated
Caused by:
Error in supplied FMU: An error occurred in function ‘fmi2DoStep’ for block ‘FMU_Testbed/FMU’ during simulation. For more information, see the FMU troubleshooting documentation.
Component:Simulink | Category:Block error
One theory I have is that because I’ve used Analytical mode as opposed to Tabulated parameterization, the compressor is struggling. This would explain why the FMU does seem to work after I increase the Speed, but the results are inaccurate (going from 0.3 kg/s to 14.3, and going from 101.3kPa to 10*4kPa)
Original Simscape Model:
FMU Block test (Constant inputs from Simscape were turned into inports and I’ve just been testing the FMU to see if they work):
Produces error mentioned earlier
FMU Block test, increased Speed:
Any help here would be appreciated compressor (g), matlab, simscape, fluids, simulink, fmu, export MATLAB Answers — New Questions
how to have an optional bus signal inside a subsystem?
Hello,
I want to create a subsystem that I can reuse in different scenarios (maybe as subsystem reference, not really important).
I would like to pass the signal to this subsystem as a virtual bus.
Inside the subsystem I use the in bus element to get the signals I need from the bus.
Now, since I use this subsystem in different models/configurations there are signals that sometimes are present and sometimes are not present inside the virtual bus, like in the example image below: signal3 is not present inside the bus and so simulink throws the error:
Selected signal ‘signal3’ in the Bus Element Inport block ‘untitledeee/Subsystem1/In Bus Element1’ cannot be found in the input bus signal.
I would like to use a default value when I recognize that the input is missing. In matlab functions you can easily do this with optional arguments (link: arguments – defaultValue).
My question is: there is a way to replicate the optional arguments of matlab functions inside a subsystem/reference subsystem/model reference?
There is some suggested workaround?Hello,
I want to create a subsystem that I can reuse in different scenarios (maybe as subsystem reference, not really important).
I would like to pass the signal to this subsystem as a virtual bus.
Inside the subsystem I use the in bus element to get the signals I need from the bus.
Now, since I use this subsystem in different models/configurations there are signals that sometimes are present and sometimes are not present inside the virtual bus, like in the example image below: signal3 is not present inside the bus and so simulink throws the error:
Selected signal ‘signal3’ in the Bus Element Inport block ‘untitledeee/Subsystem1/In Bus Element1’ cannot be found in the input bus signal.
I would like to use a default value when I recognize that the input is missing. In matlab functions you can easily do this with optional arguments (link: arguments – defaultValue).
My question is: there is a way to replicate the optional arguments of matlab functions inside a subsystem/reference subsystem/model reference?
There is some suggested workaround? Hello,
I want to create a subsystem that I can reuse in different scenarios (maybe as subsystem reference, not really important).
I would like to pass the signal to this subsystem as a virtual bus.
Inside the subsystem I use the in bus element to get the signals I need from the bus.
Now, since I use this subsystem in different models/configurations there are signals that sometimes are present and sometimes are not present inside the virtual bus, like in the example image below: signal3 is not present inside the bus and so simulink throws the error:
Selected signal ‘signal3’ in the Bus Element Inport block ‘untitledeee/Subsystem1/In Bus Element1’ cannot be found in the input bus signal.
I would like to use a default value when I recognize that the input is missing. In matlab functions you can easily do this with optional arguments (link: arguments – defaultValue).
My question is: there is a way to replicate the optional arguments of matlab functions inside a subsystem/reference subsystem/model reference?
There is some suggested workaround? model reference, input, bus, model, simulink MATLAB Answers — New Questions
java.awt.IllegalComponentStateException: The frame is decorated
Hi,
I got the following error from an old code that I am trying to fix to work in modern version of matlab: (If there is an easy way to fix the bug, would be really helpful!)
Java exception occurred:
java.awt.IllegalComponentStateException: The frame is decorated
at java.awt.Frame.setOpacity(Frame.java:960)
at java.awt.Window$1.setOpacity(Window.java:4037)
at com.sun.awt.AWTUtilities.setWindowOpacity(AWTUtilities.java:174)
The original code is the following:
for stepIdx = 1 : 10
if stepIdx == 1
com.sun.awt.AWTUtilities.setWindowOpacity(jWindow1,0.01)
pause(0.25)
end
newAlpha = -.01 + 0.1*stepIdx;
com.sun.awt.AWTUtilities.setWindowOpacity(jWindow1,newAlpha)
jWindow1.repaint;
endHi,
I got the following error from an old code that I am trying to fix to work in modern version of matlab: (If there is an easy way to fix the bug, would be really helpful!)
Java exception occurred:
java.awt.IllegalComponentStateException: The frame is decorated
at java.awt.Frame.setOpacity(Frame.java:960)
at java.awt.Window$1.setOpacity(Window.java:4037)
at com.sun.awt.AWTUtilities.setWindowOpacity(AWTUtilities.java:174)
The original code is the following:
for stepIdx = 1 : 10
if stepIdx == 1
com.sun.awt.AWTUtilities.setWindowOpacity(jWindow1,0.01)
pause(0.25)
end
newAlpha = -.01 + 0.1*stepIdx;
com.sun.awt.AWTUtilities.setWindowOpacity(jWindow1,newAlpha)
jWindow1.repaint;
end Hi,
I got the following error from an old code that I am trying to fix to work in modern version of matlab: (If there is an easy way to fix the bug, would be really helpful!)
Java exception occurred:
java.awt.IllegalComponentStateException: The frame is decorated
at java.awt.Frame.setOpacity(Frame.java:960)
at java.awt.Window$1.setOpacity(Window.java:4037)
at com.sun.awt.AWTUtilities.setWindowOpacity(AWTUtilities.java:174)
The original code is the following:
for stepIdx = 1 : 10
if stepIdx == 1
com.sun.awt.AWTUtilities.setWindowOpacity(jWindow1,0.01)
pause(0.25)
end
newAlpha = -.01 + 0.1*stepIdx;
com.sun.awt.AWTUtilities.setWindowOpacity(jWindow1,newAlpha)
jWindow1.repaint;
end java frame MATLAB Answers — New Questions
Parfor Execution time variation
Hi,
I am using parfor for reading 600 .raw files.
c=zeros(1536,1536,600,’uint16′);
parpool(‘threads’,4);
parfor i=1:600
fileName=[folder,’/’,fileList(i).name];
a=fopen(fileName,’r’);
Z=fread(a,[1536 1536],’uint16′);
fclose(a);
c(:,:,i)=Z;
end
However, I am observing significant variability in the execution time, which ranges from 14 seconds to 110 seconds across different runs.
Why is this discrepancy occurring? Is there a way to achieve more consistent execution times?Hi,
I am using parfor for reading 600 .raw files.
c=zeros(1536,1536,600,’uint16′);
parpool(‘threads’,4);
parfor i=1:600
fileName=[folder,’/’,fileList(i).name];
a=fopen(fileName,’r’);
Z=fread(a,[1536 1536],’uint16′);
fclose(a);
c(:,:,i)=Z;
end
However, I am observing significant variability in the execution time, which ranges from 14 seconds to 110 seconds across different runs.
Why is this discrepancy occurring? Is there a way to achieve more consistent execution times? Hi,
I am using parfor for reading 600 .raw files.
c=zeros(1536,1536,600,’uint16′);
parpool(‘threads’,4);
parfor i=1:600
fileName=[folder,’/’,fileList(i).name];
a=fopen(fileName,’r’);
Z=fread(a,[1536 1536],’uint16′);
fclose(a);
c(:,:,i)=Z;
end
However, I am observing significant variability in the execution time, which ranges from 14 seconds to 110 seconds across different runs.
Why is this discrepancy occurring? Is there a way to achieve more consistent execution times? parfor, parallel computing, parallel computing toolbox MATLAB Answers — New Questions
How can I get the predicted YValidation data using LSTM model?
Hi, I did a LSTM model, just like the link mentioned(https://ww2.mathworks.cn/help/deeplearning/ref/trainnetwork.html), I specified the ValidationData in the opts.
options = trainingOptions("sgdm", …
MaxEpochs=8, …
ValidationData={XValidation,YValidation}, …
ValidationFrequency=30, …
Verbose=false, …
Plots="training-progress");
Because I want draw a picture including the YValidation data(which I specified) and predicted-YValidation data(which derived from the training net), the question is "How can I get the predicted YValidation data"?
Thank you!Hi, I did a LSTM model, just like the link mentioned(https://ww2.mathworks.cn/help/deeplearning/ref/trainnetwork.html), I specified the ValidationData in the opts.
options = trainingOptions("sgdm", …
MaxEpochs=8, …
ValidationData={XValidation,YValidation}, …
ValidationFrequency=30, …
Verbose=false, …
Plots="training-progress");
Because I want draw a picture including the YValidation data(which I specified) and predicted-YValidation data(which derived from the training net), the question is "How can I get the predicted YValidation data"?
Thank you! Hi, I did a LSTM model, just like the link mentioned(https://ww2.mathworks.cn/help/deeplearning/ref/trainnetwork.html), I specified the ValidationData in the opts.
options = trainingOptions("sgdm", …
MaxEpochs=8, …
ValidationData={XValidation,YValidation}, …
ValidationFrequency=30, …
Verbose=false, …
Plots="training-progress");
Because I want draw a picture including the YValidation data(which I specified) and predicted-YValidation data(which derived from the training net), the question is "How can I get the predicted YValidation data"?
Thank you! lstm, validation data MATLAB Answers — New Questions
Using simulink runtime data in callback functions
Hello, I am stressedup with App Designer. I have stateflow model in Simulink to be controlled from an app built in app designer. I am able to creat a Listener and a run time object in an updateGui helper function.
properties (Access = public)
status3; % Description
end
methods (Access = public)
function updateGUI(app, varargin)
% Create an object that gets the run-time value of the specified block
rto_2 = get_param(‘ChargingProcess/Display3′,’RuntimeObject’);
rto1 = get_param(‘ChargingProcess/CarBatteryOut1′,’RuntimeObject’);
% Update the GUI accordingly.
app.status3 = rto_2.InputPort(1).Data.char;
% app.EditField.Value = rto_2.InputPort(1).Data.char;
% Assign input from Car Battery Level(CarBatteryOut1) to Car Battery level 1 editfield
app.CarBatteryLevel1EditField.Value = rto1.InputPort(1).Data;
end
end
there are other objects which are not very necessary now
This works well and displays the information on the app as I want. Now, i need some of this information (status3) in a push button callback to control a a switch. First issue is that I cannot access the varriable status3 directly in a callback function. I treid to declear it as a property and call it in the button callback funtion. It is called but does not update as the simulation progresses.
The main idea is for the switch controlled by the button callback function to stay on ‘1’ when the button is pressed to the point when status3 matches a particular string ‘WaitAtStation’ and a certain edith field vallue == 100. In this case, I used a while loop. I treid to output the edith field value (gotten from simulink too ) with the same callback funtion but it also does not update as the value in the edith field changes
striingValue = num2str(app.status3)
function Charge1ButtonPushed(app, event)
set_param(‘ChargingProcess/ChargeMyCar1′,’sw’,’1′);
while (app.CarBatteryLevel1EditField.Value == 100 && strcmp(stringValue, ~’WaitAtStation’))
set_param(‘ChargingProcess/ChargeMyCar1′,’sw’,’0′);
end
end
This either doesnt work or freezes my system when the button is pushed. What i actually need help is;
1) How to get status3 and the app.CarBatteryLevel1EditField.Value in my callback function that will update as the actuall vallues change in simulink
2) A better way represent the logic because the while loop appears not to be doing the jobHello, I am stressedup with App Designer. I have stateflow model in Simulink to be controlled from an app built in app designer. I am able to creat a Listener and a run time object in an updateGui helper function.
properties (Access = public)
status3; % Description
end
methods (Access = public)
function updateGUI(app, varargin)
% Create an object that gets the run-time value of the specified block
rto_2 = get_param(‘ChargingProcess/Display3′,’RuntimeObject’);
rto1 = get_param(‘ChargingProcess/CarBatteryOut1′,’RuntimeObject’);
% Update the GUI accordingly.
app.status3 = rto_2.InputPort(1).Data.char;
% app.EditField.Value = rto_2.InputPort(1).Data.char;
% Assign input from Car Battery Level(CarBatteryOut1) to Car Battery level 1 editfield
app.CarBatteryLevel1EditField.Value = rto1.InputPort(1).Data;
end
end
there are other objects which are not very necessary now
This works well and displays the information on the app as I want. Now, i need some of this information (status3) in a push button callback to control a a switch. First issue is that I cannot access the varriable status3 directly in a callback function. I treid to declear it as a property and call it in the button callback funtion. It is called but does not update as the simulation progresses.
The main idea is for the switch controlled by the button callback function to stay on ‘1’ when the button is pressed to the point when status3 matches a particular string ‘WaitAtStation’ and a certain edith field vallue == 100. In this case, I used a while loop. I treid to output the edith field value (gotten from simulink too ) with the same callback funtion but it also does not update as the value in the edith field changes
striingValue = num2str(app.status3)
function Charge1ButtonPushed(app, event)
set_param(‘ChargingProcess/ChargeMyCar1′,’sw’,’1′);
while (app.CarBatteryLevel1EditField.Value == 100 && strcmp(stringValue, ~’WaitAtStation’))
set_param(‘ChargingProcess/ChargeMyCar1′,’sw’,’0′);
end
end
This either doesnt work or freezes my system when the button is pushed. What i actually need help is;
1) How to get status3 and the app.CarBatteryLevel1EditField.Value in my callback function that will update as the actuall vallues change in simulink
2) A better way represent the logic because the while loop appears not to be doing the job Hello, I am stressedup with App Designer. I have stateflow model in Simulink to be controlled from an app built in app designer. I am able to creat a Listener and a run time object in an updateGui helper function.
properties (Access = public)
status3; % Description
end
methods (Access = public)
function updateGUI(app, varargin)
% Create an object that gets the run-time value of the specified block
rto_2 = get_param(‘ChargingProcess/Display3′,’RuntimeObject’);
rto1 = get_param(‘ChargingProcess/CarBatteryOut1′,’RuntimeObject’);
% Update the GUI accordingly.
app.status3 = rto_2.InputPort(1).Data.char;
% app.EditField.Value = rto_2.InputPort(1).Data.char;
% Assign input from Car Battery Level(CarBatteryOut1) to Car Battery level 1 editfield
app.CarBatteryLevel1EditField.Value = rto1.InputPort(1).Data;
end
end
there are other objects which are not very necessary now
This works well and displays the information on the app as I want. Now, i need some of this information (status3) in a push button callback to control a a switch. First issue is that I cannot access the varriable status3 directly in a callback function. I treid to declear it as a property and call it in the button callback funtion. It is called but does not update as the simulation progresses.
The main idea is for the switch controlled by the button callback function to stay on ‘1’ when the button is pressed to the point when status3 matches a particular string ‘WaitAtStation’ and a certain edith field vallue == 100. In this case, I used a while loop. I treid to output the edith field value (gotten from simulink too ) with the same callback funtion but it also does not update as the value in the edith field changes
striingValue = num2str(app.status3)
function Charge1ButtonPushed(app, event)
set_param(‘ChargingProcess/ChargeMyCar1′,’sw’,’1′);
while (app.CarBatteryLevel1EditField.Value == 100 && strcmp(stringValue, ~’WaitAtStation’))
set_param(‘ChargingProcess/ChargeMyCar1′,’sw’,’0′);
end
end
This either doesnt work or freezes my system when the button is pushed. What i actually need help is;
1) How to get status3 and the app.CarBatteryLevel1EditField.Value in my callback function that will update as the actuall vallues change in simulink
2) A better way represent the logic because the while loop appears not to be doing the job share information in app designer MATLAB Answers — New Questions
Error ” Too many input arguments” occurs when using nlhw in EXAMPLE
Following the examples here to lear abount estimate nonlinear model.
After
openExample(‘ident/EstimateAHammersteinWienerModelExample’)
and press run button, I got this error output
Error using nlhw
Too many input arguments.
I debug a bit and found the error occurs at this line
[~, uC(~uNoNorm), uS(~uNoNorm)] = normalize(in(:,~uNoNorm),1,PV{:});
But I really did not figure out why. Thanks in advance for your kind help.Following the examples here to lear abount estimate nonlinear model.
After
openExample(‘ident/EstimateAHammersteinWienerModelExample’)
and press run button, I got this error output
Error using nlhw
Too many input arguments.
I debug a bit and found the error occurs at this line
[~, uC(~uNoNorm), uS(~uNoNorm)] = normalize(in(:,~uNoNorm),1,PV{:});
But I really did not figure out why. Thanks in advance for your kind help. Following the examples here to lear abount estimate nonlinear model.
After
openExample(‘ident/EstimateAHammersteinWienerModelExample’)
and press run button, I got this error output
Error using nlhw
Too many input arguments.
I debug a bit and found the error occurs at this line
[~, uC(~uNoNorm), uS(~uNoNorm)] = normalize(in(:,~uNoNorm),1,PV{:});
But I really did not figure out why. Thanks in advance for your kind help. system identification, nlhw, hammerstein-wiener model MATLAB Answers — New Questions
Impact of Electric vehicle charging on the distribution grid
Hey everyone,
I am doing my research on the impact of charging Electric Vehicle on the distribution grid and looking into parameters such as voltage profile, losses and transformer overloading. Are there any power distribution systems already created in Matlab or simulink that i can use for this purpose?Hey everyone,
I am doing my research on the impact of charging Electric Vehicle on the distribution grid and looking into parameters such as voltage profile, losses and transformer overloading. Are there any power distribution systems already created in Matlab or simulink that i can use for this purpose? Hey everyone,
I am doing my research on the impact of charging Electric Vehicle on the distribution grid and looking into parameters such as voltage profile, losses and transformer overloading. Are there any power distribution systems already created in Matlab or simulink that i can use for this purpose? ieee, power distribution systems MATLAB Answers — New Questions
Reattaching Visual Studio debugger fails to detect mex file modules
I am attempting to debug a Matlab "mex" file using Visual Studio.
I can attach Visual Studio to Matlab and set a breakpoint in my mex file source code just fine in the first go-around. When calling the mex file, visual studio stops at the breakpoint, and I note that the mex file is listed in the loaded modules:
However, if I de-attach visual studio, then re-attach, seems that visual studio no longer detects the loaded modules. See screenshot below, there are far fewer modules listed:
This is quite frustrating, as the only way I seem to be able to work around is to quit Matlab and re-start each time in need to re-attach the debugger (i.e. after tweaking code and rebuilding the mex file).
I used to do this all the time in the past (i.e. with VS 2010-2012 / Matlab R2012B-R2017B), but I’m stumped on this now using VS 2015 w/ Matlab R2019B.I am attempting to debug a Matlab "mex" file using Visual Studio.
I can attach Visual Studio to Matlab and set a breakpoint in my mex file source code just fine in the first go-around. When calling the mex file, visual studio stops at the breakpoint, and I note that the mex file is listed in the loaded modules:
However, if I de-attach visual studio, then re-attach, seems that visual studio no longer detects the loaded modules. See screenshot below, there are far fewer modules listed:
This is quite frustrating, as the only way I seem to be able to work around is to quit Matlab and re-start each time in need to re-attach the debugger (i.e. after tweaking code and rebuilding the mex file).
I used to do this all the time in the past (i.e. with VS 2010-2012 / Matlab R2012B-R2017B), but I’m stumped on this now using VS 2015 w/ Matlab R2019B. I am attempting to debug a Matlab "mex" file using Visual Studio.
I can attach Visual Studio to Matlab and set a breakpoint in my mex file source code just fine in the first go-around. When calling the mex file, visual studio stops at the breakpoint, and I note that the mex file is listed in the loaded modules:
However, if I de-attach visual studio, then re-attach, seems that visual studio no longer detects the loaded modules. See screenshot below, there are far fewer modules listed:
This is quite frustrating, as the only way I seem to be able to work around is to quit Matlab and re-start each time in need to re-attach the debugger (i.e. after tweaking code and rebuilding the mex file).
I used to do this all the time in the past (i.e. with VS 2010-2012 / Matlab R2012B-R2017B), but I’m stumped on this now using VS 2015 w/ Matlab R2019B. mex compiler, debug, mex, visual studio MATLAB Answers — New Questions
Matlab function to take matrix as input and return elements in its four corners as output
Hello, good day all, please I’m having difficulties writing a function to take a matrix input, and return the elements in its cour corners as an output.
Here is my code:
function [top_left,top_right,bottom_left,bottom_right] = corners(i,r,c)
A = matrix(i,r,c)
top_left = A(1,1);
top_right = A(1,c);
bottom_left = A(r,1);
bottom_right = A(r,c);
function B = matrix(i,r,c)
ind = i;
row = r;
col = c;
B = randi(ind,row,col);
I keep getting Not enough input arguments.
Error in corners (line 2)
A = matrix(i,r,c)
I’ll appreciate your response. Thanks.Hello, good day all, please I’m having difficulties writing a function to take a matrix input, and return the elements in its cour corners as an output.
Here is my code:
function [top_left,top_right,bottom_left,bottom_right] = corners(i,r,c)
A = matrix(i,r,c)
top_left = A(1,1);
top_right = A(1,c);
bottom_left = A(r,1);
bottom_right = A(r,c);
function B = matrix(i,r,c)
ind = i;
row = r;
col = c;
B = randi(ind,row,col);
I keep getting Not enough input arguments.
Error in corners (line 2)
A = matrix(i,r,c)
I’ll appreciate your response. Thanks. Hello, good day all, please I’m having difficulties writing a function to take a matrix input, and return the elements in its cour corners as an output.
Here is my code:
function [top_left,top_right,bottom_left,bottom_right] = corners(i,r,c)
A = matrix(i,r,c)
top_left = A(1,1);
top_right = A(1,c);
bottom_left = A(r,1);
bottom_right = A(r,c);
function B = matrix(i,r,c)
ind = i;
row = r;
col = c;
B = randi(ind,row,col);
I keep getting Not enough input arguments.
Error in corners (line 2)
A = matrix(i,r,c)
I’ll appreciate your response. Thanks. matrix and functions MATLAB Answers — New Questions
Matrix of fading colors
I’m trying to make a 256×256 matrix of colors fading into each other. The top left corner is red, the top right is purple, the bottom right is blue, and the bottom left is green. The blue and the red fade into each other, which is easy to figure out. The problem is the green fades out radially, in both directions, and I can’t get my image to do that. My code so far is:
mat3d(:,:,1) = zeros(256,256);
mat3d(:,:,2) = zeros(256,256);
mat3d(:,:,3) = zeros(256,256);
increase = linspace(0,1,256);
decrease = linspace(1,0,256);
for i = 1:256
mat3d(i,:,1) = decrease(i);
mat3d(:,i,3) = increase(i);
for j = 1:256
dist = sqrt((256-i)^2+(256-j)^2);
end
end
I can’t figure out how to write the last for loop.I’m trying to make a 256×256 matrix of colors fading into each other. The top left corner is red, the top right is purple, the bottom right is blue, and the bottom left is green. The blue and the red fade into each other, which is easy to figure out. The problem is the green fades out radially, in both directions, and I can’t get my image to do that. My code so far is:
mat3d(:,:,1) = zeros(256,256);
mat3d(:,:,2) = zeros(256,256);
mat3d(:,:,3) = zeros(256,256);
increase = linspace(0,1,256);
decrease = linspace(1,0,256);
for i = 1:256
mat3d(i,:,1) = decrease(i);
mat3d(:,i,3) = increase(i);
for j = 1:256
dist = sqrt((256-i)^2+(256-j)^2);
end
end
I can’t figure out how to write the last for loop. I’m trying to make a 256×256 matrix of colors fading into each other. The top left corner is red, the top right is purple, the bottom right is blue, and the bottom left is green. The blue and the red fade into each other, which is easy to figure out. The problem is the green fades out radially, in both directions, and I can’t get my image to do that. My code so far is:
mat3d(:,:,1) = zeros(256,256);
mat3d(:,:,2) = zeros(256,256);
mat3d(:,:,3) = zeros(256,256);
increase = linspace(0,1,256);
decrease = linspace(1,0,256);
for i = 1:256
mat3d(i,:,1) = decrease(i);
mat3d(:,i,3) = increase(i);
for j = 1:256
dist = sqrt((256-i)^2+(256-j)^2);
end
end
I can’t figure out how to write the last for loop. images, colors, fading colors, script MATLAB Answers — New Questions
System Generator for DSP 14.7 is only compatible with MATLAB 2013b?
https://www.xilinx.com/support/answers/17966.html
According to Xilinx AR# 17966
DSP Tools, System Generator for DSP, AccelDSP – Which versions of System Generator for DSP and AccelDSP synthesis tool are compatible with which versions of ISE design tools and MATLAB
It says System Generator for DSP 14.7 is only compatible with MATLAB 2013b?
Is this true?
System Generator for DSP 14.7
Operating System Support:
Windows 7 Professional
Windows XP Professional
Windows Server 2008 (64-bit)
Red Hat Enterprise 6 Workstation
Red Hat Enterprise 5 Workstation
SUSE Linux Enterprise 11
Support for 32-bit and 64-bit on all OS
Required:
ISE Design Suite 14.7 System Edition
MATLAB 2012a, 2012b, 2013a and 2013b from the MathWorks (requires Simulink Fixed-Point Toolbox for bus-widths greater than 53 bits)
Optional:
Synopsys Synplify Pro H-2013.03
Mentor Graphics ModelSim 10.1bhttps://www.xilinx.com/support/answers/17966.html
According to Xilinx AR# 17966
DSP Tools, System Generator for DSP, AccelDSP – Which versions of System Generator for DSP and AccelDSP synthesis tool are compatible with which versions of ISE design tools and MATLAB
It says System Generator for DSP 14.7 is only compatible with MATLAB 2013b?
Is this true?
System Generator for DSP 14.7
Operating System Support:
Windows 7 Professional
Windows XP Professional
Windows Server 2008 (64-bit)
Red Hat Enterprise 6 Workstation
Red Hat Enterprise 5 Workstation
SUSE Linux Enterprise 11
Support for 32-bit and 64-bit on all OS
Required:
ISE Design Suite 14.7 System Edition
MATLAB 2012a, 2012b, 2013a and 2013b from the MathWorks (requires Simulink Fixed-Point Toolbox for bus-widths greater than 53 bits)
Optional:
Synopsys Synplify Pro H-2013.03
Mentor Graphics ModelSim 10.1b https://www.xilinx.com/support/answers/17966.html
According to Xilinx AR# 17966
DSP Tools, System Generator for DSP, AccelDSP – Which versions of System Generator for DSP and AccelDSP synthesis tool are compatible with which versions of ISE design tools and MATLAB
It says System Generator for DSP 14.7 is only compatible with MATLAB 2013b?
Is this true?
System Generator for DSP 14.7
Operating System Support:
Windows 7 Professional
Windows XP Professional
Windows Server 2008 (64-bit)
Red Hat Enterprise 6 Workstation
Red Hat Enterprise 5 Workstation
SUSE Linux Enterprise 11
Support for 32-bit and 64-bit on all OS
Required:
ISE Design Suite 14.7 System Edition
MATLAB 2012a, 2012b, 2013a and 2013b from the MathWorks (requires Simulink Fixed-Point Toolbox for bus-widths greater than 53 bits)
Optional:
Synopsys Synplify Pro H-2013.03
Mentor Graphics ModelSim 10.1b simulink MATLAB Answers — New Questions
App Designer UIAxes Interactions not working when UIFigure WindowButtonMotion callback set
I want to use the WindowButtonMotion callback to produce a ‘hover’ effect on various images that I’m using as buttons on an App I’m designing, but it looks like just turning on the UIFigure’s WindowButtonMotion callback completely disables interactivity (pan, rotate, etc.) with the UIAxes. I have a surface plot showing a 3D render of the data the user is visualizing, but it becomes completely non-interactive when I use buttonmotion callbacks to track mouse movements for the mouse hover.
I’ve tried various ways to get around this, including setting the UIAxes.View property as a function of mouse positions when the mouse is within the UIAxes, but this seems really clunky, and I can’t seem to work out how to ‘click & drag’ to interact with the surface plot correctly.
Any solutions to re-enable plot interactions? I’m working on Matlab 2019a.I want to use the WindowButtonMotion callback to produce a ‘hover’ effect on various images that I’m using as buttons on an App I’m designing, but it looks like just turning on the UIFigure’s WindowButtonMotion callback completely disables interactivity (pan, rotate, etc.) with the UIAxes. I have a surface plot showing a 3D render of the data the user is visualizing, but it becomes completely non-interactive when I use buttonmotion callbacks to track mouse movements for the mouse hover.
I’ve tried various ways to get around this, including setting the UIAxes.View property as a function of mouse positions when the mouse is within the UIAxes, but this seems really clunky, and I can’t seem to work out how to ‘click & drag’ to interact with the surface plot correctly.
Any solutions to re-enable plot interactions? I’m working on Matlab 2019a. I want to use the WindowButtonMotion callback to produce a ‘hover’ effect on various images that I’m using as buttons on an App I’m designing, but it looks like just turning on the UIFigure’s WindowButtonMotion callback completely disables interactivity (pan, rotate, etc.) with the UIAxes. I have a surface plot showing a 3D render of the data the user is visualizing, but it becomes completely non-interactive when I use buttonmotion callbacks to track mouse movements for the mouse hover.
I’ve tried various ways to get around this, including setting the UIAxes.View property as a function of mouse positions when the mouse is within the UIAxes, but this seems really clunky, and I can’t seem to work out how to ‘click & drag’ to interact with the surface plot correctly.
Any solutions to re-enable plot interactions? I’m working on Matlab 2019a. appdesigner, uiaxes, interactions, pan, zoom, windowbuttonmotion, 3drotate, callback events MATLAB Answers — New Questions
Limit angle in [-90, 90] degree
As I was using ode45 to solve ODEs, I do not know to limit the result in [-90,90] degree. Anyone may provide some help?As I was using ode45 to solve ODEs, I do not know to limit the result in [-90,90] degree. Anyone may provide some help? As I was using ode45 to solve ODEs, I do not know to limit the result in [-90,90] degree. Anyone may provide some help? ode45, angle MATLAB Answers — New Questions
simulation does not work
Check your internet connection and proxy settings in MATLAB Web preferences and then try starting the feature again.
Detailed information:
Error code: -202
Error message: ERR_CERT_AUTHORITY_INVALIDCheck your internet connection and proxy settings in MATLAB Web preferences and then try starting the feature again.
Detailed information:
Error code: -202
Error message: ERR_CERT_AUTHORITY_INVALID Check your internet connection and proxy settings in MATLAB Web preferences and then try starting the feature again.
Detailed information:
Error code: -202
Error message: ERR_CERT_AUTHORITY_INVALID authority MATLAB Answers — New Questions
how to convert a monochrome image of depth 24 bits into a monochrome image of depth 8 bits ?
this is to convert a monochrome image of depth 24 bits into a monochrome image of depth 8 bits ?this is to convert a monochrome image of depth 24 bits into a monochrome image of depth 8 bits ? this is to convert a monochrome image of depth 24 bits into a monochrome image of depth 8 bits ? converstion of 24 bits to 8 bits depth MATLAB Answers — New Questions
How do I convert table data to double to manipulate them?
I extract data from a table. When I retrieve an element, it is in table format, but I encounter an error when attempting to perform operations like multiplication. Is there a direct command or a series of steps to address this issue?I extract data from a table. When I retrieve an element, it is in table format, but I encounter an error when attempting to perform operations like multiplication. Is there a direct command or a series of steps to address this issue? I extract data from a table. When I retrieve an element, it is in table format, but I encounter an error when attempting to perform operations like multiplication. Is there a direct command or a series of steps to address this issue? table2array MATLAB Answers — New Questions
Reading image into 16 bit signed int
Hello,
How do I read an image into 16 bit signed integer array?
I tried using im2int16 in-built function, but I do not have Image Processing Toolbox. Please let me know if there is any other way to do it.
Also what is the difference between signed integer and double?
Thank you.Hello,
How do I read an image into 16 bit signed integer array?
I tried using im2int16 in-built function, but I do not have Image Processing Toolbox. Please let me know if there is any other way to do it.
Also what is the difference between signed integer and double?
Thank you. Hello,
How do I read an image into 16 bit signed integer array?
I tried using im2int16 in-built function, but I do not have Image Processing Toolbox. Please let me know if there is any other way to do it.
Also what is the difference between signed integer and double?
Thank you. image processing, digital image processing MATLAB Answers — New Questions
Variables cannot be recognized in app designer
I wrote a program in a script and it works, but it doesn’t work in app designer. The unrecognizable code is shown below (a part of the calling function). Thank you very much for your time.I wrote a program in a script and it works, but it doesn’t work in app designer. The unrecognizable code is shown below (a part of the calling function). Thank you very much for your time. I wrote a program in a script and it works, but it doesn’t work in app designer. The unrecognizable code is shown below (a part of the calling function). Thank you very much for your time. appdesigner MATLAB Answers — New Questions