Tag Archives: matlab
Geoaxes zoom not working after adding ButtonDownFcn.
I have an app built in AppDesigner with a map plotted in geoaxes. I need to zoom in and out but I also need to do some action when I click on the map. The problem is that:
zoom works perfectly when no buttondownfcn is added
f = uifigure;
gx = geoaxes();
geoscatter(gx,10,10)
zoom does not work at all when buttondownfcn is added.
f = uifigure;
gx = geoaxes(f);
geoscatter(gx,10,10)
gx.ButtonDownFcn = ‘disp(”hello”)’;
I need to use both functionalities. What should I do?I have an app built in AppDesigner with a map plotted in geoaxes. I need to zoom in and out but I also need to do some action when I click on the map. The problem is that:
zoom works perfectly when no buttondownfcn is added
f = uifigure;
gx = geoaxes();
geoscatter(gx,10,10)
zoom does not work at all when buttondownfcn is added.
f = uifigure;
gx = geoaxes(f);
geoscatter(gx,10,10)
gx.ButtonDownFcn = ‘disp(”hello”)’;
I need to use both functionalities. What should I do? I have an app built in AppDesigner with a map plotted in geoaxes. I need to zoom in and out but I also need to do some action when I click on the map. The problem is that:
zoom works perfectly when no buttondownfcn is added
f = uifigure;
gx = geoaxes();
geoscatter(gx,10,10)
zoom does not work at all when buttondownfcn is added.
f = uifigure;
gx = geoaxes(f);
geoscatter(gx,10,10)
gx.ButtonDownFcn = ‘disp(”hello”)’;
I need to use both functionalities. What should I do? matlab, appdesigner, geoaxes, zoom MATLAB Answers — New Questions
Are namespaces packages?
The R2024a release notes say "The MATLAB language feature known as a package is now called a namespace."
The R2024b release notes say "A package is a collection of MATLAB code, related files, and a package definition file that defines the package identity and dependencies."
So I wanted to check: is the package referred to in the R2024b notes a new kind of thing, different to a namespace, or is the terminology change from R2024a being ignored?The R2024a release notes say "The MATLAB language feature known as a package is now called a namespace."
The R2024b release notes say "A package is a collection of MATLAB code, related files, and a package definition file that defines the package identity and dependencies."
So I wanted to check: is the package referred to in the R2024b notes a new kind of thing, different to a namespace, or is the terminology change from R2024a being ignored? The R2024a release notes say "The MATLAB language feature known as a package is now called a namespace."
The R2024b release notes say "A package is a collection of MATLAB code, related files, and a package definition file that defines the package identity and dependencies."
So I wanted to check: is the package referred to in the R2024b notes a new kind of thing, different to a namespace, or is the terminology change from R2024a being ignored? package, namespace MATLAB Answers — New Questions
Error in executing freqz command on LINUX server
I am trying to execute the command
[H,w] = freqz(b,a);
on the server machine of my university and it throws the following error: Bundle#165 start failed: libXcomposite.so.1: cannot open shared object file: No such file or directory.
I understand the error is due to the graphics. Could someone help me to solve this error? I do not need graphics, but just the FRF H and frequency vector w. I used the command matlab -nodisplay, but it doesn’t help.I am trying to execute the command
[H,w] = freqz(b,a);
on the server machine of my university and it throws the following error: Bundle#165 start failed: libXcomposite.so.1: cannot open shared object file: No such file or directory.
I understand the error is due to the graphics. Could someone help me to solve this error? I do not need graphics, but just the FRF H and frequency vector w. I used the command matlab -nodisplay, but it doesn’t help. I am trying to execute the command
[H,w] = freqz(b,a);
on the server machine of my university and it throws the following error: Bundle#165 start failed: libXcomposite.so.1: cannot open shared object file: No such file or directory.
I understand the error is due to the graphics. Could someone help me to solve this error? I do not need graphics, but just the FRF H and frequency vector w. I used the command matlab -nodisplay, but it doesn’t help. frequency, signal processing, linux, graphics, error MATLAB Answers — New Questions
Matlab Live Editor: “Unable to open this file in the current system configuration.”
I am running Matlab 2022b on NixOS – an unsupported-officially Linux distribution. I get this error since a few months ago when I try to open a matlab file:
Scrolling down that message shows the text:
And opening that "Requirements" link doesn’t work – brings me to an empty web page:
I got this error message also with version 2021b. I don’t use Matlab frequently enough to mark the day it stopped working, but I assume it was due to a system update. The list of system dependencies I have installed in Matlab’s environment is available here:
https://gitlab.com/doronbehar/nix-matlab/blob/1802c05f3c4187c344d9e4de1f9546dfc9ad017a/common.nix#L8-56I am running Matlab 2022b on NixOS – an unsupported-officially Linux distribution. I get this error since a few months ago when I try to open a matlab file:
Scrolling down that message shows the text:
And opening that "Requirements" link doesn’t work – brings me to an empty web page:
I got this error message also with version 2021b. I don’t use Matlab frequently enough to mark the day it stopped working, but I assume it was due to a system update. The list of system dependencies I have installed in Matlab’s environment is available here:
https://gitlab.com/doronbehar/nix-matlab/blob/1802c05f3c4187c344d9e4de1f9546dfc9ad017a/common.nix#L8-56 I am running Matlab 2022b on NixOS – an unsupported-officially Linux distribution. I get this error since a few months ago when I try to open a matlab file:
Scrolling down that message shows the text:
And opening that "Requirements" link doesn’t work – brings me to an empty web page:
I got this error message also with version 2021b. I don’t use Matlab frequently enough to mark the day it stopped working, but I assume it was due to a system update. The list of system dependencies I have installed in Matlab’s environment is available here:
https://gitlab.com/doronbehar/nix-matlab/blob/1802c05f3c4187c344d9e4de1f9546dfc9ad017a/common.nix#L8-56 installation, gui, matlab MATLAB Answers — New Questions
Why do I receive the error “You are not licensed to use R20XXy?” when I try to launch MATLAB?
Why I do receive the following error message when trying to launch MATLAB?
You are not licensed to use R20XXy.
For help, contact your license administrator or MathWorks Support.Why I do receive the following error message when trying to launch MATLAB?
You are not licensed to use R20XXy.
For help, contact your license administrator or MathWorks Support. Why I do receive the following error message when trying to launch MATLAB?
You are not licensed to use R20XXy.
For help, contact your license administrator or MathWorks Support. MATLAB Answers — New Questions
Enable a subsystem from Simulink stateflow ?
Hello ,
I am a newbie to Simulink . I am trying to run a activate/enable a subsystem when certain conditions are met in Simulink Stateflow . I know I have to add enable signal to the subsystem I intend to activate and this would be input to the subsystem I am trying to activate.
But my question is how do I set this enable signal to true in my state flow . Since its a input variable I cannot assign its value in another subsystem or is there a better way to do it .
I might be completely off since I am barely getting statrted . Any help appreciated .
ThanksHello ,
I am a newbie to Simulink . I am trying to run a activate/enable a subsystem when certain conditions are met in Simulink Stateflow . I know I have to add enable signal to the subsystem I intend to activate and this would be input to the subsystem I am trying to activate.
But my question is how do I set this enable signal to true in my state flow . Since its a input variable I cannot assign its value in another subsystem or is there a better way to do it .
I might be completely off since I am barely getting statrted . Any help appreciated .
Thanks Hello ,
I am a newbie to Simulink . I am trying to run a activate/enable a subsystem when certain conditions are met in Simulink Stateflow . I know I have to add enable signal to the subsystem I intend to activate and this would be input to the subsystem I am trying to activate.
But my question is how do I set this enable signal to true in my state flow . Since its a input variable I cannot assign its value in another subsystem or is there a better way to do it .
I might be completely off since I am barely getting statrted . Any help appreciated .
Thanks simulink, stateflow, enabled MATLAB Answers — New Questions
Why do I receive an error 354 when activating my license?
When activating MATLAB, I receive the following error:
ERROR: Error 354 – No more machine transfers available.
How do I bypass this error so that I can activate my MATLAB?When activating MATLAB, I receive the following error:
ERROR: Error 354 – No more machine transfers available.
How do I bypass this error so that I can activate my MATLAB? When activating MATLAB, I receive the following error:
ERROR: Error 354 – No more machine transfers available.
How do I bypass this error so that I can activate my MATLAB? MATLAB Answers — New Questions
spectrogram x-axis match with data
Hello, I am plotting a spectrogram from an earthquake signal, but the time length of the signal (~250 seconds) does not match the time length displayed in the spectrogram (~100 seconds). Could you help me understand why this discrepancy occurs and how to fix it? Thank you!Hello, I am plotting a spectrogram from an earthquake signal, but the time length of the signal (~250 seconds) does not match the time length displayed in the spectrogram (~100 seconds). Could you help me understand why this discrepancy occurs and how to fix it? Thank you! Hello, I am plotting a spectrogram from an earthquake signal, but the time length of the signal (~250 seconds) does not match the time length displayed in the spectrogram (~100 seconds). Could you help me understand why this discrepancy occurs and how to fix it? Thank you! spectrogram x-axis match MATLAB Answers — New Questions
What is the correct syntax to assign simulated data to my variables?
Dears,
I am running a MS-DSGE model using RISE toolbox. I want to add a fiscal shock and examine its effect on output, price…
%fiscal shock
shock_type = {‘eps_G’};
%here is my variable list of a cell array of character variables and not a struct.
var_list={‘log_y’,’C’,’pi_ann’,’B_nominal’,’B’,’sp’,’i_ann’,’r_real_ann’,’P’};
% EXOGENOUS SWITCHING
myirfs1=irf(m1,’irf_periods’,24,’irf_shock_sign’,1);
% following the suggestion by @VBBV, I use the following sintaxes to access elements of struct
myirfs1 = struct()
myirfs1.eps_CP = struct();
myirfs1.eps_G = struct();
myirfs1.eps_T = struct();
myirfs1.eps_a = struct();
myirfs1.eps_nu = struct();
myirfs1.eps_z = struct();
var_aux = {‘log_y’,’C’,’pi_ann’,’B_nominal’,’B’,’sp’,’i_ann’,’r_real_ann’,’P’};
var_aux3 = {‘eps_G_log_y’,’eps_G_C’,’eps_G_pi_ann’,’eps_G_B_nominal’,’eps_G_B’,’eps_G_sp’,’eps_G_i_ann’,’eps_G_r_real_ann’,’eps_G_P’};
fieldnames(myirfs1)
myirfs1.eps_G.var = var_aux3 % assign the data array to the struct variable
irf_fisc = struct();
for i = 1:numel(var_aux)
irf_fisc.var_aux{i} = [0,myirfs1.eps_G.var{i}]’;
end
irf_fisc.var_aux(1)
irf_fisc
% what is the write syntax to assign value (simulated data) to the struct?
myirfs1.eps_G.logy = data(:,1)/10; %Is the suggested code. but where is the data variable located? should I create it data = randn(TMax, N); or it is already simulated?Dears,
I am running a MS-DSGE model using RISE toolbox. I want to add a fiscal shock and examine its effect on output, price…
%fiscal shock
shock_type = {‘eps_G’};
%here is my variable list of a cell array of character variables and not a struct.
var_list={‘log_y’,’C’,’pi_ann’,’B_nominal’,’B’,’sp’,’i_ann’,’r_real_ann’,’P’};
% EXOGENOUS SWITCHING
myirfs1=irf(m1,’irf_periods’,24,’irf_shock_sign’,1);
% following the suggestion by @VBBV, I use the following sintaxes to access elements of struct
myirfs1 = struct()
myirfs1.eps_CP = struct();
myirfs1.eps_G = struct();
myirfs1.eps_T = struct();
myirfs1.eps_a = struct();
myirfs1.eps_nu = struct();
myirfs1.eps_z = struct();
var_aux = {‘log_y’,’C’,’pi_ann’,’B_nominal’,’B’,’sp’,’i_ann’,’r_real_ann’,’P’};
var_aux3 = {‘eps_G_log_y’,’eps_G_C’,’eps_G_pi_ann’,’eps_G_B_nominal’,’eps_G_B’,’eps_G_sp’,’eps_G_i_ann’,’eps_G_r_real_ann’,’eps_G_P’};
fieldnames(myirfs1)
myirfs1.eps_G.var = var_aux3 % assign the data array to the struct variable
irf_fisc = struct();
for i = 1:numel(var_aux)
irf_fisc.var_aux{i} = [0,myirfs1.eps_G.var{i}]’;
end
irf_fisc.var_aux(1)
irf_fisc
% what is the write syntax to assign value (simulated data) to the struct?
myirfs1.eps_G.logy = data(:,1)/10; %Is the suggested code. but where is the data variable located? should I create it data = randn(TMax, N); or it is already simulated? Dears,
I am running a MS-DSGE model using RISE toolbox. I want to add a fiscal shock and examine its effect on output, price…
%fiscal shock
shock_type = {‘eps_G’};
%here is my variable list of a cell array of character variables and not a struct.
var_list={‘log_y’,’C’,’pi_ann’,’B_nominal’,’B’,’sp’,’i_ann’,’r_real_ann’,’P’};
% EXOGENOUS SWITCHING
myirfs1=irf(m1,’irf_periods’,24,’irf_shock_sign’,1);
% following the suggestion by @VBBV, I use the following sintaxes to access elements of struct
myirfs1 = struct()
myirfs1.eps_CP = struct();
myirfs1.eps_G = struct();
myirfs1.eps_T = struct();
myirfs1.eps_a = struct();
myirfs1.eps_nu = struct();
myirfs1.eps_z = struct();
var_aux = {‘log_y’,’C’,’pi_ann’,’B_nominal’,’B’,’sp’,’i_ann’,’r_real_ann’,’P’};
var_aux3 = {‘eps_G_log_y’,’eps_G_C’,’eps_G_pi_ann’,’eps_G_B_nominal’,’eps_G_B’,’eps_G_sp’,’eps_G_i_ann’,’eps_G_r_real_ann’,’eps_G_P’};
fieldnames(myirfs1)
myirfs1.eps_G.var = var_aux3 % assign the data array to the struct variable
irf_fisc = struct();
for i = 1:numel(var_aux)
irf_fisc.var_aux{i} = [0,myirfs1.eps_G.var{i}]’;
end
irf_fisc.var_aux(1)
irf_fisc
% what is the write syntax to assign value (simulated data) to the struct?
myirfs1.eps_G.logy = data(:,1)/10; %Is the suggested code. but where is the data variable located? should I create it data = randn(TMax, N); or it is already simulated? dsge coding MATLAB Answers — New Questions
rescaleing subfigures within figure
Dear all
I have the attached figure. There, I implied a ratio of the height and the width for the original figure; after removing the label in subfigure(3,1,1) and subfigure(3,1,2), I moved the subfigure(3,1,2) and subfigure(3,1,3) abit up, to avoid the space between the three subfigures. But now the original ratio between the height and the width is not given anymore. I thought of rescaling the subfigures within the figure without changing the size of the figure. But unfortunately, I did not find a command for this. Did I miss a possible command, or is there a workaround?
I hope my issue is clear. Thank you for the help.
Best JakobDear all
I have the attached figure. There, I implied a ratio of the height and the width for the original figure; after removing the label in subfigure(3,1,1) and subfigure(3,1,2), I moved the subfigure(3,1,2) and subfigure(3,1,3) abit up, to avoid the space between the three subfigures. But now the original ratio between the height and the width is not given anymore. I thought of rescaling the subfigures within the figure without changing the size of the figure. But unfortunately, I did not find a command for this. Did I miss a possible command, or is there a workaround?
I hope my issue is clear. Thank you for the help.
Best Jakob Dear all
I have the attached figure. There, I implied a ratio of the height and the width for the original figure; after removing the label in subfigure(3,1,1) and subfigure(3,1,2), I moved the subfigure(3,1,2) and subfigure(3,1,3) abit up, to avoid the space between the three subfigures. But now the original ratio between the height and the width is not given anymore. I thought of rescaling the subfigures within the figure without changing the size of the figure. But unfortunately, I did not find a command for this. Did I miss a possible command, or is there a workaround?
I hope my issue is clear. Thank you for the help.
Best Jakob figure MATLAB Answers — New Questions
How to test custom class with unit test class
Since, I’am very new to the topic of MatLab unit tests, I struggle with testing a custom MatLab class using a unit test class in a separate file.
Like I know from other programming languages, I would like to write a unit test (in a separate class) for a custom MatLab class. However, I do not see how to create an instance of / how to use my custom class within the test class.
Therefore, I would have the following questions, where I hope you can help me:
How do I properly create an instance of my custom class within the test class?
When I place my test class file in a sub-directory "tests/", how do I include the file of the my custom class?
Can you recommend a proper folder structure? Concrete, is it appropriate to place test classes in a sub-folder tests/
Thank you very much!
PS: Up to now – as minimal example – I have a file with a custom class MyMath.m:
classdef MyMath
methods
function obj = MyMath()
end
function outputArg = add(~, a1, a2)
outputArg = a1+a2;
end
end
end
and a file with the test class MyMath_Test.m
classdef MyMath_Test < matlab.unittest.TestCase
methods(TestClassSetup)
% Shared setup for the entire test class
my_math = MyMath();
end
methods(TestMethodSetup)
% Setup for each test
end
methods(Test)
% Test methods
function unimplementedTest(testCase)
res = my_math.add(4,5);
testCase.verifyEqual(res, 9)
end
end
end
Running Tests via Matlab GUI Buttons, results in the error:
>> runtests("MyMath_Test")
Running MyMath_Test
================================================================================
Error occurred while setting up or tearing down MyMath_Test.
As a result, all MyMath_Test tests failed and did not run to completion.
———
Error ID:
———
‘MATLAB:TooManyInputs’
————–
Error Details:
————–
Error using MyMath_Test/MyMath
Too many input arguments.
================================================================================Since, I’am very new to the topic of MatLab unit tests, I struggle with testing a custom MatLab class using a unit test class in a separate file.
Like I know from other programming languages, I would like to write a unit test (in a separate class) for a custom MatLab class. However, I do not see how to create an instance of / how to use my custom class within the test class.
Therefore, I would have the following questions, where I hope you can help me:
How do I properly create an instance of my custom class within the test class?
When I place my test class file in a sub-directory "tests/", how do I include the file of the my custom class?
Can you recommend a proper folder structure? Concrete, is it appropriate to place test classes in a sub-folder tests/
Thank you very much!
PS: Up to now – as minimal example – I have a file with a custom class MyMath.m:
classdef MyMath
methods
function obj = MyMath()
end
function outputArg = add(~, a1, a2)
outputArg = a1+a2;
end
end
end
and a file with the test class MyMath_Test.m
classdef MyMath_Test < matlab.unittest.TestCase
methods(TestClassSetup)
% Shared setup for the entire test class
my_math = MyMath();
end
methods(TestMethodSetup)
% Setup for each test
end
methods(Test)
% Test methods
function unimplementedTest(testCase)
res = my_math.add(4,5);
testCase.verifyEqual(res, 9)
end
end
end
Running Tests via Matlab GUI Buttons, results in the error:
>> runtests("MyMath_Test")
Running MyMath_Test
================================================================================
Error occurred while setting up or tearing down MyMath_Test.
As a result, all MyMath_Test tests failed and did not run to completion.
———
Error ID:
———
‘MATLAB:TooManyInputs’
————–
Error Details:
————–
Error using MyMath_Test/MyMath
Too many input arguments.
================================================================================ Since, I’am very new to the topic of MatLab unit tests, I struggle with testing a custom MatLab class using a unit test class in a separate file.
Like I know from other programming languages, I would like to write a unit test (in a separate class) for a custom MatLab class. However, I do not see how to create an instance of / how to use my custom class within the test class.
Therefore, I would have the following questions, where I hope you can help me:
How do I properly create an instance of my custom class within the test class?
When I place my test class file in a sub-directory "tests/", how do I include the file of the my custom class?
Can you recommend a proper folder structure? Concrete, is it appropriate to place test classes in a sub-folder tests/
Thank you very much!
PS: Up to now – as minimal example – I have a file with a custom class MyMath.m:
classdef MyMath
methods
function obj = MyMath()
end
function outputArg = add(~, a1, a2)
outputArg = a1+a2;
end
end
end
and a file with the test class MyMath_Test.m
classdef MyMath_Test < matlab.unittest.TestCase
methods(TestClassSetup)
% Shared setup for the entire test class
my_math = MyMath();
end
methods(TestMethodSetup)
% Setup for each test
end
methods(Test)
% Test methods
function unimplementedTest(testCase)
res = my_math.add(4,5);
testCase.verifyEqual(res, 9)
end
end
end
Running Tests via Matlab GUI Buttons, results in the error:
>> runtests("MyMath_Test")
Running MyMath_Test
================================================================================
Error occurred while setting up or tearing down MyMath_Test.
As a result, all MyMath_Test tests failed and did not run to completion.
———
Error ID:
———
‘MATLAB:TooManyInputs’
————–
Error Details:
————–
Error using MyMath_Test/MyMath
Too many input arguments.
================================================================================ unit test, object oriented test MATLAB Answers — New Questions
Automatically disable subsystem and manually re-enabled
I need to create the "Enabled Subsystem" which is automatically switch off (disabled) after time expire off and after it is able to restart (Enabled) by writing to the enable.Value from matlab command line (set_param) manually … So basically I am able to fire/enable the single "sine" manually.
Initially I’ve created this
where I use "Set Variable Enable to 0 and stop Generator" with "Parameter Writer" pointing to Enable.Value
Any idea how to go about Algebraic loop or other way to achieve described behavior?I need to create the "Enabled Subsystem" which is automatically switch off (disabled) after time expire off and after it is able to restart (Enabled) by writing to the enable.Value from matlab command line (set_param) manually … So basically I am able to fire/enable the single "sine" manually.
Initially I’ve created this
where I use "Set Variable Enable to 0 and stop Generator" with "Parameter Writer" pointing to Enable.Value
Any idea how to go about Algebraic loop or other way to achieve described behavior? I need to create the "Enabled Subsystem" which is automatically switch off (disabled) after time expire off and after it is able to restart (Enabled) by writing to the enable.Value from matlab command line (set_param) manually … So basically I am able to fire/enable the single "sine" manually.
Initially I’ve created this
where I use "Set Variable Enable to 0 and stop Generator" with "Parameter Writer" pointing to Enable.Value
Any idea how to go about Algebraic loop or other way to achieve described behavior? automatically disabled system and manually enabled MATLAB Answers — New Questions
follow the trend depend on the maximum value
Hello all professional,
@Stephen23 @Harald @Paul @ Adam Danz
please i need urgent help.
i have data for oil level, h_Tank_mm, and related time, time_s
the oil level decrease over the time from maximum to the minimum. when it reach to the minimum value, the technicien refill the tank and start again from maximum. some time there are some peaks or some high drope because the leak.
i need a matlab script that follow the maximum value of the trend like in the figure. if there a high drop in the maximum value, the trend should not effected and stay as no leak.
I want to keep following the trend in order to detect the leakage.Hello all professional,
@Stephen23 @Harald @Paul @ Adam Danz
please i need urgent help.
i have data for oil level, h_Tank_mm, and related time, time_s
the oil level decrease over the time from maximum to the minimum. when it reach to the minimum value, the technicien refill the tank and start again from maximum. some time there are some peaks or some high drope because the leak.
i need a matlab script that follow the maximum value of the trend like in the figure. if there a high drop in the maximum value, the trend should not effected and stay as no leak.
I want to keep following the trend in order to detect the leakage. Hello all professional,
@Stephen23 @Harald @Paul @ Adam Danz
please i need urgent help.
i have data for oil level, h_Tank_mm, and related time, time_s
the oil level decrease over the time from maximum to the minimum. when it reach to the minimum value, the technicien refill the tank and start again from maximum. some time there are some peaks or some high drope because the leak.
i need a matlab script that follow the maximum value of the trend like in the figure. if there a high drop in the maximum value, the trend should not effected and stay as no leak.
I want to keep following the trend in order to detect the leakage. stephen23, harald MATLAB Answers — New Questions
Multiobjective optimization with polygon boundary
I have a fixed designed space. I have the k values of conhull. How do I implement this boundary for the multiobjective optimization problem?I have a fixed designed space. I have the k values of conhull. How do I implement this boundary for the multiobjective optimization problem? I have a fixed designed space. I have the k values of conhull. How do I implement this boundary for the multiobjective optimization problem? multiobj MATLAB Answers — New Questions
Error when change battery parallel and/or series cells in battery module assembly
I’m using the example model charge discharge module assembly with coolant control (openExample(‘simscapebattery/chargeDischargeModuleAssemblyWithCoolantControlExample’). But I change the size of the battery module (for example: number of parallel cells from 4 to 6, and number of series assemblies still on 3) in the CoolantControlCreateLib.mlx.
Then I run ChargeDischargeModuleAssemblyWithCoolantControlExample.mlx but appears an error saying:
Error compiling Simscape network for model coolantControl.
Caused by:
Error using coolantControlLib.ParallelAssemblies.ParallelAssemblyType1> (line 55)
[‘coolantControl/ModuleAssembly/Module1’]: Length of Current (positive in) must be equal to Batteries in Parallel.
Line 55 is:
assert(length(batteryCurrent) == P);
In ParallelAssemblyType1.ssc, P is the parallel cells. Equal to 6.
I don’t understand why length of batterycurrent is not 6.
I checked almost everything and I don’t know what is the cause of the error. thanks!I’m using the example model charge discharge module assembly with coolant control (openExample(‘simscapebattery/chargeDischargeModuleAssemblyWithCoolantControlExample’). But I change the size of the battery module (for example: number of parallel cells from 4 to 6, and number of series assemblies still on 3) in the CoolantControlCreateLib.mlx.
Then I run ChargeDischargeModuleAssemblyWithCoolantControlExample.mlx but appears an error saying:
Error compiling Simscape network for model coolantControl.
Caused by:
Error using coolantControlLib.ParallelAssemblies.ParallelAssemblyType1> (line 55)
[‘coolantControl/ModuleAssembly/Module1’]: Length of Current (positive in) must be equal to Batteries in Parallel.
Line 55 is:
assert(length(batteryCurrent) == P);
In ParallelAssemblyType1.ssc, P is the parallel cells. Equal to 6.
I don’t understand why length of batterycurrent is not 6.
I checked almost everything and I don’t know what is the cause of the error. thanks! I’m using the example model charge discharge module assembly with coolant control (openExample(‘simscapebattery/chargeDischargeModuleAssemblyWithCoolantControlExample’). But I change the size of the battery module (for example: number of parallel cells from 4 to 6, and number of series assemblies still on 3) in the CoolantControlCreateLib.mlx.
Then I run ChargeDischargeModuleAssemblyWithCoolantControlExample.mlx but appears an error saying:
Error compiling Simscape network for model coolantControl.
Caused by:
Error using coolantControlLib.ParallelAssemblies.ParallelAssemblyType1> (line 55)
[‘coolantControl/ModuleAssembly/Module1’]: Length of Current (positive in) must be equal to Batteries in Parallel.
Line 55 is:
assert(length(batteryCurrent) == P);
In ParallelAssemblyType1.ssc, P is the parallel cells. Equal to 6.
I don’t understand why length of batterycurrent is not 6.
I checked almost everything and I don’t know what is the cause of the error. thanks! simscape, battery, simulink MATLAB Answers — New Questions
fitting with custom equation
Hi I am havng troble in fitting the data with costoum eqaution: I/y = x/a + (1-x)/b. with and b are the fitting parametrs. x and y values are as given below.
y = [1.6E5 2.5E5 4.1E5 8E5 1E6 2E6 7E6 2E7]
x = [17 20 27 59 62 81 89 95]
Thank you in advance for your support!Hi I am havng troble in fitting the data with costoum eqaution: I/y = x/a + (1-x)/b. with and b are the fitting parametrs. x and y values are as given below.
y = [1.6E5 2.5E5 4.1E5 8E5 1E6 2E6 7E6 2E7]
x = [17 20 27 59 62 81 89 95]
Thank you in advance for your support! Hi I am havng troble in fitting the data with costoum eqaution: I/y = x/a + (1-x)/b. with and b are the fitting parametrs. x and y values are as given below.
y = [1.6E5 2.5E5 4.1E5 8E5 1E6 2E6 7E6 2E7]
x = [17 20 27 59 62 81 89 95]
Thank you in advance for your support! curve fitting, custom equation MATLAB Answers — New Questions
Calculate a PSD using a time series
I have the following code and the sample data set (attached).
clear; close all; clc
load("sampleData.mat")
whos
dt = sampleData.time(2) – sampleData.time(1); % Time step
n = length(sampleData.eta); % Number of data points
fs = 1 / dt; % Sampling frequency (Hz)
eta_fft = fft(sampleData.eta) / n; % Normalized FFT
% Single-sided Power Spectral Density
PSD_single_sided = (2 * abs(eta_fft(1:round(n/2))).^2) * fs;
f_single_sided = (0:round(n/2)-1) * (fs/n); % Frequency array in Hz
omega_fft = 2 * pi * f_single_sided; % Convert to rad/s
omega = sampleData.omega;
psd_org = sampleData.S;
% Plot the PSD against the spectrum
figure;
plot(omega, psd_org, ‘b’, ‘LineWidth’, 1.5); % Original spectrum
hold on;
plot(omega_fft, PSD_single_sided, ‘r’, ‘LineWidth’, 1.5); % Single-sided PSD from time series
xlabel(‘omega (rad/s)’);
ylabel(‘Spectral Density (m^2 s)’);
legend(‘direct Spectrum’, ‘PSD from Time Series’);
xlim([0 5])
grid on;
I have followed the theretical steps so that the two PSD should match, maybe not perfectly but at least to a good extent. But I’m not getting a decent match, and I think I might be doing the PSD calculations wrong. Signal processing is not my strongest suit, so could anyone tell me what I’m doing wrong?
I also looked into Power Spectral Density Estimates Using FFT, but I’m having a hard time getting the results in m^2s. Technically, the psd_org and the calculated psd should match.I have the following code and the sample data set (attached).
clear; close all; clc
load("sampleData.mat")
whos
dt = sampleData.time(2) – sampleData.time(1); % Time step
n = length(sampleData.eta); % Number of data points
fs = 1 / dt; % Sampling frequency (Hz)
eta_fft = fft(sampleData.eta) / n; % Normalized FFT
% Single-sided Power Spectral Density
PSD_single_sided = (2 * abs(eta_fft(1:round(n/2))).^2) * fs;
f_single_sided = (0:round(n/2)-1) * (fs/n); % Frequency array in Hz
omega_fft = 2 * pi * f_single_sided; % Convert to rad/s
omega = sampleData.omega;
psd_org = sampleData.S;
% Plot the PSD against the spectrum
figure;
plot(omega, psd_org, ‘b’, ‘LineWidth’, 1.5); % Original spectrum
hold on;
plot(omega_fft, PSD_single_sided, ‘r’, ‘LineWidth’, 1.5); % Single-sided PSD from time series
xlabel(‘omega (rad/s)’);
ylabel(‘Spectral Density (m^2 s)’);
legend(‘direct Spectrum’, ‘PSD from Time Series’);
xlim([0 5])
grid on;
I have followed the theretical steps so that the two PSD should match, maybe not perfectly but at least to a good extent. But I’m not getting a decent match, and I think I might be doing the PSD calculations wrong. Signal processing is not my strongest suit, so could anyone tell me what I’m doing wrong?
I also looked into Power Spectral Density Estimates Using FFT, but I’m having a hard time getting the results in m^2s. Technically, the psd_org and the calculated psd should match. I have the following code and the sample data set (attached).
clear; close all; clc
load("sampleData.mat")
whos
dt = sampleData.time(2) – sampleData.time(1); % Time step
n = length(sampleData.eta); % Number of data points
fs = 1 / dt; % Sampling frequency (Hz)
eta_fft = fft(sampleData.eta) / n; % Normalized FFT
% Single-sided Power Spectral Density
PSD_single_sided = (2 * abs(eta_fft(1:round(n/2))).^2) * fs;
f_single_sided = (0:round(n/2)-1) * (fs/n); % Frequency array in Hz
omega_fft = 2 * pi * f_single_sided; % Convert to rad/s
omega = sampleData.omega;
psd_org = sampleData.S;
% Plot the PSD against the spectrum
figure;
plot(omega, psd_org, ‘b’, ‘LineWidth’, 1.5); % Original spectrum
hold on;
plot(omega_fft, PSD_single_sided, ‘r’, ‘LineWidth’, 1.5); % Single-sided PSD from time series
xlabel(‘omega (rad/s)’);
ylabel(‘Spectral Density (m^2 s)’);
legend(‘direct Spectrum’, ‘PSD from Time Series’);
xlim([0 5])
grid on;
I have followed the theretical steps so that the two PSD should match, maybe not perfectly but at least to a good extent. But I’m not getting a decent match, and I think I might be doing the PSD calculations wrong. Signal processing is not my strongest suit, so could anyone tell me what I’m doing wrong?
I also looked into Power Spectral Density Estimates Using FFT, but I’m having a hard time getting the results in m^2s. Technically, the psd_org and the calculated psd should match. fft, psd MATLAB Answers — New Questions
I want complete MATLAB code to perform unbalanced load flow of IEEE 13 bus unbalanced radial distribution system, can anyone help me with this?
I need to write MATLAB code for unbalanced power flow of an IEEE 13 bus system where there are regulators, shunt capacitors, mutual coupling between lines, tranformers, distributed loads etc. I am unable to do this, but need the code as a part of my MTECH project, neither my guides are helping me. Please someone share the code if anyone has done it already. Please help me.I need to write MATLAB code for unbalanced power flow of an IEEE 13 bus system where there are regulators, shunt capacitors, mutual coupling between lines, tranformers, distributed loads etc. I am unable to do this, but need the code as a part of my MTECH project, neither my guides are helping me. Please someone share the code if anyone has done it already. Please help me. I need to write MATLAB code for unbalanced power flow of an IEEE 13 bus system where there are regulators, shunt capacitors, mutual coupling between lines, tranformers, distributed loads etc. I am unable to do this, but need the code as a part of my MTECH project, neither my guides are helping me. Please someone share the code if anyone has done it already. Please help me. ieee 13 bus radial distribution system, matlab code, unbalanced load flow MATLAB Answers — New Questions
Is there a way to change the position of the origin of the model when displaying a robot arm using the Robotics System Toolbox in Matlab?
I want to detect a collision between two robot arms.
The page below mentions the method in part, but in the sample code shown in the answer, the origin is the same, so the result of the collision detection is true regardless of the posture.
Therefore, as a preliminary step to detecting a collision between two robot arms, I would like to know how to arrange two robot arms with different origins and base positions.
Detect a collision between 2 robotPlatform – MATLAB Answers – MATLAB CentralI want to detect a collision between two robot arms.
The page below mentions the method in part, but in the sample code shown in the answer, the origin is the same, so the result of the collision detection is true regardless of the posture.
Therefore, as a preliminary step to detecting a collision between two robot arms, I would like to know how to arrange two robot arms with different origins and base positions.
Detect a collision between 2 robotPlatform – MATLAB Answers – MATLAB Central I want to detect a collision between two robot arms.
The page below mentions the method in part, but in the sample code shown in the answer, the origin is the same, so the result of the collision detection is true regardless of the posture.
Therefore, as a preliminary step to detecting a collision between two robot arms, I would like to know how to arrange two robot arms with different origins and base positions.
Detect a collision between 2 robotPlatform – MATLAB Answers – MATLAB Central robotics system toolbox, collision detection MATLAB Answers — New Questions
Why I cannot define a function in live script?
Hi,
I tried to define a function in LiveScript but as soon as I add it to a script it freezes the "Run" button.
However, while writing normal script that NOT happened.
Does anyone have an answer for that? I will appreciate it.Hi,
I tried to define a function in LiveScript but as soon as I add it to a script it freezes the "Run" button.
However, while writing normal script that NOT happened.
Does anyone have an answer for that? I will appreciate it. Hi,
I tried to define a function in LiveScript but as soon as I add it to a script it freezes the "Run" button.
However, while writing normal script that NOT happened.
Does anyone have an answer for that? I will appreciate it. livescript, script, function MATLAB Answers — New Questions