Category: Matlab
Category Archives: Matlab
I need to connect physical modelling connection port to the output of a switch with 2 input. How can I establish this?
Post Content Post Content multiple source connection MATLAB Answers — New Questions
How to retrieve datas from multiples GUIs into a function ?
Hello everyone !
I have several GUI windows to collect parameters and I want to use them in functions.
The problem is, I store datas from edit text boxes into arrays like that :
typex=getappdata(hObject,’typex’);
typex(end+1)=str2double(handles.typex(1).String);
handles.typex(1).String=sprintf(‘block %d’,numel(typex)+1);
disp(typex)
setappdata(hObject,’typex’,typex);
assignin(‘base’,’typex’,typex);
Then, in a callback I use them in the same GUI:
xw=getappdata(handles.xw(1),’xw’);
xe=getappdata(handles.xe(1),’xe’);
nx=getappdata(handles.nx(1),’nx’);
typex=getappdata(handles.typex(1),’typex’);
%Choix du programme de rafinement a executer
if(typex==1)
n=length(nx);
for i=1:n
xwt=xw(i);
xet=xe(i);
nxt=nx(i);
create_block_uniform_X(xwt, xet, nxt)
end
That does works.
But in an other function, I use that to retrieve the datas:
X=getappdata(0,’X’)
Y=getappdata(0,’Y’)
Z=getappdata(0,’Z’)
nx=getappdata(0,’nx’)
xw=getappdata(0,’xw’)
xe=getappdata(0,’xe’)
ny=getappdata(0,’ny’)
yw=getappdata(0,’yw’)
ye=getappdata(0,’ye’)
nz=getappdata(0,’nz’)
zw=getappdata(0,’zw’)
ze=getappdata(0,’ze’)
The thing is that for X,Y,Z it does retrieve the datas (X, Y, Z are the outputs arguments from the previous fonction ‘create_block_uniform’) but that return empty arrays for the others… I don’t understand
Z =
Columns 1 through 13
0 1.1111 2.2222 3.3333 4.4444 5.5556 6.6667 7.7778 8.8889 10.0000 0 0 0
Columns 14 through 18
0 0 0 0 0
nx =
[]
xw =
[]
xe =
[]
Could someone help me ?
Thanks !Hello everyone !
I have several GUI windows to collect parameters and I want to use them in functions.
The problem is, I store datas from edit text boxes into arrays like that :
typex=getappdata(hObject,’typex’);
typex(end+1)=str2double(handles.typex(1).String);
handles.typex(1).String=sprintf(‘block %d’,numel(typex)+1);
disp(typex)
setappdata(hObject,’typex’,typex);
assignin(‘base’,’typex’,typex);
Then, in a callback I use them in the same GUI:
xw=getappdata(handles.xw(1),’xw’);
xe=getappdata(handles.xe(1),’xe’);
nx=getappdata(handles.nx(1),’nx’);
typex=getappdata(handles.typex(1),’typex’);
%Choix du programme de rafinement a executer
if(typex==1)
n=length(nx);
for i=1:n
xwt=xw(i);
xet=xe(i);
nxt=nx(i);
create_block_uniform_X(xwt, xet, nxt)
end
That does works.
But in an other function, I use that to retrieve the datas:
X=getappdata(0,’X’)
Y=getappdata(0,’Y’)
Z=getappdata(0,’Z’)
nx=getappdata(0,’nx’)
xw=getappdata(0,’xw’)
xe=getappdata(0,’xe’)
ny=getappdata(0,’ny’)
yw=getappdata(0,’yw’)
ye=getappdata(0,’ye’)
nz=getappdata(0,’nz’)
zw=getappdata(0,’zw’)
ze=getappdata(0,’ze’)
The thing is that for X,Y,Z it does retrieve the datas (X, Y, Z are the outputs arguments from the previous fonction ‘create_block_uniform’) but that return empty arrays for the others… I don’t understand
Z =
Columns 1 through 13
0 1.1111 2.2222 3.3333 4.4444 5.5556 6.6667 7.7778 8.8889 10.0000 0 0 0
Columns 14 through 18
0 0 0 0 0
nx =
[]
xw =
[]
xe =
[]
Could someone help me ?
Thanks ! Hello everyone !
I have several GUI windows to collect parameters and I want to use them in functions.
The problem is, I store datas from edit text boxes into arrays like that :
typex=getappdata(hObject,’typex’);
typex(end+1)=str2double(handles.typex(1).String);
handles.typex(1).String=sprintf(‘block %d’,numel(typex)+1);
disp(typex)
setappdata(hObject,’typex’,typex);
assignin(‘base’,’typex’,typex);
Then, in a callback I use them in the same GUI:
xw=getappdata(handles.xw(1),’xw’);
xe=getappdata(handles.xe(1),’xe’);
nx=getappdata(handles.nx(1),’nx’);
typex=getappdata(handles.typex(1),’typex’);
%Choix du programme de rafinement a executer
if(typex==1)
n=length(nx);
for i=1:n
xwt=xw(i);
xet=xe(i);
nxt=nx(i);
create_block_uniform_X(xwt, xet, nxt)
end
That does works.
But in an other function, I use that to retrieve the datas:
X=getappdata(0,’X’)
Y=getappdata(0,’Y’)
Z=getappdata(0,’Z’)
nx=getappdata(0,’nx’)
xw=getappdata(0,’xw’)
xe=getappdata(0,’xe’)
ny=getappdata(0,’ny’)
yw=getappdata(0,’yw’)
ye=getappdata(0,’ye’)
nz=getappdata(0,’nz’)
zw=getappdata(0,’zw’)
ze=getappdata(0,’ze’)
The thing is that for X,Y,Z it does retrieve the datas (X, Y, Z are the outputs arguments from the previous fonction ‘create_block_uniform’) but that return empty arrays for the others… I don’t understand
Z =
Columns 1 through 13
0 1.1111 2.2222 3.3333 4.4444 5.5556 6.6667 7.7778 8.8889 10.0000 0 0 0
Columns 14 through 18
0 0 0 0 0
nx =
[]
xw =
[]
xe =
[]
Could someone help me ?
Thanks ! store data MATLAB Answers — New Questions
Login problems with Matlab 2024a
I keep receiving the message "Unable to save login information. You are currently signed in but you will be prompted to sign in again the next time that you start this application." everytime I start the Matlab application.
I tried to follow all the steps I could find, such as reinstaling the Mathworks Service Host, eliminating the files at ‘%APPDATA%MathWorkscredentials’, ‘%APPDATA%RoamingMathWorksMATLAB’, reinstaling the Matlab 2024a. I don’t know what else to do in order to fix this problem.
Can you help me?I keep receiving the message "Unable to save login information. You are currently signed in but you will be prompted to sign in again the next time that you start this application." everytime I start the Matlab application.
I tried to follow all the steps I could find, such as reinstaling the Mathworks Service Host, eliminating the files at ‘%APPDATA%MathWorkscredentials’, ‘%APPDATA%RoamingMathWorksMATLAB’, reinstaling the Matlab 2024a. I don’t know what else to do in order to fix this problem.
Can you help me? I keep receiving the message "Unable to save login information. You are currently signed in but you will be prompted to sign in again the next time that you start this application." everytime I start the Matlab application.
I tried to follow all the steps I could find, such as reinstaling the Mathworks Service Host, eliminating the files at ‘%APPDATA%MathWorkscredentials’, ‘%APPDATA%RoamingMathWorksMATLAB’, reinstaling the Matlab 2024a. I don’t know what else to do in order to fix this problem.
Can you help me? login, r2024a, credentials MATLAB Answers — New Questions
Error in data size using CIC filter in Simulink R2020b: The number of input rows must be a multiple of the decimation factor
I am trying a simple Simulink model of an NCO generating a sin and cos which I then use in their own respective CIC decimator to generate quad and real output signals.
In the two product blocks (X) I get an error "The number of input rows must be a multiple of the decimation factor". I tried adding the convert blocks and specifying output type fixdt(1,20,18), but that didn’t help. The NCO is generating the proper sin and cos with amplitude +/-1 and frequency 13.5MHz with a 256Mhz sample rate.
What is the trick to getting the CIC to work? I looked at a similar Matlab Example for a GSM dds and it worked, but there was nothing special done (that I could see) to make the CIC input data types correct. Please help, I’ve spent a day chasing this problem :(I am trying a simple Simulink model of an NCO generating a sin and cos which I then use in their own respective CIC decimator to generate quad and real output signals.
In the two product blocks (X) I get an error "The number of input rows must be a multiple of the decimation factor". I tried adding the convert blocks and specifying output type fixdt(1,20,18), but that didn’t help. The NCO is generating the proper sin and cos with amplitude +/-1 and frequency 13.5MHz with a 256Mhz sample rate.
What is the trick to getting the CIC to work? I looked at a similar Matlab Example for a GSM dds and it worked, but there was nothing special done (that I could see) to make the CIC input data types correct. Please help, I’ve spent a day chasing this problem 🙁 I am trying a simple Simulink model of an NCO generating a sin and cos which I then use in their own respective CIC decimator to generate quad and real output signals.
In the two product blocks (X) I get an error "The number of input rows must be a multiple of the decimation factor". I tried adding the convert blocks and specifying output type fixdt(1,20,18), but that didn’t help. The NCO is generating the proper sin and cos with amplitude +/-1 and frequency 13.5MHz with a 256Mhz sample rate.
What is the trick to getting the CIC to work? I looked at a similar Matlab Example for a GSM dds and it worked, but there was nothing special done (that I could see) to make the CIC input data types correct. Please help, I’ve spent a day chasing this problem 🙁 #cic, #simulink MATLAB Answers — New Questions
Slicing arrays and save it in the file
Hello,
I have a file of the following form:
data condition device
-297.367190000000 8 1
-295.132890000000 8 1
-268.007000000000 8 2
-268.007000000000 8 2
-262.109380000000 7 1
-263.296880000000 7 1
-263.562500000000 7 2
-263.562500000000 7 2
-258.973210000000 6 1
-255.209820000000 6 1
-255.209820000000 6 2
-255.209820000000 6 2
I would like to process the data being a slice of array for the given condition and device for instance one slice would be:
-297.367190000000 8 1
-295.132890000000 8 1
and save the result in file with the following format for instance for the data above:
dataProcessed_condition8_device1
How could I cut such slice and save it in the file of the described format?
Regards
ElzbietaHello,
I have a file of the following form:
data condition device
-297.367190000000 8 1
-295.132890000000 8 1
-268.007000000000 8 2
-268.007000000000 8 2
-262.109380000000 7 1
-263.296880000000 7 1
-263.562500000000 7 2
-263.562500000000 7 2
-258.973210000000 6 1
-255.209820000000 6 1
-255.209820000000 6 2
-255.209820000000 6 2
I would like to process the data being a slice of array for the given condition and device for instance one slice would be:
-297.367190000000 8 1
-295.132890000000 8 1
and save the result in file with the following format for instance for the data above:
dataProcessed_condition8_device1
How could I cut such slice and save it in the file of the described format?
Regards
Elzbieta Hello,
I have a file of the following form:
data condition device
-297.367190000000 8 1
-295.132890000000 8 1
-268.007000000000 8 2
-268.007000000000 8 2
-262.109380000000 7 1
-263.296880000000 7 1
-263.562500000000 7 2
-263.562500000000 7 2
-258.973210000000 6 1
-255.209820000000 6 1
-255.209820000000 6 2
-255.209820000000 6 2
I would like to process the data being a slice of array for the given condition and device for instance one slice would be:
-297.367190000000 8 1
-295.132890000000 8 1
and save the result in file with the following format for instance for the data above:
dataProcessed_condition8_device1
How could I cut such slice and save it in the file of the described format?
Regards
Elzbieta slice array MATLAB Answers — New Questions
Error message when using timers in AppDesigner after a few seconds running
I’m quite new to using timers in Matlab, and currently I’m running a project that will need them to continuously update some info in our App Designer window. The problem is, I followed the instructions in this tutorial from Matlab and initially my timer and callback function work normally. But after some time of it running I receive the following error message:
Error while evaluating TimerFcn for timer ‘timer-1’
Not enough input arguments.
I currently initialize my timer in the startupFcn of the app as:
function startupFcn(app)
global params
app.textbox_Log.Value = {‘Start’};
app.timerCounter1sec = 0;
app.timerCounter10sec = 0;
app.logStatus = ‘running’;
app.timer500ms = timer(‘Period’,0.5,…
‘ExecutionMode’, ‘fixedSpacing’, …
‘TasksToExecute’, Inf, …
‘BusyMode’, ‘drop’, …
‘TimerFcn’, @app.timerTest);
start(app.timer500ms);
updateJobList(app, params);
fillJobsTable(app, params);
end
And my callback function is defined as the following (I will omit the code for now since I don’t think it’s that important right now):
function timerTest(app,~,~)
% Function details…
end
Can someone help me with this? I have no clue of what is happening to throw this error in the timer, even considering that it works for around 3-4 seconds before breaking.I’m quite new to using timers in Matlab, and currently I’m running a project that will need them to continuously update some info in our App Designer window. The problem is, I followed the instructions in this tutorial from Matlab and initially my timer and callback function work normally. But after some time of it running I receive the following error message:
Error while evaluating TimerFcn for timer ‘timer-1’
Not enough input arguments.
I currently initialize my timer in the startupFcn of the app as:
function startupFcn(app)
global params
app.textbox_Log.Value = {‘Start’};
app.timerCounter1sec = 0;
app.timerCounter10sec = 0;
app.logStatus = ‘running’;
app.timer500ms = timer(‘Period’,0.5,…
‘ExecutionMode’, ‘fixedSpacing’, …
‘TasksToExecute’, Inf, …
‘BusyMode’, ‘drop’, …
‘TimerFcn’, @app.timerTest);
start(app.timer500ms);
updateJobList(app, params);
fillJobsTable(app, params);
end
And my callback function is defined as the following (I will omit the code for now since I don’t think it’s that important right now):
function timerTest(app,~,~)
% Function details…
end
Can someone help me with this? I have no clue of what is happening to throw this error in the timer, even considering that it works for around 3-4 seconds before breaking. I’m quite new to using timers in Matlab, and currently I’m running a project that will need them to continuously update some info in our App Designer window. The problem is, I followed the instructions in this tutorial from Matlab and initially my timer and callback function work normally. But after some time of it running I receive the following error message:
Error while evaluating TimerFcn for timer ‘timer-1’
Not enough input arguments.
I currently initialize my timer in the startupFcn of the app as:
function startupFcn(app)
global params
app.textbox_Log.Value = {‘Start’};
app.timerCounter1sec = 0;
app.timerCounter10sec = 0;
app.logStatus = ‘running’;
app.timer500ms = timer(‘Period’,0.5,…
‘ExecutionMode’, ‘fixedSpacing’, …
‘TasksToExecute’, Inf, …
‘BusyMode’, ‘drop’, …
‘TimerFcn’, @app.timerTest);
start(app.timer500ms);
updateJobList(app, params);
fillJobsTable(app, params);
end
And my callback function is defined as the following (I will omit the code for now since I don’t think it’s that important right now):
function timerTest(app,~,~)
% Function details…
end
Can someone help me with this? I have no clue of what is happening to throw this error in the timer, even considering that it works for around 3-4 seconds before breaking. timer, appdesigner, app designer, handles, error, input argument MATLAB Answers — New Questions
Problem with Fast Restart and Simulink Scenario Reader
Hello everyone,
I’m trying to train an RL agent on a vehicle to brake when encountering a pedestrian. I have set up a scenario using the driving scenario toolbox and everything in simulink to make it work.
I just have one problem: I’d like to randomize the pedestrian’s position, so I created a random function in the scenario definition script, but when I use fast restart the scenario reader gets stuck on the first simulation scenario. If I don’t, Simulink recompiles and everything works.
Is there a way to not disable fast restart, but still completely restart the scenario with variations?Hello everyone,
I’m trying to train an RL agent on a vehicle to brake when encountering a pedestrian. I have set up a scenario using the driving scenario toolbox and everything in simulink to make it work.
I just have one problem: I’d like to randomize the pedestrian’s position, so I created a random function in the scenario definition script, but when I use fast restart the scenario reader gets stuck on the first simulation scenario. If I don’t, Simulink recompiles and everything works.
Is there a way to not disable fast restart, but still completely restart the scenario with variations? Hello everyone,
I’m trying to train an RL agent on a vehicle to brake when encountering a pedestrian. I have set up a scenario using the driving scenario toolbox and everything in simulink to make it work.
I just have one problem: I’d like to randomize the pedestrian’s position, so I created a random function in the scenario definition script, but when I use fast restart the scenario reader gets stuck on the first simulation scenario. If I don’t, Simulink recompiles and everything works.
Is there a way to not disable fast restart, but still completely restart the scenario with variations? fast restart, driving scenario, reinforcement learning toolbox, reset scenario MATLAB Answers — New Questions
I want to plot RMSE from mat file but it gives error
When I run the m file, it gives me he following error:
Operator ‘-‘ is not supported for operands of type ‘cell’.
Error in RMSE_Plot (line 5)
MSE = mean((u-two).^2,2);
>>When I run the m file, it gives me he following error:
Operator ‘-‘ is not supported for operands of type ‘cell’.
Error in RMSE_Plot (line 5)
MSE = mean((u-two).^2,2);
>> When I run the m file, it gives me he following error:
Operator ‘-‘ is not supported for operands of type ‘cell’.
Error in RMSE_Plot (line 5)
MSE = mean((u-two).^2,2);
>> code gives error, rmse error, plotting, mat file MATLAB Answers — New Questions
Error while running NR Intercell Interference Model
Dear All,
Thanks in advance. Do I need to include any package?
==================code
wirelessnetworkSupportPackageCheck
rng("default") % Reset the random number generator
numFrameSimulation = 20; % Simulation time in terms of number of 10 ms frames
networkSimulator = wirelessNetworkSimulator.init;
gNBPositions = [1700 600 30; 3000 600 30; 2500 2000 30];
gNBOfInterestIdx = 3; % Specify an integer value in the range [1, number of gNBs]
gNBNames = "gNB-" + (1:size(gNBPositions,1));
gNBs = nrGNB(Name=gNBNames,Position=gNBPositions,CarrierFrequency=2.5e9, …
ChannelBandwidth=10e6,SubcarrierSpacing=30e3,TransmitPower=32,ReceiveGain=11);
for gNBIdx = 1:length(gNBs)
% Resource allocation type value 0 indicates a noncontiguous allocation of
% frequency-domain resources in terms of RBGs
configureScheduler(gNBs(gNBIdx),ResourceAllocationType=0)
end
numCells = length(gNBs);
cellRadius = 500; % Radius of each cell (in meters)
numUEsPerCell = 4;
uePositions = generateUEPositions(cellRadius,gNBPositions,numUEsPerCell);
UEs = cell(numCells,1);
for cellIdx = 1:numCells
ueNames = "UE-" + (1:size(uePositions{cellIdx},1));
UEs{cellIdx} = nrUE(Name=ueNames,Position=uePositions{cellIdx},ReceiveGain=11);
connectUE(gNBs(cellIdx),UEs{cellIdx},FullBufferTraffic="DL")
end
addNodes(networkSimulator,gNBs);
for cellIdx = 1:numCells
addNodes(networkSimulator,UEs{cellIdx})
end
channelModel = "3GPP TR 38.901";
if strcmp(channelModel,"3GPP TR 38.901")
% Define scenario boundaries
pos = [reshape([gNBs.Position],3,[])];
minX = min(pos(1,:)); % x-coordinate of the left edge of the scenario in meters
minY = min(pos(2,:)); % y-coordinate of the bottom edge of the scenario in meters
width = max(pos(1,:)) – minX; % Width (right edge of the 2D scenario) in meters, given as maxX – minX
height = max(pos(2,:)) – minY; % Height (top edge of the 2D scenario) in meters, given as maxY – minY
% Create the channel model
channel = h38901Channel(Scenario="UMa",ScenarioExtents=[minX minY width height]);
% Add the channel model to the simulator
addChannelModel(networkSimulator,@channel.channelFunction);
connectNodes(channel,networkSimulator,InterfererHasSmallScale=true);
end
cellToAnalyze = gNBs(gNBOfInterestIdx).ID;
enableTraces = true;
linkDir = 0; % Indicates DL
if enableTraces
simSchedulingLogger = cell(numCells,1);
simPhyLogger = cell(numCells,1);
for cellIdx = 1:numCells
% Create an object for MAC DL scheduling traces logging
simSchedulingLogger{cellIdx} = helperNRSchedulingLogger(numFrameSimulation, …
gNBs(cellToAnalyze),UEs{cellToAnalyze},LinkDirection=linkDir);
% Create an object for PHY layer traces logging
simPhyLogger{cellIdx} = helperNRPhyLogger(numFrameSimulation,gNBs(cellToAnalyze), …
UEs{cellToAnalyze});
end
end
numMetricPlotUpdates = numFrameSimulation;
showSchedulerMetrics = true;
showPhyMetrics = true;
metricsVisualizer = helperNRMetricsVisualizer(gNBs(cellToAnalyze),UEs{cellToAnalyze}, …
CellOfInterest=cellToAnalyze,NumMetricsSteps=numMetricPlotUpdates, …
PlotSchedulerMetrics=showSchedulerMetrics,PlotPhyMetrics=showPhyMetrics,LinkDirection=linkDir);
simulationLogFile = "simulationLogs"; % For logging the simulation traces
enableMobility = false;
if enableMobility
ueSpeedRange = [1 1000]; % In meters per second
ueWithMobility = UEs{cellToAnalyze}(2); % Get UE-2 in the cell of interest
% Add random waypoint mobility to the selected UE
addMobility(ueWithMobility,SpeedRange=ueSpeedRange,BoundaryShape="circle",Bounds=[gNBs(cellToAnalyze).Position(1:2) cellRadius])
end
networkVisualizer = helperNetworkVisualizer(SampleRate=100); % Sample rate indicates the visualization refresh rate in Hertz
% Show the cell boundary of each gNB
showBoundaries(networkVisualizer,gNBPositions,cellRadius,cellToAnalyze)
% Calculate the simulation duration (in seconds)
simulationTime = numFrameSimulation*1e-2;
% Run the simulation
run(networkSimulator,simulationTime);
========================================================code
Error=====================================================
>> test001
Error using nrGNB/getMCSTable (line 1331)
Invalid default value for property ‘MCSTable’ in class ‘nrGNB’:
Unable to resolve the name ‘nr5g.internal.MACConstants.MCSTable’.
Error in test001 (line 8)
gNBs = nrGNB(Name=gNBNames,Position=gNBPositions,CarrierFrequency=2.5e9, …Dear All,
Thanks in advance. Do I need to include any package?
==================code
wirelessnetworkSupportPackageCheck
rng("default") % Reset the random number generator
numFrameSimulation = 20; % Simulation time in terms of number of 10 ms frames
networkSimulator = wirelessNetworkSimulator.init;
gNBPositions = [1700 600 30; 3000 600 30; 2500 2000 30];
gNBOfInterestIdx = 3; % Specify an integer value in the range [1, number of gNBs]
gNBNames = "gNB-" + (1:size(gNBPositions,1));
gNBs = nrGNB(Name=gNBNames,Position=gNBPositions,CarrierFrequency=2.5e9, …
ChannelBandwidth=10e6,SubcarrierSpacing=30e3,TransmitPower=32,ReceiveGain=11);
for gNBIdx = 1:length(gNBs)
% Resource allocation type value 0 indicates a noncontiguous allocation of
% frequency-domain resources in terms of RBGs
configureScheduler(gNBs(gNBIdx),ResourceAllocationType=0)
end
numCells = length(gNBs);
cellRadius = 500; % Radius of each cell (in meters)
numUEsPerCell = 4;
uePositions = generateUEPositions(cellRadius,gNBPositions,numUEsPerCell);
UEs = cell(numCells,1);
for cellIdx = 1:numCells
ueNames = "UE-" + (1:size(uePositions{cellIdx},1));
UEs{cellIdx} = nrUE(Name=ueNames,Position=uePositions{cellIdx},ReceiveGain=11);
connectUE(gNBs(cellIdx),UEs{cellIdx},FullBufferTraffic="DL")
end
addNodes(networkSimulator,gNBs);
for cellIdx = 1:numCells
addNodes(networkSimulator,UEs{cellIdx})
end
channelModel = "3GPP TR 38.901";
if strcmp(channelModel,"3GPP TR 38.901")
% Define scenario boundaries
pos = [reshape([gNBs.Position],3,[])];
minX = min(pos(1,:)); % x-coordinate of the left edge of the scenario in meters
minY = min(pos(2,:)); % y-coordinate of the bottom edge of the scenario in meters
width = max(pos(1,:)) – minX; % Width (right edge of the 2D scenario) in meters, given as maxX – minX
height = max(pos(2,:)) – minY; % Height (top edge of the 2D scenario) in meters, given as maxY – minY
% Create the channel model
channel = h38901Channel(Scenario="UMa",ScenarioExtents=[minX minY width height]);
% Add the channel model to the simulator
addChannelModel(networkSimulator,@channel.channelFunction);
connectNodes(channel,networkSimulator,InterfererHasSmallScale=true);
end
cellToAnalyze = gNBs(gNBOfInterestIdx).ID;
enableTraces = true;
linkDir = 0; % Indicates DL
if enableTraces
simSchedulingLogger = cell(numCells,1);
simPhyLogger = cell(numCells,1);
for cellIdx = 1:numCells
% Create an object for MAC DL scheduling traces logging
simSchedulingLogger{cellIdx} = helperNRSchedulingLogger(numFrameSimulation, …
gNBs(cellToAnalyze),UEs{cellToAnalyze},LinkDirection=linkDir);
% Create an object for PHY layer traces logging
simPhyLogger{cellIdx} = helperNRPhyLogger(numFrameSimulation,gNBs(cellToAnalyze), …
UEs{cellToAnalyze});
end
end
numMetricPlotUpdates = numFrameSimulation;
showSchedulerMetrics = true;
showPhyMetrics = true;
metricsVisualizer = helperNRMetricsVisualizer(gNBs(cellToAnalyze),UEs{cellToAnalyze}, …
CellOfInterest=cellToAnalyze,NumMetricsSteps=numMetricPlotUpdates, …
PlotSchedulerMetrics=showSchedulerMetrics,PlotPhyMetrics=showPhyMetrics,LinkDirection=linkDir);
simulationLogFile = "simulationLogs"; % For logging the simulation traces
enableMobility = false;
if enableMobility
ueSpeedRange = [1 1000]; % In meters per second
ueWithMobility = UEs{cellToAnalyze}(2); % Get UE-2 in the cell of interest
% Add random waypoint mobility to the selected UE
addMobility(ueWithMobility,SpeedRange=ueSpeedRange,BoundaryShape="circle",Bounds=[gNBs(cellToAnalyze).Position(1:2) cellRadius])
end
networkVisualizer = helperNetworkVisualizer(SampleRate=100); % Sample rate indicates the visualization refresh rate in Hertz
% Show the cell boundary of each gNB
showBoundaries(networkVisualizer,gNBPositions,cellRadius,cellToAnalyze)
% Calculate the simulation duration (in seconds)
simulationTime = numFrameSimulation*1e-2;
% Run the simulation
run(networkSimulator,simulationTime);
========================================================code
Error=====================================================
>> test001
Error using nrGNB/getMCSTable (line 1331)
Invalid default value for property ‘MCSTable’ in class ‘nrGNB’:
Unable to resolve the name ‘nr5g.internal.MACConstants.MCSTable’.
Error in test001 (line 8)
gNBs = nrGNB(Name=gNBNames,Position=gNBPositions,CarrierFrequency=2.5e9, … Dear All,
Thanks in advance. Do I need to include any package?
==================code
wirelessnetworkSupportPackageCheck
rng("default") % Reset the random number generator
numFrameSimulation = 20; % Simulation time in terms of number of 10 ms frames
networkSimulator = wirelessNetworkSimulator.init;
gNBPositions = [1700 600 30; 3000 600 30; 2500 2000 30];
gNBOfInterestIdx = 3; % Specify an integer value in the range [1, number of gNBs]
gNBNames = "gNB-" + (1:size(gNBPositions,1));
gNBs = nrGNB(Name=gNBNames,Position=gNBPositions,CarrierFrequency=2.5e9, …
ChannelBandwidth=10e6,SubcarrierSpacing=30e3,TransmitPower=32,ReceiveGain=11);
for gNBIdx = 1:length(gNBs)
% Resource allocation type value 0 indicates a noncontiguous allocation of
% frequency-domain resources in terms of RBGs
configureScheduler(gNBs(gNBIdx),ResourceAllocationType=0)
end
numCells = length(gNBs);
cellRadius = 500; % Radius of each cell (in meters)
numUEsPerCell = 4;
uePositions = generateUEPositions(cellRadius,gNBPositions,numUEsPerCell);
UEs = cell(numCells,1);
for cellIdx = 1:numCells
ueNames = "UE-" + (1:size(uePositions{cellIdx},1));
UEs{cellIdx} = nrUE(Name=ueNames,Position=uePositions{cellIdx},ReceiveGain=11);
connectUE(gNBs(cellIdx),UEs{cellIdx},FullBufferTraffic="DL")
end
addNodes(networkSimulator,gNBs);
for cellIdx = 1:numCells
addNodes(networkSimulator,UEs{cellIdx})
end
channelModel = "3GPP TR 38.901";
if strcmp(channelModel,"3GPP TR 38.901")
% Define scenario boundaries
pos = [reshape([gNBs.Position],3,[])];
minX = min(pos(1,:)); % x-coordinate of the left edge of the scenario in meters
minY = min(pos(2,:)); % y-coordinate of the bottom edge of the scenario in meters
width = max(pos(1,:)) – minX; % Width (right edge of the 2D scenario) in meters, given as maxX – minX
height = max(pos(2,:)) – minY; % Height (top edge of the 2D scenario) in meters, given as maxY – minY
% Create the channel model
channel = h38901Channel(Scenario="UMa",ScenarioExtents=[minX minY width height]);
% Add the channel model to the simulator
addChannelModel(networkSimulator,@channel.channelFunction);
connectNodes(channel,networkSimulator,InterfererHasSmallScale=true);
end
cellToAnalyze = gNBs(gNBOfInterestIdx).ID;
enableTraces = true;
linkDir = 0; % Indicates DL
if enableTraces
simSchedulingLogger = cell(numCells,1);
simPhyLogger = cell(numCells,1);
for cellIdx = 1:numCells
% Create an object for MAC DL scheduling traces logging
simSchedulingLogger{cellIdx} = helperNRSchedulingLogger(numFrameSimulation, …
gNBs(cellToAnalyze),UEs{cellToAnalyze},LinkDirection=linkDir);
% Create an object for PHY layer traces logging
simPhyLogger{cellIdx} = helperNRPhyLogger(numFrameSimulation,gNBs(cellToAnalyze), …
UEs{cellToAnalyze});
end
end
numMetricPlotUpdates = numFrameSimulation;
showSchedulerMetrics = true;
showPhyMetrics = true;
metricsVisualizer = helperNRMetricsVisualizer(gNBs(cellToAnalyze),UEs{cellToAnalyze}, …
CellOfInterest=cellToAnalyze,NumMetricsSteps=numMetricPlotUpdates, …
PlotSchedulerMetrics=showSchedulerMetrics,PlotPhyMetrics=showPhyMetrics,LinkDirection=linkDir);
simulationLogFile = "simulationLogs"; % For logging the simulation traces
enableMobility = false;
if enableMobility
ueSpeedRange = [1 1000]; % In meters per second
ueWithMobility = UEs{cellToAnalyze}(2); % Get UE-2 in the cell of interest
% Add random waypoint mobility to the selected UE
addMobility(ueWithMobility,SpeedRange=ueSpeedRange,BoundaryShape="circle",Bounds=[gNBs(cellToAnalyze).Position(1:2) cellRadius])
end
networkVisualizer = helperNetworkVisualizer(SampleRate=100); % Sample rate indicates the visualization refresh rate in Hertz
% Show the cell boundary of each gNB
showBoundaries(networkVisualizer,gNBPositions,cellRadius,cellToAnalyze)
% Calculate the simulation duration (in seconds)
simulationTime = numFrameSimulation*1e-2;
% Run the simulation
run(networkSimulator,simulationTime);
========================================================code
Error=====================================================
>> test001
Error using nrGNB/getMCSTable (line 1331)
Invalid default value for property ‘MCSTable’ in class ‘nrGNB’:
Unable to resolve the name ‘nr5g.internal.MACConstants.MCSTable’.
Error in test001 (line 8)
gNBs = nrGNB(Name=gNBNames,Position=gNBPositions,CarrierFrequency=2.5e9, … matlab, 5g interferance MATLAB Answers — New Questions
Can we design a CNN Model in simulink
Can we model ourself a CNN Model using Deep learning toolbox in simulinkCan we model ourself a CNN Model using Deep learning toolbox in simulink Can we model ourself a CNN Model using Deep learning toolbox in simulink #deeplearning toolbox, simulink, deep learning MATLAB Answers — New Questions
times font with latex interpreter
Hello,
I have the same problem described in the threads below: I need to control the latex math font, specifically, I need to use the mathptmx package.
http://www.mathworks.com/matlabcentral/answers/10282-latex-interpreter-different-fonts
http://www.mathworks.com/matlabcentral/newsreader/view_thread/283068
In this second thread, Huy Phan describes a way of hacking into the tex.m file and adding usepackage{whatever} to the standardhead variable in localDecorateInputString. I have made it to Step 3 of Huy Phan’s procedure, but have not had luck getting much further, I suspect because the path dependencies are a rabbit hole. It is not clear if it worked out for the others in the thread either.
Here are a couple of simple examples illustrating what I would like to do. First is a .tex file that runs fine with my texlive distribution:
documentclass{mwarticle}
usepackage{mathptmx}
begin{document}
This is a short article for testing fonts. Here is some math stuff: $y = x$.
end{document}
Next is a Matlab figure:
figure(1);
text(.5,.5,’$y=x$’,’interpreter’,’latex’)
I would like to get the y=x in the Matlab figure to use the same Times font produced using texlive.
Is there a way to get Matlab to run latex from texlive? Or does anyone think they can get Huy Phan’s method working for mathptmx? I have tried adding all the directories shown in the log file from texlive to the TeXPath in tex.m, but this had not solved the problem.
Many thanks!
RandyHello,
I have the same problem described in the threads below: I need to control the latex math font, specifically, I need to use the mathptmx package.
http://www.mathworks.com/matlabcentral/answers/10282-latex-interpreter-different-fonts
http://www.mathworks.com/matlabcentral/newsreader/view_thread/283068
In this second thread, Huy Phan describes a way of hacking into the tex.m file and adding usepackage{whatever} to the standardhead variable in localDecorateInputString. I have made it to Step 3 of Huy Phan’s procedure, but have not had luck getting much further, I suspect because the path dependencies are a rabbit hole. It is not clear if it worked out for the others in the thread either.
Here are a couple of simple examples illustrating what I would like to do. First is a .tex file that runs fine with my texlive distribution:
documentclass{mwarticle}
usepackage{mathptmx}
begin{document}
This is a short article for testing fonts. Here is some math stuff: $y = x$.
end{document}
Next is a Matlab figure:
figure(1);
text(.5,.5,’$y=x$’,’interpreter’,’latex’)
I would like to get the y=x in the Matlab figure to use the same Times font produced using texlive.
Is there a way to get Matlab to run latex from texlive? Or does anyone think they can get Huy Phan’s method working for mathptmx? I have tried adding all the directories shown in the log file from texlive to the TeXPath in tex.m, but this had not solved the problem.
Many thanks!
Randy Hello,
I have the same problem described in the threads below: I need to control the latex math font, specifically, I need to use the mathptmx package.
http://www.mathworks.com/matlabcentral/answers/10282-latex-interpreter-different-fonts
http://www.mathworks.com/matlabcentral/newsreader/view_thread/283068
In this second thread, Huy Phan describes a way of hacking into the tex.m file and adding usepackage{whatever} to the standardhead variable in localDecorateInputString. I have made it to Step 3 of Huy Phan’s procedure, but have not had luck getting much further, I suspect because the path dependencies are a rabbit hole. It is not clear if it worked out for the others in the thread either.
Here are a couple of simple examples illustrating what I would like to do. First is a .tex file that runs fine with my texlive distribution:
documentclass{mwarticle}
usepackage{mathptmx}
begin{document}
This is a short article for testing fonts. Here is some math stuff: $y = x$.
end{document}
Next is a Matlab figure:
figure(1);
text(.5,.5,’$y=x$’,’interpreter’,’latex’)
I would like to get the y=x in the Matlab figure to use the same Times font produced using texlive.
Is there a way to get Matlab to run latex from texlive? Or does anyone think they can get Huy Phan’s method working for mathptmx? I have tried adding all the directories shown in the log file from texlive to the TeXPath in tex.m, but this had not solved the problem.
Many thanks!
Randy times font, latex MATLAB Answers — New Questions
LSTM for Battery prediction
Hello everyone,
I am currently working on estimating the lifespan of batteries using an LSTM network. The sequence length varies with each cycle. Unfortunately, the results have been very poor so far, as it seems the network is not reading the entire sequence of data correctly.
Below you will find the code for the neural network and a plot comparing the real data with the LSTM predictions.
I would greatly appreciate your support and advice!
Thank you in advance!
% Example data preparation
cycles = 167;
for i = 1:cycles
% Fill these with your actual data
voltageData{i} = normal(cha(i).data.Voltage_measured);
currentData{i} = normal(cha(i).data.Current_measured);
timeData{i} = normal(cha(i).data.Time);
temperatureData{i} = normal(cha(i).data.Temperature_measured);
%capacities(i) = …; % Actual capacity value for the i-th cycle
end
for i = 1:cycles
X{i,:} = [voltageData{i}; currentData{i}; timeData{i}; temperatureData{i}];
end
Y=normal(capa)’;
% Split data into training (70%), validation (15%), and test (15%) sets
TrainAmout = round(0.7 * cycles);
ValAmout = round(0.15 * cycles);
TestAmout = cycles – TrainAmout – ValAmout;
Index = randperm(cycles);
trainIndex = Index(1:TrainAmout);
valIndex = Index(TrainAmout+1:TrainAmout+ValAmout);
testIndex = Index(TrainAmout+ValAmout+1:end);
XTrain = X(trainIndex);
YTrain = Y(trainIndex);
XVal = X(valIndex);
YVal = Y(valIndex);
XTest = X(testIndex);
YTest = Y(testIndex);
inputSize = 4; % Four input features: voltage, current, time, temperature
numHiddenUnits = 50; % Number of hidden units in the LSTM layer
outputSize = 1; % Single output representing capacity
layers = [ …
sequenceInputLayer(inputSize)
lstmLayer(numHiddenUnits, ‘OutputMode’, ‘last’)
fullyConnectedLayer(outputSize)
regressionLayer];
% Set training options with validation data
options = trainingOptions(‘adam’, …
‘MaxEpochs’, 100, …
‘MiniBatchSize’, 10, …
‘InitialLearnRate’, 0.01, …
‘GradientThreshold’, 1, …
‘ValidationData’, {XVal, YVal}, …
‘ValidationFrequency’, 30, …
‘Verbose’, false, …
‘Plots’, ‘training-progress’);
% Train the network
net = trainNetwork(XTrain, YTrain, layers, options);Hello everyone,
I am currently working on estimating the lifespan of batteries using an LSTM network. The sequence length varies with each cycle. Unfortunately, the results have been very poor so far, as it seems the network is not reading the entire sequence of data correctly.
Below you will find the code for the neural network and a plot comparing the real data with the LSTM predictions.
I would greatly appreciate your support and advice!
Thank you in advance!
% Example data preparation
cycles = 167;
for i = 1:cycles
% Fill these with your actual data
voltageData{i} = normal(cha(i).data.Voltage_measured);
currentData{i} = normal(cha(i).data.Current_measured);
timeData{i} = normal(cha(i).data.Time);
temperatureData{i} = normal(cha(i).data.Temperature_measured);
%capacities(i) = …; % Actual capacity value for the i-th cycle
end
for i = 1:cycles
X{i,:} = [voltageData{i}; currentData{i}; timeData{i}; temperatureData{i}];
end
Y=normal(capa)’;
% Split data into training (70%), validation (15%), and test (15%) sets
TrainAmout = round(0.7 * cycles);
ValAmout = round(0.15 * cycles);
TestAmout = cycles – TrainAmout – ValAmout;
Index = randperm(cycles);
trainIndex = Index(1:TrainAmout);
valIndex = Index(TrainAmout+1:TrainAmout+ValAmout);
testIndex = Index(TrainAmout+ValAmout+1:end);
XTrain = X(trainIndex);
YTrain = Y(trainIndex);
XVal = X(valIndex);
YVal = Y(valIndex);
XTest = X(testIndex);
YTest = Y(testIndex);
inputSize = 4; % Four input features: voltage, current, time, temperature
numHiddenUnits = 50; % Number of hidden units in the LSTM layer
outputSize = 1; % Single output representing capacity
layers = [ …
sequenceInputLayer(inputSize)
lstmLayer(numHiddenUnits, ‘OutputMode’, ‘last’)
fullyConnectedLayer(outputSize)
regressionLayer];
% Set training options with validation data
options = trainingOptions(‘adam’, …
‘MaxEpochs’, 100, …
‘MiniBatchSize’, 10, …
‘InitialLearnRate’, 0.01, …
‘GradientThreshold’, 1, …
‘ValidationData’, {XVal, YVal}, …
‘ValidationFrequency’, 30, …
‘Verbose’, false, …
‘Plots’, ‘training-progress’);
% Train the network
net = trainNetwork(XTrain, YTrain, layers, options); Hello everyone,
I am currently working on estimating the lifespan of batteries using an LSTM network. The sequence length varies with each cycle. Unfortunately, the results have been very poor so far, as it seems the network is not reading the entire sequence of data correctly.
Below you will find the code for the neural network and a plot comparing the real data with the LSTM predictions.
I would greatly appreciate your support and advice!
Thank you in advance!
% Example data preparation
cycles = 167;
for i = 1:cycles
% Fill these with your actual data
voltageData{i} = normal(cha(i).data.Voltage_measured);
currentData{i} = normal(cha(i).data.Current_measured);
timeData{i} = normal(cha(i).data.Time);
temperatureData{i} = normal(cha(i).data.Temperature_measured);
%capacities(i) = …; % Actual capacity value for the i-th cycle
end
for i = 1:cycles
X{i,:} = [voltageData{i}; currentData{i}; timeData{i}; temperatureData{i}];
end
Y=normal(capa)’;
% Split data into training (70%), validation (15%), and test (15%) sets
TrainAmout = round(0.7 * cycles);
ValAmout = round(0.15 * cycles);
TestAmout = cycles – TrainAmout – ValAmout;
Index = randperm(cycles);
trainIndex = Index(1:TrainAmout);
valIndex = Index(TrainAmout+1:TrainAmout+ValAmout);
testIndex = Index(TrainAmout+ValAmout+1:end);
XTrain = X(trainIndex);
YTrain = Y(trainIndex);
XVal = X(valIndex);
YVal = Y(valIndex);
XTest = X(testIndex);
YTest = Y(testIndex);
inputSize = 4; % Four input features: voltage, current, time, temperature
numHiddenUnits = 50; % Number of hidden units in the LSTM layer
outputSize = 1; % Single output representing capacity
layers = [ …
sequenceInputLayer(inputSize)
lstmLayer(numHiddenUnits, ‘OutputMode’, ‘last’)
fullyConnectedLayer(outputSize)
regressionLayer];
% Set training options with validation data
options = trainingOptions(‘adam’, …
‘MaxEpochs’, 100, …
‘MiniBatchSize’, 10, …
‘InitialLearnRate’, 0.01, …
‘GradientThreshold’, 1, …
‘ValidationData’, {XVal, YVal}, …
‘ValidationFrequency’, 30, …
‘Verbose’, false, …
‘Plots’, ‘training-progress’);
% Train the network
net = trainNetwork(XTrain, YTrain, layers, options); deep learning, neural networks MATLAB Answers — New Questions
Taking outer product of two matrices
I have a 3×3 displacement matrix (let us call it u). The displacement gradient tensor F is given by
F = I + ∇ ⊗ u
where,
I = identity matrix
∇ = gradient operator
Can someone help me code this in MATLAB?I have a 3×3 displacement matrix (let us call it u). The displacement gradient tensor F is given by
F = I + ∇ ⊗ u
where,
I = identity matrix
∇ = gradient operator
Can someone help me code this in MATLAB? I have a 3×3 displacement matrix (let us call it u). The displacement gradient tensor F is given by
F = I + ∇ ⊗ u
where,
I = identity matrix
∇ = gradient operator
Can someone help me code this in MATLAB? deformation MATLAB Answers — New Questions
How do I call Simulink from Within Matlab then go back to the M-file software?
Alright, I need to call a Simulink file from an M file as though it were a subroutine. How do I call the Simulink file from within an M-file then return control to the M-file? Again, I would like to use the Simulink file like a subroutine. Can I do that? We’ll say the Simulink file that I want to use is called PlaneCalcs and I don’t know what the extension on that should be, which should give you some idea of how much of a newbie I am.
Can you also provide me with how I would transfer data to the Simulink file (call it "PlaneCalcs") then load that data into an input that would then feed an integrator. I’ve been told that I can use a multiplexer to supply the input to the Simulink integrator.
Please keep your response as basic as possible. Too much data will overload my mind and make your answer useless. I have NO SIMULINK background, so please don’t tell me to use fancy function names. I’ll probably need to multiply the inputs by a matrix. Again, can you tell me what to use to do this multiplication?
Also, how do I write a Simulink file and name it PlaneCalcs, so I can access it via the M-file?Alright, I need to call a Simulink file from an M file as though it were a subroutine. How do I call the Simulink file from within an M-file then return control to the M-file? Again, I would like to use the Simulink file like a subroutine. Can I do that? We’ll say the Simulink file that I want to use is called PlaneCalcs and I don’t know what the extension on that should be, which should give you some idea of how much of a newbie I am.
Can you also provide me with how I would transfer data to the Simulink file (call it "PlaneCalcs") then load that data into an input that would then feed an integrator. I’ve been told that I can use a multiplexer to supply the input to the Simulink integrator.
Please keep your response as basic as possible. Too much data will overload my mind and make your answer useless. I have NO SIMULINK background, so please don’t tell me to use fancy function names. I’ll probably need to multiply the inputs by a matrix. Again, can you tell me what to use to do this multiplication?
Also, how do I write a Simulink file and name it PlaneCalcs, so I can access it via the M-file? Alright, I need to call a Simulink file from an M file as though it were a subroutine. How do I call the Simulink file from within an M-file then return control to the M-file? Again, I would like to use the Simulink file like a subroutine. Can I do that? We’ll say the Simulink file that I want to use is called PlaneCalcs and I don’t know what the extension on that should be, which should give you some idea of how much of a newbie I am.
Can you also provide me with how I would transfer data to the Simulink file (call it "PlaneCalcs") then load that data into an input that would then feed an integrator. I’ve been told that I can use a multiplexer to supply the input to the Simulink integrator.
Please keep your response as basic as possible. Too much data will overload my mind and make your answer useless. I have NO SIMULINK background, so please don’t tell me to use fancy function names. I’ll probably need to multiply the inputs by a matrix. Again, can you tell me what to use to do this multiplication?
Also, how do I write a Simulink file and name it PlaneCalcs, so I can access it via the M-file? matlab m-file simulink joined MATLAB Answers — New Questions
Not enough arguments error in simulink model
Hi, I have created a simple model to process two images to detect features, and output distance estimates between matching features. The model has two spurces from corresponding files, Image 1 and Image 2. Each image is converted to RGB, and input to a function block I have defined as v= functionKAZE(grayImg1, grayImg2). This function block is linked to a scope showing v vs. time.
When I run this model, simulink responds with the error message "Not enough input arguments.". I have checked my function separately with the image files supplied from the command prompt, and works fine. What could I have missed? Thanks In advance.Hi, I have created a simple model to process two images to detect features, and output distance estimates between matching features. The model has two spurces from corresponding files, Image 1 and Image 2. Each image is converted to RGB, and input to a function block I have defined as v= functionKAZE(grayImg1, grayImg2). This function block is linked to a scope showing v vs. time.
When I run this model, simulink responds with the error message "Not enough input arguments.". I have checked my function separately with the image files supplied from the command prompt, and works fine. What could I have missed? Thanks In advance. Hi, I have created a simple model to process two images to detect features, and output distance estimates between matching features. The model has two spurces from corresponding files, Image 1 and Image 2. Each image is converted to RGB, and input to a function block I have defined as v= functionKAZE(grayImg1, grayImg2). This function block is linked to a scope showing v vs. time.
When I run this model, simulink responds with the error message "Not enough input arguments.". I have checked my function separately with the image files supplied from the command prompt, and works fine. What could I have missed? Thanks In advance. simulink, user function, model error MATLAB Answers — New Questions
Exportgraphics is not overwriting
I have a set of figures that I’m saving using exportgraphics, after making some changes to the programm i get a new set of figures but exportgraphics is not overwriting it. I have been using this to export images for a long time and it used to overwrite, but since yesterday it isn’t doing so. Any ideas about what may be causing this?I have a set of figures that I’m saving using exportgraphics, after making some changes to the programm i get a new set of figures but exportgraphics is not overwriting it. I have been using this to export images for a long time and it used to overwrite, but since yesterday it isn’t doing so. Any ideas about what may be causing this? I have a set of figures that I’m saving using exportgraphics, after making some changes to the programm i get a new set of figures but exportgraphics is not overwriting it. I have been using this to export images for a long time and it used to overwrite, but since yesterday it isn’t doing so. Any ideas about what may be causing this? export, image, save MATLAB Answers — New Questions
How to get acceleration data while using ODE solver for some governing equation of motion?
I am using ODE solver for a system of equations governing the motion of a model. In fact I am integrating the acceleration expressions by using ODE solver after converting them into state space form. and the Output I can get is position and velocities. How can I get the corresponding acceleration data? As the acceleration is alraedy definded in the form of expression in dydt vector, can’t I store the value of thethis vector which can give the acceleration? Please suggest me any simpler way to get acceleration without using any numerical approach to calculate acceleration from velocity data or finding the 3rd order diff. equation and then integrate to get acceleration.I am using ODE solver for a system of equations governing the motion of a model. In fact I am integrating the acceleration expressions by using ODE solver after converting them into state space form. and the Output I can get is position and velocities. How can I get the corresponding acceleration data? As the acceleration is alraedy definded in the form of expression in dydt vector, can’t I store the value of thethis vector which can give the acceleration? Please suggest me any simpler way to get acceleration without using any numerical approach to calculate acceleration from velocity data or finding the 3rd order diff. equation and then integrate to get acceleration. I am using ODE solver for a system of equations governing the motion of a model. In fact I am integrating the acceleration expressions by using ODE solver after converting them into state space form. and the Output I can get is position and velocities. How can I get the corresponding acceleration data? As the acceleration is alraedy definded in the form of expression in dydt vector, can’t I store the value of thethis vector which can give the acceleration? Please suggest me any simpler way to get acceleration without using any numerical approach to calculate acceleration from velocity data or finding the 3rd order diff. equation and then integrate to get acceleration. ode45 MATLAB Answers — New Questions
MCC USB-231 DAQ Digital I/O
Can the USB-231 DAQ handle digital input/output? In Matlab, I am doing an addinput() but it is saying digital is not supported.Can the USB-231 DAQ handle digital input/output? In Matlab, I am doing an addinput() but it is saying digital is not supported. Can the USB-231 DAQ handle digital input/output? In Matlab, I am doing an addinput() but it is saying digital is not supported. matlab, data acquisition, mcc MATLAB Answers — New Questions
How to add an NVCC flag
I am attempting to compile a program using CUDA, and am getting the following error in response
C:Program FilesMATLABR2024asyscudawin64cudaincludecrt/host_config.h(164): fatal error C1189:
#error: — unsupported Microsoft Visual Studio version! Only the versions between 2017 and 2022
(inclusive) are supported! The nvcc flag ‘-allow-unsupported-compiler’ can be used to override this
version check; however, using an unsupported host compiler may cause compilation failure or incorrect run
time execution. Use at your own risk.
I looked and it seems the problem is caused by a small glitch in a recent update of visual studio that shouldnt have any effect on the compiler. How do I add the flag to override the version check? My current code is as follows
mex -setup:’C:Program FilesMATLABR2024abinwin64mexoptsmsvcpp2022.xml’ C++
mexGPUallI am attempting to compile a program using CUDA, and am getting the following error in response
C:Program FilesMATLABR2024asyscudawin64cudaincludecrt/host_config.h(164): fatal error C1189:
#error: — unsupported Microsoft Visual Studio version! Only the versions between 2017 and 2022
(inclusive) are supported! The nvcc flag ‘-allow-unsupported-compiler’ can be used to override this
version check; however, using an unsupported host compiler may cause compilation failure or incorrect run
time execution. Use at your own risk.
I looked and it seems the problem is caused by a small glitch in a recent update of visual studio that shouldnt have any effect on the compiler. How do I add the flag to override the version check? My current code is as follows
mex -setup:’C:Program FilesMATLABR2024abinwin64mexoptsmsvcpp2022.xml’ C++
mexGPUall I am attempting to compile a program using CUDA, and am getting the following error in response
C:Program FilesMATLABR2024asyscudawin64cudaincludecrt/host_config.h(164): fatal error C1189:
#error: — unsupported Microsoft Visual Studio version! Only the versions between 2017 and 2022
(inclusive) are supported! The nvcc flag ‘-allow-unsupported-compiler’ can be used to override this
version check; however, using an unsupported host compiler may cause compilation failure or incorrect run
time execution. Use at your own risk.
I looked and it seems the problem is caused by a small glitch in a recent update of visual studio that shouldnt have any effect on the compiler. How do I add the flag to override the version check? My current code is as follows
mex -setup:’C:Program FilesMATLABR2024abinwin64mexoptsmsvcpp2022.xml’ C++
mexGPUall mex, compiler MATLAB Answers — New Questions
Solver decreases step-size at certain anomalies
Hey hello there!
So i have the following Issue. I am simulating the attitude (orientation) of a satellite via simulink. My initial conditions are usually a spinning satellite that gets slowed down. And when i reach small turn rates (derivative of the magnetic field is very low) my simulation breaks down and my step size decreases so drastically that it takes almost 30min to simulate 1s. And that cant be right somehow.
My tolerance settings are:
Absolute Tolerance: 10*e-8
Relative Tolerance: 10*e-6
Maybe they are low, but they work for most of the time with reasonable step sizes. (as one can see in the graph below)
This is how the step-size graph looks like for an edge case where i get the solver exceptiosn with error control but only for "short" time frames that still take minutes to compute.
At those time intervals the derivative of the magnetic field approaches 0 (1st graph below) and starts to do weird stuff. But when i tell the derivative that it should be 0 when close to 0 the simulation slows down even faster and my magnetic field derivative just starts to flicker (2nd graph).
Are there any general things one has to consider? Does stuff like this happen often in simulations?
Any Ideas how to fix this?
Some more additional Information:
Simulation Overview:
So what the simulation basically does is. It tries to bring the angular velocity of the satellite close to zero. This is done by "measuring" the magnetic field of earth and then trying to align the satellite with earths magnetic field (as it can be roughly assumed constant). This is done via this logic:
Here the graph of my angular Velocity around the x-Axis and the Angular Acceleration Graph when those anomalies occur:
(The Angular acceleration graph is zoomed in on the y-axis as otherwise one would only see the spikes and the angular velocity graph is zoomed in a lot in both axis)
One can clearly see that the Angular Velocity first runs smoothly and then for some reason flattens out until increasing not so smoothly.
If you need more information i will gladly provide them.
Thanks for your Help :)Hey hello there!
So i have the following Issue. I am simulating the attitude (orientation) of a satellite via simulink. My initial conditions are usually a spinning satellite that gets slowed down. And when i reach small turn rates (derivative of the magnetic field is very low) my simulation breaks down and my step size decreases so drastically that it takes almost 30min to simulate 1s. And that cant be right somehow.
My tolerance settings are:
Absolute Tolerance: 10*e-8
Relative Tolerance: 10*e-6
Maybe they are low, but they work for most of the time with reasonable step sizes. (as one can see in the graph below)
This is how the step-size graph looks like for an edge case where i get the solver exceptiosn with error control but only for "short" time frames that still take minutes to compute.
At those time intervals the derivative of the magnetic field approaches 0 (1st graph below) and starts to do weird stuff. But when i tell the derivative that it should be 0 when close to 0 the simulation slows down even faster and my magnetic field derivative just starts to flicker (2nd graph).
Are there any general things one has to consider? Does stuff like this happen often in simulations?
Any Ideas how to fix this?
Some more additional Information:
Simulation Overview:
So what the simulation basically does is. It tries to bring the angular velocity of the satellite close to zero. This is done by "measuring" the magnetic field of earth and then trying to align the satellite with earths magnetic field (as it can be roughly assumed constant). This is done via this logic:
Here the graph of my angular Velocity around the x-Axis and the Angular Acceleration Graph when those anomalies occur:
(The Angular acceleration graph is zoomed in on the y-axis as otherwise one would only see the spikes and the angular velocity graph is zoomed in a lot in both axis)
One can clearly see that the Angular Velocity first runs smoothly and then for some reason flattens out until increasing not so smoothly.
If you need more information i will gladly provide them.
Thanks for your Help 🙂 Hey hello there!
So i have the following Issue. I am simulating the attitude (orientation) of a satellite via simulink. My initial conditions are usually a spinning satellite that gets slowed down. And when i reach small turn rates (derivative of the magnetic field is very low) my simulation breaks down and my step size decreases so drastically that it takes almost 30min to simulate 1s. And that cant be right somehow.
My tolerance settings are:
Absolute Tolerance: 10*e-8
Relative Tolerance: 10*e-6
Maybe they are low, but they work for most of the time with reasonable step sizes. (as one can see in the graph below)
This is how the step-size graph looks like for an edge case where i get the solver exceptiosn with error control but only for "short" time frames that still take minutes to compute.
At those time intervals the derivative of the magnetic field approaches 0 (1st graph below) and starts to do weird stuff. But when i tell the derivative that it should be 0 when close to 0 the simulation slows down even faster and my magnetic field derivative just starts to flicker (2nd graph).
Are there any general things one has to consider? Does stuff like this happen often in simulations?
Any Ideas how to fix this?
Some more additional Information:
Simulation Overview:
So what the simulation basically does is. It tries to bring the angular velocity of the satellite close to zero. This is done by "measuring" the magnetic field of earth and then trying to align the satellite with earths magnetic field (as it can be roughly assumed constant). This is done via this logic:
Here the graph of my angular Velocity around the x-Axis and the Angular Acceleration Graph when those anomalies occur:
(The Angular acceleration graph is zoomed in on the y-axis as otherwise one would only see the spikes and the angular velocity graph is zoomed in a lot in both axis)
One can clearly see that the Angular Velocity first runs smoothly and then for some reason flattens out until increasing not so smoothly.
If you need more information i will gladly provide them.
Thanks for your Help 🙂 simulink, solver, step-size MATLAB Answers — New Questions