Month: January 2025
A confusing problem about how to use boxLabelDatastore correctly
I don’t know how to deal with this issue and have tried to modify it several times, so I’m requesting someone who sees it to teach me.
thank you so much !!!I don’t know how to deal with this issue and have tried to modify it several times, so I’m requesting someone who sees it to teach me.
thank you so much !!! I don’t know how to deal with this issue and have tried to modify it several times, so I’m requesting someone who sees it to teach me.
thank you so much !!! formatting MATLAB Answers — New Questions
How to select engine variant in powertrain blockset
I want to work on 1.5 L naturally aspirated mapped engine whereas the default engine variant is 1.5L turbocharged engine how do i change my engine variantI want to work on 1.5 L naturally aspirated mapped engine whereas the default engine variant is 1.5L turbocharged engine how do i change my engine variant I want to work on 1.5 L naturally aspirated mapped engine whereas the default engine variant is 1.5L turbocharged engine how do i change my engine variant powertrain blockset, engine variant selection MATLAB Answers — New Questions
Sum two different coverage models
Is there a way to sum two different coverage outputs? I have two different transmitters and have plotted the output of each on the same coverage map. I notice that it appears to do the equivalent of a ‘max hold’ where the field patterns from the separate transmitters overlap. Is there a way to sum the field patterns from the separate transmitters? I realise that this would effectively assume zero phase diference at all points of interaction, but that suits what I am aiming to do.
So far I have tried converting the output of the coverage .Data to an array. This provides the lat, long, and dB output for each transmitter. What I can’t work out is how to sum these arrays when the lat and long values are different (as the transmitters are in different locations). In an ideal world, I would then convert the summed arrays back into a coverage map of the result.
Any help much appreciated.
% horn antenna setup
tx_horn = horn("Height", 0.06, "Width", 0.16, "Length", 0.10, "FeedHeight", …
0.04, "FeedWidth", 0.002, "FlareHeight", 0.216, "FlareLength", 0.15, …
"FlareWidth", 0.266);
% transmitter array setup
f = 1.3e9; % Frequency
c = 299792458; % Speed of light
wl = c / f; % Wavelength
M = 2; % Number of elements on each row
N = 2; % Number of elements on each column
dy = 0.5 * wl; % Spacing between row elements (m)
dz = 0.5 * wl; % Spacing between column elements (m)
ura = phased.URA([N M], [dz dy], ‘Element’, tx_horn);
% transmitter setup
tx1 = txsite(‘Latitude’, 52.36364, …
‘Longitude’, -3.77767, …
‘TransmitterFrequency’, f, …
‘Antenna’, ura, …
‘AntennaHeight’, 5, …
‘TransmitterPower’, 50, …
‘AntennaAngle’, 90);
tx2 = txsite(‘Latitude’, 52.36369, …
‘Longitude’, -3.78150, …
‘TransmitterFrequency’, f, …
‘Antenna’, ura, …
‘AntennaHeight’, 5, …
‘TransmitterPower’, 50, …
‘AntennaAngle’, 90);
% coverage output
e_max = -20;
e_min = -60;
e_step = 1;
cov1 = coverage(tx1, ‘close-in’, ‘SignalStrengths’, e_min:e_step:e_max, ‘ColorLimits’, [e_min e_max]);
cov2 = coverage(tx2, ‘close-in’, ‘SignalStrengths’, e_min:e_step:e_max, ‘ColorLimits’, [e_min e_max]);
% convert to arrays for summing?
tx_array1 = table2array(cov1.Data);
tx_array2 = table2array(cov2.Data);
% What next?Is there a way to sum two different coverage outputs? I have two different transmitters and have plotted the output of each on the same coverage map. I notice that it appears to do the equivalent of a ‘max hold’ where the field patterns from the separate transmitters overlap. Is there a way to sum the field patterns from the separate transmitters? I realise that this would effectively assume zero phase diference at all points of interaction, but that suits what I am aiming to do.
So far I have tried converting the output of the coverage .Data to an array. This provides the lat, long, and dB output for each transmitter. What I can’t work out is how to sum these arrays when the lat and long values are different (as the transmitters are in different locations). In an ideal world, I would then convert the summed arrays back into a coverage map of the result.
Any help much appreciated.
% horn antenna setup
tx_horn = horn("Height", 0.06, "Width", 0.16, "Length", 0.10, "FeedHeight", …
0.04, "FeedWidth", 0.002, "FlareHeight", 0.216, "FlareLength", 0.15, …
"FlareWidth", 0.266);
% transmitter array setup
f = 1.3e9; % Frequency
c = 299792458; % Speed of light
wl = c / f; % Wavelength
M = 2; % Number of elements on each row
N = 2; % Number of elements on each column
dy = 0.5 * wl; % Spacing between row elements (m)
dz = 0.5 * wl; % Spacing between column elements (m)
ura = phased.URA([N M], [dz dy], ‘Element’, tx_horn);
% transmitter setup
tx1 = txsite(‘Latitude’, 52.36364, …
‘Longitude’, -3.77767, …
‘TransmitterFrequency’, f, …
‘Antenna’, ura, …
‘AntennaHeight’, 5, …
‘TransmitterPower’, 50, …
‘AntennaAngle’, 90);
tx2 = txsite(‘Latitude’, 52.36369, …
‘Longitude’, -3.78150, …
‘TransmitterFrequency’, f, …
‘Antenna’, ura, …
‘AntennaHeight’, 5, …
‘TransmitterPower’, 50, …
‘AntennaAngle’, 90);
% coverage output
e_max = -20;
e_min = -60;
e_step = 1;
cov1 = coverage(tx1, ‘close-in’, ‘SignalStrengths’, e_min:e_step:e_max, ‘ColorLimits’, [e_min e_max]);
cov2 = coverage(tx2, ‘close-in’, ‘SignalStrengths’, e_min:e_step:e_max, ‘ColorLimits’, [e_min e_max]);
% convert to arrays for summing?
tx_array1 = table2array(cov1.Data);
tx_array2 = table2array(cov2.Data);
% What next? Is there a way to sum two different coverage outputs? I have two different transmitters and have plotted the output of each on the same coverage map. I notice that it appears to do the equivalent of a ‘max hold’ where the field patterns from the separate transmitters overlap. Is there a way to sum the field patterns from the separate transmitters? I realise that this would effectively assume zero phase diference at all points of interaction, but that suits what I am aiming to do.
So far I have tried converting the output of the coverage .Data to an array. This provides the lat, long, and dB output for each transmitter. What I can’t work out is how to sum these arrays when the lat and long values are different (as the transmitters are in different locations). In an ideal world, I would then convert the summed arrays back into a coverage map of the result.
Any help much appreciated.
% horn antenna setup
tx_horn = horn("Height", 0.06, "Width", 0.16, "Length", 0.10, "FeedHeight", …
0.04, "FeedWidth", 0.002, "FlareHeight", 0.216, "FlareLength", 0.15, …
"FlareWidth", 0.266);
% transmitter array setup
f = 1.3e9; % Frequency
c = 299792458; % Speed of light
wl = c / f; % Wavelength
M = 2; % Number of elements on each row
N = 2; % Number of elements on each column
dy = 0.5 * wl; % Spacing between row elements (m)
dz = 0.5 * wl; % Spacing between column elements (m)
ura = phased.URA([N M], [dz dy], ‘Element’, tx_horn);
% transmitter setup
tx1 = txsite(‘Latitude’, 52.36364, …
‘Longitude’, -3.77767, …
‘TransmitterFrequency’, f, …
‘Antenna’, ura, …
‘AntennaHeight’, 5, …
‘TransmitterPower’, 50, …
‘AntennaAngle’, 90);
tx2 = txsite(‘Latitude’, 52.36369, …
‘Longitude’, -3.78150, …
‘TransmitterFrequency’, f, …
‘Antenna’, ura, …
‘AntennaHeight’, 5, …
‘TransmitterPower’, 50, …
‘AntennaAngle’, 90);
% coverage output
e_max = -20;
e_min = -60;
e_step = 1;
cov1 = coverage(tx1, ‘close-in’, ‘SignalStrengths’, e_min:e_step:e_max, ‘ColorLimits’, [e_min e_max]);
cov2 = coverage(tx2, ‘close-in’, ‘SignalStrengths’, e_min:e_step:e_max, ‘ColorLimits’, [e_min e_max]);
% convert to arrays for summing?
tx_array1 = table2array(cov1.Data);
tx_array2 = table2array(cov2.Data);
% What next? coverage, sum, matlab MATLAB Answers — New Questions
compiler.runtime.customInstaller fails to reduce mcr installer size
I have a matlab toolbox, with a single-window GUI. I was able to build it mcc/deploytool to create a standalone 7MB executable. However, I was not happy for the installer size, as the R2016 matlab runtime is 700MB in size, 100x larger than my application.
When I saw a new matlab compiler API compiler.runtime.custominstaller coming with R2024b is cable of creating smaller MCR installer including only needed files, I was very happy and immediately tried it on free mod apk games website, however, the result was disappointing.
The installer bundled with MCR in R2024b for my app build by deploytool – without using the customInstaller – is 1.2GB in size (another 2x increase in size compared to the already large package generated by R2016). Then, when I called
results = compiler.build.standaloneApplication("myapp.m");
compiler.runtime.customInstaller("myapp_installer", results, ‘RuntimeDelivery’, ‘installer’);
however, the generated package has the same 1.2GB in size. I have followed the help page of compiler.runtime.customInstaller
https://www.mathworks.com/help/compiler/compiler.runtime.custominstaller.html
did I miss anything? why customInstaller fails to trim the installer size? my app only use basic matlab features.
the requiredMCRProducts.txt file shows that I only need the following MCR components
‘MATLAB Runtime – Core’
‘MATLAB Runtime – Graphics’
‘MATLAB Runtime – Non Interactive MATLAB’
‘MATLAB Runtime – Numerics’
‘MATLAB Runtime – Image Processing Toolbox Addin’I have a matlab toolbox, with a single-window GUI. I was able to build it mcc/deploytool to create a standalone 7MB executable. However, I was not happy for the installer size, as the R2016 matlab runtime is 700MB in size, 100x larger than my application.
When I saw a new matlab compiler API compiler.runtime.custominstaller coming with R2024b is cable of creating smaller MCR installer including only needed files, I was very happy and immediately tried it on free mod apk games website, however, the result was disappointing.
The installer bundled with MCR in R2024b for my app build by deploytool – without using the customInstaller – is 1.2GB in size (another 2x increase in size compared to the already large package generated by R2016). Then, when I called
results = compiler.build.standaloneApplication("myapp.m");
compiler.runtime.customInstaller("myapp_installer", results, ‘RuntimeDelivery’, ‘installer’);
however, the generated package has the same 1.2GB in size. I have followed the help page of compiler.runtime.customInstaller
https://www.mathworks.com/help/compiler/compiler.runtime.custominstaller.html
did I miss anything? why customInstaller fails to trim the installer size? my app only use basic matlab features.
the requiredMCRProducts.txt file shows that I only need the following MCR components
‘MATLAB Runtime – Core’
‘MATLAB Runtime – Graphics’
‘MATLAB Runtime – Non Interactive MATLAB’
‘MATLAB Runtime – Numerics’
‘MATLAB Runtime – Image Processing Toolbox Addin’ I have a matlab toolbox, with a single-window GUI. I was able to build it mcc/deploytool to create a standalone 7MB executable. However, I was not happy for the installer size, as the R2016 matlab runtime is 700MB in size, 100x larger than my application.
When I saw a new matlab compiler API compiler.runtime.custominstaller coming with R2024b is cable of creating smaller MCR installer including only needed files, I was very happy and immediately tried it on free mod apk games website, however, the result was disappointing.
The installer bundled with MCR in R2024b for my app build by deploytool – without using the customInstaller – is 1.2GB in size (another 2x increase in size compared to the already large package generated by R2016). Then, when I called
results = compiler.build.standaloneApplication("myapp.m");
compiler.runtime.customInstaller("myapp_installer", results, ‘RuntimeDelivery’, ‘installer’);
however, the generated package has the same 1.2GB in size. I have followed the help page of compiler.runtime.customInstaller
https://www.mathworks.com/help/compiler/compiler.runtime.custominstaller.html
did I miss anything? why customInstaller fails to trim the installer size? my app only use basic matlab features.
the requiredMCRProducts.txt file shows that I only need the following MCR components
‘MATLAB Runtime – Core’
‘MATLAB Runtime – Graphics’
‘MATLAB Runtime – Non Interactive MATLAB’
‘MATLAB Runtime – Numerics’
‘MATLAB Runtime – Image Processing Toolbox Addin’ matlab MATLAB Answers — New Questions
getSlope function issues for MATLAB code
I am trying to run this program in MATLAB R2024a but getting errors:
https://www.mathworks.com/matlabcentral/fileexchange/47605-creating-a-motion-detector-using-an-arduino-a-photoresistor-and-matlab
I might just be reading the code wrong but it looks like this script used a function ‘getSlope’ on line 93 of the ‘Run_Motion_Detector’ function. When I try to run this code it displays an error saying it (getSlope) is an undefined function or variable. Am I missing this function in an update or has it been replaced by a recent update? Is there an equivalent function in MATLAB I can code as a substitute ? The code’s authors states:
Slope Method – calculates a best-fit linear slope for a window of data. Requires both the voltage readings and their corresponding timestamps.I am trying to run this program in MATLAB R2024a but getting errors:
https://www.mathworks.com/matlabcentral/fileexchange/47605-creating-a-motion-detector-using-an-arduino-a-photoresistor-and-matlab
I might just be reading the code wrong but it looks like this script used a function ‘getSlope’ on line 93 of the ‘Run_Motion_Detector’ function. When I try to run this code it displays an error saying it (getSlope) is an undefined function or variable. Am I missing this function in an update or has it been replaced by a recent update? Is there an equivalent function in MATLAB I can code as a substitute ? The code’s authors states:
Slope Method – calculates a best-fit linear slope for a window of data. Requires both the voltage readings and their corresponding timestamps. I am trying to run this program in MATLAB R2024a but getting errors:
https://www.mathworks.com/matlabcentral/fileexchange/47605-creating-a-motion-detector-using-an-arduino-a-photoresistor-and-matlab
I might just be reading the code wrong but it looks like this script used a function ‘getSlope’ on line 93 of the ‘Run_Motion_Detector’ function. When I try to run this code it displays an error saying it (getSlope) is an undefined function or variable. Am I missing this function in an update or has it been replaced by a recent update? Is there an equivalent function in MATLAB I can code as a substitute ? The code’s authors states:
Slope Method – calculates a best-fit linear slope for a window of data. Requires both the voltage readings and their corresponding timestamps. getslope, slope, matlab, arduino, motion detector, photoresistor MATLAB Answers — New Questions
Unable to get electric drive train model working
Happy new year to all.
I am currently trying to create a simple electric drive train model, where it uses a battery connected to a converter to a motor and then calculate the thrust generated from the torque/rpm provided by the motor. I was also planning to include a simple feedback loop to ensure the input RPM was fulfiled.
In short, what i want to learn is, by having varying RPM input, how the motor would adjust itself to achieve the required RPM and how would this affect the battery SOC and the thrust calculation.
However, the output of my results is forever 0. Does anyone know where I gone wrong and if anyone could help me remedy my model. This would mean a lot, thank you in advance!
p.s. i am not an expert in electrical component, so do advise on what could be done.Happy new year to all.
I am currently trying to create a simple electric drive train model, where it uses a battery connected to a converter to a motor and then calculate the thrust generated from the torque/rpm provided by the motor. I was also planning to include a simple feedback loop to ensure the input RPM was fulfiled.
In short, what i want to learn is, by having varying RPM input, how the motor would adjust itself to achieve the required RPM and how would this affect the battery SOC and the thrust calculation.
However, the output of my results is forever 0. Does anyone know where I gone wrong and if anyone could help me remedy my model. This would mean a lot, thank you in advance!
p.s. i am not an expert in electrical component, so do advise on what could be done. Happy new year to all.
I am currently trying to create a simple electric drive train model, where it uses a battery connected to a converter to a motor and then calculate the thrust generated from the torque/rpm provided by the motor. I was also planning to include a simple feedback loop to ensure the input RPM was fulfiled.
In short, what i want to learn is, by having varying RPM input, how the motor would adjust itself to achieve the required RPM and how would this affect the battery SOC and the thrust calculation.
However, the output of my results is forever 0. Does anyone know where I gone wrong and if anyone could help me remedy my model. This would mean a lot, thank you in advance!
p.s. i am not an expert in electrical component, so do advise on what could be done. simulink, simscape, electric_motor_control MATLAB Answers — New Questions
CANOE与Simulink联合仿真生成dll出错
call "set MINGW_ROOT_PATH=C:TDM-GCC-64" x86
提示如下:
### Processing Template Makefile: D:ProgramsMATLABR2021brtwccanoecn_msdll.tmf
### Created makefile C:Users…DesktopaSignalAccessSignalAccess_cn_rtwSignalAccess.mk
### Building SignalAccess: .\SignalAccess.bat
C:…DesktopaSignalAccessSignalAccess_cn_rtw>call "set MINGW_ROOT_PATH=C:TDM-GCC-64" x86
文件名、目录名或卷标语法不正确。
C:Users…DesktopaSignalAccessSignalAccess_cn_rtw>nmake -f SignalAccess.mk MAT_FILE=1 GENERATE_MODEL_DESCRIPTION=1 DEBUG_BUILD=0 HAS_WES64_BUILD=0 HAS_WES_BUILD=1 HAS_ERT_BUILD=0 GENERATE_VMODULE=0 COMBINE_OUTPUT_UPDATE_FCNS=0 INCLUDE_MDL_TERMINATE_FCN=1 MULTI_INSTANCE_CODE=0 OPTS="-DTID01EQ=0" TARGET_ARCH="x86" XCP_MAX_MSG_LENGTH=-1 ANALYSIS_MODEL=0 HAS_CAPL_CALL=0 DO_COMPILER_OPTIMIZATION=0 BUILD_ERT=0
‘nmake’ 不是内部或外部命令,也不是可运行的程序
或批处理文件。
C:Users…DesktopaSignalAccessSignalAccess_cn_rtw>echo The make command returned an error of 9009
The make command returned an error of 9009
C:Users…DesktopaSignalAccessSignalAccess_cn_rtw>An_error_occurred_during_the_call_to_make
‘An_error_occurred_during_the_call_to_make’ 不是内部或外部命令,也不是可运行的程序
或批处理文件。call "set MINGW_ROOT_PATH=C:TDM-GCC-64" x86
提示如下:
### Processing Template Makefile: D:ProgramsMATLABR2021brtwccanoecn_msdll.tmf
### Created makefile C:Users…DesktopaSignalAccessSignalAccess_cn_rtwSignalAccess.mk
### Building SignalAccess: .\SignalAccess.bat
C:…DesktopaSignalAccessSignalAccess_cn_rtw>call "set MINGW_ROOT_PATH=C:TDM-GCC-64" x86
文件名、目录名或卷标语法不正确。
C:Users…DesktopaSignalAccessSignalAccess_cn_rtw>nmake -f SignalAccess.mk MAT_FILE=1 GENERATE_MODEL_DESCRIPTION=1 DEBUG_BUILD=0 HAS_WES64_BUILD=0 HAS_WES_BUILD=1 HAS_ERT_BUILD=0 GENERATE_VMODULE=0 COMBINE_OUTPUT_UPDATE_FCNS=0 INCLUDE_MDL_TERMINATE_FCN=1 MULTI_INSTANCE_CODE=0 OPTS="-DTID01EQ=0" TARGET_ARCH="x86" XCP_MAX_MSG_LENGTH=-1 ANALYSIS_MODEL=0 HAS_CAPL_CALL=0 DO_COMPILER_OPTIMIZATION=0 BUILD_ERT=0
‘nmake’ 不是内部或外部命令,也不是可运行的程序
或批处理文件。
C:Users…DesktopaSignalAccessSignalAccess_cn_rtw>echo The make command returned an error of 9009
The make command returned an error of 9009
C:Users…DesktopaSignalAccessSignalAccess_cn_rtw>An_error_occurred_during_the_call_to_make
‘An_error_occurred_during_the_call_to_make’ 不是内部或外部命令,也不是可运行的程序
或批处理文件。 call "set MINGW_ROOT_PATH=C:TDM-GCC-64" x86
提示如下:
### Processing Template Makefile: D:ProgramsMATLABR2021brtwccanoecn_msdll.tmf
### Created makefile C:Users…DesktopaSignalAccessSignalAccess_cn_rtwSignalAccess.mk
### Building SignalAccess: .\SignalAccess.bat
C:…DesktopaSignalAccessSignalAccess_cn_rtw>call "set MINGW_ROOT_PATH=C:TDM-GCC-64" x86
文件名、目录名或卷标语法不正确。
C:Users…DesktopaSignalAccessSignalAccess_cn_rtw>nmake -f SignalAccess.mk MAT_FILE=1 GENERATE_MODEL_DESCRIPTION=1 DEBUG_BUILD=0 HAS_WES64_BUILD=0 HAS_WES_BUILD=1 HAS_ERT_BUILD=0 GENERATE_VMODULE=0 COMBINE_OUTPUT_UPDATE_FCNS=0 INCLUDE_MDL_TERMINATE_FCN=1 MULTI_INSTANCE_CODE=0 OPTS="-DTID01EQ=0" TARGET_ARCH="x86" XCP_MAX_MSG_LENGTH=-1 ANALYSIS_MODEL=0 HAS_CAPL_CALL=0 DO_COMPILER_OPTIMIZATION=0 BUILD_ERT=0
‘nmake’ 不是内部或外部命令,也不是可运行的程序
或批处理文件。
C:Users…DesktopaSignalAccessSignalAccess_cn_rtw>echo The make command returned an error of 9009
The make command returned an error of 9009
C:Users…DesktopaSignalAccessSignalAccess_cn_rtw>An_error_occurred_during_the_call_to_make
‘An_error_occurred_during_the_call_to_make’ 不是内部或外部命令,也不是可运行的程序
或批处理文件。 canoe联合仿真 MATLAB Answers — New Questions
How to save a text file as a .mat file?
Hi,
I have a text file having data with each row having the format: a1,a2,a3,a4. I have close 2k such rows. I need to save the full text file as a .mat file. How do I get that? I already tried tetxscan but I run into cell within cell issue. Appreciate help.Hi,
I have a text file having data with each row having the format: a1,a2,a3,a4. I have close 2k such rows. I need to save the full text file as a .mat file. How do I get that? I already tried tetxscan but I run into cell within cell issue. Appreciate help. Hi,
I have a text file having data with each row having the format: a1,a2,a3,a4. I have close 2k such rows. I need to save the full text file as a .mat file. How do I get that? I already tried tetxscan but I run into cell within cell issue. Appreciate help. text file, textscan, mat-file MATLAB Answers — New Questions
Matlab R2020b freezes when closing figure (Intel macOS Big Sur)
Matlab R2020b Update 3 always freezes when closing a figure window containing any axes by using the top left closing button.
The operating system I am using is macOS Big Sur 11.1 on an Intel Mac Book Pro from mid-2017. No startup scripts are run.
On my system this can always be reproduced by opening Matlab 2020b and run the following command from the command window
figure; plot(1:10,1:10)
The figure opens as expected but using the red close button on the top left corner to close the window, Matlab instantly freezes and a spinning ball animation is shown. Matlab must be force quit then.
There is no problem closing the figure using the command
close(gcf)
This bug makes working with Matlab completely impossible to me. A similar behaviour could be seen on my system with previous Matlab versions like R2020a on macOS Mojave. But back then the bug was not so easy to reproduce. From time to time when closing a window belonging to Matlab it also froze.Matlab R2020b Update 3 always freezes when closing a figure window containing any axes by using the top left closing button.
The operating system I am using is macOS Big Sur 11.1 on an Intel Mac Book Pro from mid-2017. No startup scripts are run.
On my system this can always be reproduced by opening Matlab 2020b and run the following command from the command window
figure; plot(1:10,1:10)
The figure opens as expected but using the red close button on the top left corner to close the window, Matlab instantly freezes and a spinning ball animation is shown. Matlab must be force quit then.
There is no problem closing the figure using the command
close(gcf)
This bug makes working with Matlab completely impossible to me. A similar behaviour could be seen on my system with previous Matlab versions like R2020a on macOS Mojave. But back then the bug was not so easy to reproduce. From time to time when closing a window belonging to Matlab it also froze. Matlab R2020b Update 3 always freezes when closing a figure window containing any axes by using the top left closing button.
The operating system I am using is macOS Big Sur 11.1 on an Intel Mac Book Pro from mid-2017. No startup scripts are run.
On my system this can always be reproduced by opening Matlab 2020b and run the following command from the command window
figure; plot(1:10,1:10)
The figure opens as expected but using the red close button on the top left corner to close the window, Matlab instantly freezes and a spinning ball animation is shown. Matlab must be force quit then.
There is no problem closing the figure using the command
close(gcf)
This bug makes working with Matlab completely impossible to me. A similar behaviour could be seen on my system with previous Matlab versions like R2020a on macOS Mojave. But back then the bug was not so easy to reproduce. From time to time when closing a window belonging to Matlab it also froze. freeze, macos, big sur, figure, close MATLAB Answers — New Questions
Error running example “Deploy Semantic Segmentation Application Using TensorFlow Lite…”
Hi,
I am trying to run the MATLAB example "Deploy Semantic Segmentation Application Using TensorFlow Lite" but encountered errors. The example was opened by
openExample(‘deeplearning_shared/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample’)
I am using a Raspberry pi 4b, flashed with image mathworks_raspbian_DL_R22.2.0. Everything worked fine (the MEX file was generated on the host computer, and Raspberry pi was connected successfully) until code line 28, when attempting to generate a PIL MEX function:
codegen -config cfg tflite_semantic_predict -args ones(257,257,3,’single’)
where the code returns error messages. The first few lines of the error message reads:
—————————————
Error executing command "touch -c /home/pi/MATLAB_ws/R2024b/C/Users/phn/Documents/MATLAB/Examples/R2024b/deeplearning_shared/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample/codegen/lib/tflite_semantic_predict/*.*;make -j$(($(nproc)+1)) -Otarget -f tflite_semantic_predict_rtw.mk all MATLAB_WORKSPACE="/home/pi/MATLAB_ws/R2024b" LINUX_TARGET_LIBS_MACRO="" -C /home/pi/MATLAB_ws/R2024b/C/Users/phn/Documents/MATLAB/Examples/R2024b/deeplearning_shared/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample/codegen/lib/tflite_semantic_predict". Details:
STDERR: In file included from /home/pi/MATLAB_ws/R2024b/C/Program_Files/MATLAB/R2024b/toolbox/tflite_interface/invokeinterpreter/invokeinterpreter.cpp:6:
/home/pi/MATLAB_ws/R2024b/C/Program_Files/MATLAB/R2024b/toolbox/tflite_interface/invokeinterpreter/export/include/invokeinterpreter/invokeinterpreter.hpp:16:10: fatal error: kernels/register.h: No such file or directory
#include "kernels/register.h"
^~~~~~~~~~~~~~~~~~~~
compilation terminated.
make: *** [tflite_semantic_predict_rtw.mk:382: invokeinterpreter.cpp.o] Error 1
make: *** Waiting for unfinished jobs….
—————————————
The complete error message is attached.
Could anyone let me know how to fix this? Seems that the file kernels/register.h is missing, but I’m not sure how to fix this. Installing kernel headers on Raspberry Pi through "sudo apt install linux-headers-rpi" did not solve the problem.
Thank you!Hi,
I am trying to run the MATLAB example "Deploy Semantic Segmentation Application Using TensorFlow Lite" but encountered errors. The example was opened by
openExample(‘deeplearning_shared/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample’)
I am using a Raspberry pi 4b, flashed with image mathworks_raspbian_DL_R22.2.0. Everything worked fine (the MEX file was generated on the host computer, and Raspberry pi was connected successfully) until code line 28, when attempting to generate a PIL MEX function:
codegen -config cfg tflite_semantic_predict -args ones(257,257,3,’single’)
where the code returns error messages. The first few lines of the error message reads:
—————————————
Error executing command "touch -c /home/pi/MATLAB_ws/R2024b/C/Users/phn/Documents/MATLAB/Examples/R2024b/deeplearning_shared/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample/codegen/lib/tflite_semantic_predict/*.*;make -j$(($(nproc)+1)) -Otarget -f tflite_semantic_predict_rtw.mk all MATLAB_WORKSPACE="/home/pi/MATLAB_ws/R2024b" LINUX_TARGET_LIBS_MACRO="" -C /home/pi/MATLAB_ws/R2024b/C/Users/phn/Documents/MATLAB/Examples/R2024b/deeplearning_shared/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample/codegen/lib/tflite_semantic_predict". Details:
STDERR: In file included from /home/pi/MATLAB_ws/R2024b/C/Program_Files/MATLAB/R2024b/toolbox/tflite_interface/invokeinterpreter/invokeinterpreter.cpp:6:
/home/pi/MATLAB_ws/R2024b/C/Program_Files/MATLAB/R2024b/toolbox/tflite_interface/invokeinterpreter/export/include/invokeinterpreter/invokeinterpreter.hpp:16:10: fatal error: kernels/register.h: No such file or directory
#include "kernels/register.h"
^~~~~~~~~~~~~~~~~~~~
compilation terminated.
make: *** [tflite_semantic_predict_rtw.mk:382: invokeinterpreter.cpp.o] Error 1
make: *** Waiting for unfinished jobs….
—————————————
The complete error message is attached.
Could anyone let me know how to fix this? Seems that the file kernels/register.h is missing, but I’m not sure how to fix this. Installing kernel headers on Raspberry Pi through "sudo apt install linux-headers-rpi" did not solve the problem.
Thank you! Hi,
I am trying to run the MATLAB example "Deploy Semantic Segmentation Application Using TensorFlow Lite" but encountered errors. The example was opened by
openExample(‘deeplearning_shared/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample’)
I am using a Raspberry pi 4b, flashed with image mathworks_raspbian_DL_R22.2.0. Everything worked fine (the MEX file was generated on the host computer, and Raspberry pi was connected successfully) until code line 28, when attempting to generate a PIL MEX function:
codegen -config cfg tflite_semantic_predict -args ones(257,257,3,’single’)
where the code returns error messages. The first few lines of the error message reads:
—————————————
Error executing command "touch -c /home/pi/MATLAB_ws/R2024b/C/Users/phn/Documents/MATLAB/Examples/R2024b/deeplearning_shared/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample/codegen/lib/tflite_semantic_predict/*.*;make -j$(($(nproc)+1)) -Otarget -f tflite_semantic_predict_rtw.mk all MATLAB_WORKSPACE="/home/pi/MATLAB_ws/R2024b" LINUX_TARGET_LIBS_MACRO="" -C /home/pi/MATLAB_ws/R2024b/C/Users/phn/Documents/MATLAB/Examples/R2024b/deeplearning_shared/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample/codegen/lib/tflite_semantic_predict". Details:
STDERR: In file included from /home/pi/MATLAB_ws/R2024b/C/Program_Files/MATLAB/R2024b/toolbox/tflite_interface/invokeinterpreter/invokeinterpreter.cpp:6:
/home/pi/MATLAB_ws/R2024b/C/Program_Files/MATLAB/R2024b/toolbox/tflite_interface/invokeinterpreter/export/include/invokeinterpreter/invokeinterpreter.hpp:16:10: fatal error: kernels/register.h: No such file or directory
#include "kernels/register.h"
^~~~~~~~~~~~~~~~~~~~
compilation terminated.
make: *** [tflite_semantic_predict_rtw.mk:382: invokeinterpreter.cpp.o] Error 1
make: *** Waiting for unfinished jobs….
—————————————
The complete error message is attached.
Could anyone let me know how to fix this? Seems that the file kernels/register.h is missing, but I’m not sure how to fix this. Installing kernel headers on Raspberry Pi through "sudo apt install linux-headers-rpi" did not solve the problem.
Thank you! raspberry pi, semantic segmentation, deploy, tflite MATLAB Answers — New Questions
Why does the “filtfilt” function cause a large transient response?
I have observed that the "filtfilt" function exhibits undesired behavior when I use it with IIR bandpass filters that have steep transition bands. Specifically, the output signal shows an excessive transient response.
Here is a code to generate an example
%% filter design
bp = designfilt(‘bandpassiir’, ‘StopbandFrequency1’, 50, ‘PassbandFrequency1’, 250,…
‘PassbandFrequency2’, 3600, ‘StopbandFrequency2’, 3700, ‘StopbandAttenuation1’, 30,…
‘PassbandRipple’, 0.1, ‘StopbandAttenuation2’, 30, ‘SampleRate’, 8000, ‘DesignMethod’, ‘cheby2’);
%% apply filtfilt to a random (white) long input signal; output signal shows an undesirable transient
rng(100);
x = randn(2^20,1);
ysos = filtfilt(bp,x);
% plot result with sos form
figure(1)
plot(ysos)
axis padded
The above code generates the following results, which shows an excessive transient response at a level of 1 × 10^7 at the beginning and the end of filtered signal.I have observed that the "filtfilt" function exhibits undesired behavior when I use it with IIR bandpass filters that have steep transition bands. Specifically, the output signal shows an excessive transient response.
Here is a code to generate an example
%% filter design
bp = designfilt(‘bandpassiir’, ‘StopbandFrequency1’, 50, ‘PassbandFrequency1’, 250,…
‘PassbandFrequency2’, 3600, ‘StopbandFrequency2’, 3700, ‘StopbandAttenuation1’, 30,…
‘PassbandRipple’, 0.1, ‘StopbandAttenuation2’, 30, ‘SampleRate’, 8000, ‘DesignMethod’, ‘cheby2’);
%% apply filtfilt to a random (white) long input signal; output signal shows an undesirable transient
rng(100);
x = randn(2^20,1);
ysos = filtfilt(bp,x);
% plot result with sos form
figure(1)
plot(ysos)
axis padded
The above code generates the following results, which shows an excessive transient response at a level of 1 × 10^7 at the beginning and the end of filtered signal. I have observed that the "filtfilt" function exhibits undesired behavior when I use it with IIR bandpass filters that have steep transition bands. Specifically, the output signal shows an excessive transient response.
Here is a code to generate an example
%% filter design
bp = designfilt(‘bandpassiir’, ‘StopbandFrequency1’, 50, ‘PassbandFrequency1’, 250,…
‘PassbandFrequency2’, 3600, ‘StopbandFrequency2’, 3700, ‘StopbandAttenuation1’, 30,…
‘PassbandRipple’, 0.1, ‘StopbandAttenuation2’, 30, ‘SampleRate’, 8000, ‘DesignMethod’, ‘cheby2’);
%% apply filtfilt to a random (white) long input signal; output signal shows an undesirable transient
rng(100);
x = randn(2^20,1);
ysos = filtfilt(bp,x);
% plot result with sos form
figure(1)
plot(ysos)
axis padded
The above code generates the following results, which shows an excessive transient response at a level of 1 × 10^7 at the beginning and the end of filtered signal. filterdesign, secondordersection, iirfilterdesign, filtfilt MATLAB Answers — New Questions
Why does .mat file previewer take so long?
I often wish to preview the contents of a .mat file in the Current Folder browser. Some of my .mat files are quite large, which seems to cause a long delay for the previewer to populate. This for example, is what one of my previews should look like,
but it takes about a full minute before I see anything but this,
Why does it take so long for Matlab to inventory a .mat file on disk. Isn’t all this information kept in a header?I often wish to preview the contents of a .mat file in the Current Folder browser. Some of my .mat files are quite large, which seems to cause a long delay for the previewer to populate. This for example, is what one of my previews should look like,
but it takes about a full minute before I see anything but this,
Why does it take so long for Matlab to inventory a .mat file on disk. Isn’t all this information kept in a header? I often wish to preview the contents of a .mat file in the Current Folder browser. Some of my .mat files are quite large, which seems to cause a long delay for the previewer to populate. This for example, is what one of my previews should look like,
but it takes about a full minute before I see anything but this,
Why does it take so long for Matlab to inventory a .mat file on disk. Isn’t all this information kept in a header? mat file, preview MATLAB Answers — New Questions
Hello everyone, I have a non-Hermitian matrix, but I find that even using vpa, I cannot obtain the correct eigenvalues. Does anyone know how to resolve this?
Below are my code and .mat data. The green circles represent the correct eigenvalue range for the non-Hermitian matrix (derived using a complex mathematical method; since the method is too complicated, I’m directly using the results obtained from it). The black points represent the eigenvalues computed using the vpa function, but they do not coincide with the green circles. (Indeed, the number of green circles and black points is different, but if the black points were correct, their upper and lower bounds should overlap.) This means that I didn’t obtain the correct eigenvalues. I know that non-Hermitian matrices cannot be exactly diagonalized, but I’ve heard from others that using the high-precision vpa function can help, but it doesn’t seem to work in my case.
load list_beta0.mat
load GBZband.mat
N=90;
t1=0.5;
t2=0.5;
t3=1/5;
gamma1=5/3;
gamma2=1/3;
HH=Hobc(t1,t2,t3,gamma1,gamma2,N);
[~,val]=eig(vpa(HH,34));
tval=diag(val);
[~,index]=sort(real(tval));
sort_valR=tval(index);
figure
hold on
scatter(t1.*ones(size(GBZband)), abs(GBZband),10,’go’)
plot(t1.*ones(size(sort_valR)),abs(sort_valR),’k.’,’MarkerSize’,8)
ggg=legend(‘GBZ-eigenval’,’OBC-eigenval’);
set(ggg,’box’,’off’)
hold off
function [op]=Hobc(t1,t2,t3,gamma1,gamma2,N)
a=[1;0];
b=[0;1];
H=zeros(2*N,2*N);
n1=zeros(N,1);
n2=zeros(N,1);
for n=1:N
n1(n)=1;
n2(n+1)=1;
H=H+(t1+gamma1/2).*kron(n1,a)*kron(n1′,b’)+(t1-gamma1/2).*kron(n1,b)*kron(n1′,a’);
if n~=N
H=H+(t2+gamma2/2).*kron(n1,b)*kron(n2′,a’)+(t2-gamma2/2).*kron(n2,a)*kron(n1′,b’)+…
t3.*(kron(n1,a)*kron(n2′,b’)+kron(n2,b)*kron(n1′,a’));
end
n1=zeros(N,1);
n2=zeros(N,1);
end
op=H;
end
Does anyone have any insights on this issue? I look forward to any responses. If the question is unclear, please let me know.Below are my code and .mat data. The green circles represent the correct eigenvalue range for the non-Hermitian matrix (derived using a complex mathematical method; since the method is too complicated, I’m directly using the results obtained from it). The black points represent the eigenvalues computed using the vpa function, but they do not coincide with the green circles. (Indeed, the number of green circles and black points is different, but if the black points were correct, their upper and lower bounds should overlap.) This means that I didn’t obtain the correct eigenvalues. I know that non-Hermitian matrices cannot be exactly diagonalized, but I’ve heard from others that using the high-precision vpa function can help, but it doesn’t seem to work in my case.
load list_beta0.mat
load GBZband.mat
N=90;
t1=0.5;
t2=0.5;
t3=1/5;
gamma1=5/3;
gamma2=1/3;
HH=Hobc(t1,t2,t3,gamma1,gamma2,N);
[~,val]=eig(vpa(HH,34));
tval=diag(val);
[~,index]=sort(real(tval));
sort_valR=tval(index);
figure
hold on
scatter(t1.*ones(size(GBZband)), abs(GBZband),10,’go’)
plot(t1.*ones(size(sort_valR)),abs(sort_valR),’k.’,’MarkerSize’,8)
ggg=legend(‘GBZ-eigenval’,’OBC-eigenval’);
set(ggg,’box’,’off’)
hold off
function [op]=Hobc(t1,t2,t3,gamma1,gamma2,N)
a=[1;0];
b=[0;1];
H=zeros(2*N,2*N);
n1=zeros(N,1);
n2=zeros(N,1);
for n=1:N
n1(n)=1;
n2(n+1)=1;
H=H+(t1+gamma1/2).*kron(n1,a)*kron(n1′,b’)+(t1-gamma1/2).*kron(n1,b)*kron(n1′,a’);
if n~=N
H=H+(t2+gamma2/2).*kron(n1,b)*kron(n2′,a’)+(t2-gamma2/2).*kron(n2,a)*kron(n1′,b’)+…
t3.*(kron(n1,a)*kron(n2′,b’)+kron(n2,b)*kron(n1′,a’));
end
n1=zeros(N,1);
n2=zeros(N,1);
end
op=H;
end
Does anyone have any insights on this issue? I look forward to any responses. If the question is unclear, please let me know. Below are my code and .mat data. The green circles represent the correct eigenvalue range for the non-Hermitian matrix (derived using a complex mathematical method; since the method is too complicated, I’m directly using the results obtained from it). The black points represent the eigenvalues computed using the vpa function, but they do not coincide with the green circles. (Indeed, the number of green circles and black points is different, but if the black points were correct, their upper and lower bounds should overlap.) This means that I didn’t obtain the correct eigenvalues. I know that non-Hermitian matrices cannot be exactly diagonalized, but I’ve heard from others that using the high-precision vpa function can help, but it doesn’t seem to work in my case.
load list_beta0.mat
load GBZband.mat
N=90;
t1=0.5;
t2=0.5;
t3=1/5;
gamma1=5/3;
gamma2=1/3;
HH=Hobc(t1,t2,t3,gamma1,gamma2,N);
[~,val]=eig(vpa(HH,34));
tval=diag(val);
[~,index]=sort(real(tval));
sort_valR=tval(index);
figure
hold on
scatter(t1.*ones(size(GBZband)), abs(GBZband),10,’go’)
plot(t1.*ones(size(sort_valR)),abs(sort_valR),’k.’,’MarkerSize’,8)
ggg=legend(‘GBZ-eigenval’,’OBC-eigenval’);
set(ggg,’box’,’off’)
hold off
function [op]=Hobc(t1,t2,t3,gamma1,gamma2,N)
a=[1;0];
b=[0;1];
H=zeros(2*N,2*N);
n1=zeros(N,1);
n2=zeros(N,1);
for n=1:N
n1(n)=1;
n2(n+1)=1;
H=H+(t1+gamma1/2).*kron(n1,a)*kron(n1′,b’)+(t1-gamma1/2).*kron(n1,b)*kron(n1′,a’);
if n~=N
H=H+(t2+gamma2/2).*kron(n1,b)*kron(n2′,a’)+(t2-gamma2/2).*kron(n2,a)*kron(n1′,b’)+…
t3.*(kron(n1,a)*kron(n2′,b’)+kron(n2,b)*kron(n1′,a’));
end
n1=zeros(N,1);
n2=zeros(N,1);
end
op=H;
end
Does anyone have any insights on this issue? I look forward to any responses. If the question is unclear, please let me know. non-hermitian matrix, high-precision computation, eigenvalues MATLAB Answers — New Questions
MATLAB R2024b GPU validation device fail for Multi-Instance GPU (MIG) A100
We are currently installing MATLAB R2024b on our HPC cluster. The intillation works beautifully across all of our GPUs except an A100 that utilizes NVIDIA’s Multi-Instance GPU (MIG). When I launch a CLI session using
matlab -nodesktop -nodisplay -nosoftwareopengl
and run "validateGPU", I receive the following error: "Encountered error when calling NVML. The NVML error was: Invalid Argument."
The same sequence does not produce an error when ran on one of our other A100 GPUs with the same Driver and CUDA version. In our MATLAB version R2023b we do not receive this error with our MIG GPU and it is able to run GPU code successfully.
For robustness, here is the full output:
nvidia-smi
+—————————————————————————————–+
| NVIDIA-SMI 550.90.12 Driver Version: 550.90.12 CUDA Version: 12.4 |
|—————————————–+————————+———————-+
| GPU Name Persistence-M | Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap | Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|=========================================+========================+======================|
| 0 NVIDIA A100-PCIE-40GB On | 00000000:21:00.0 Off | On |
| N/A 29C P0 32W / 250W | 75MiB / 40960MiB | N/A Default |
| | | Enabled |
+—————————————–+————————+———————-+
| 1 NVIDIA A100-PCIE-40GB On | 00000000:81:00.0 Off | On |
| N/A 28C P0 33W / 250W | 75MiB / 40960MiB | N/A Default |
| | | Enabled |
+—————————————–+————————+———————-+
| 2 NVIDIA A100-PCIE-40GB On | 00000000:E2:00.0 Off | On |
| N/A 28C P0 34W / 250W | 75MiB / 40960MiB | N/A Default |
| | | Enabled |
+—————————————–+————————+———————-+
+—————————————————————————————–+
| MIG devices: |
+——————+———————————-+———–+———————–+
| GPU GI CI MIG | Memory-Usage | Vol| Shared |
| ID ID Dev | BAR1-Usage | SM Unc| CE ENC DEC OFA JPG |
| | | ECC| |
|==================+==================================+===========+=======================|
| 0 2 0 0 | 38MiB / 19968MiB | 42 0 | 3 0 2 0 0 |
| | 0MiB / 32767MiB | | |
+——————+———————————-+———–+———————–+
+—————————————————————————————–+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=========================================================================================|
| No running processes found |
+—————————————————————————————–+
Launching a session and attempting to validate the GPU:
matlab -nodesktop -nodisplay -nosoftwareopengl
< M A T L A B (R) >
Copyright 1984-2024 The MathWorks, Inc.
R2024b Update 2 (24.2.0.2773142) 64-bit (glnxa64)
October 22, 2024
To get started, type doc.
For product information, visit www.mathworks.com.
Warning: OpenGL Startup options will be removed in a future release.
>> validateGPU
# Beginning GPU validation
# Performing system validation
# CUDA-supported platform ………………………………………….PASSED
# CUDA-enabled graphics driver exists ……………………………….PASSED
# Version: 550.90.12
# CUDA-enabled graphics driver load …………………………………PASSED
# CUDA environment variables ……………………………………….PASSED
# CUDA_VISIBLE_DEVICES: "0"
# CUDA device count ……………………………………………….PASSED
# Found 1 devices.
# GPU libraries load ………………………………………………PASSED
#
# Performing device validation for device index 1
# Device exists …………………………………………………..FAILED
# Encountered error when calling NVML. The NVML error was:
# Invalid Argument.
#
# Device supported ………………………………………………..SKIPPED
# Device available ………………………………………………..SKIPPED
# Device selectable ……………………………………………….SKIPPED
# Device memory allocation …………………………………………SKIPPED
# Device kernel launch …………………………………………….SKIPPED
# Finished GPU validation with 1 failures.
Output using "coder.checkGpuInstall":
>> gpuEnvObj = coder.gpuEnvConfig;
>> gpuEnvObj.GpuId = 0;
>> gpuEnvObj.BasicCodegen = 1;
>> gpuEnvObj.BasicCodeexec = 1;
>> results = coder.checkGpuInstall(gpuEnvObj)
Compatible GPU : FAILED (There is a problem with the graphics driver or with this GPU device. Code execution will not be available. Check that you have a supported GPU and the latest graphics driver.)
CUDA Environment : FAILED (Unable to execute the nvcc command. Check your CUDA Toolkit installation.)
Runtime : PASSED
cuFFT : PASSED
cuSOLVER : PASSED
cuBLAS : PASSED
Host Compiler : PASSED
results =
struct with fields:
gpu: 0
cuda: 0
cudnn: 0
tensorrt: 0
hostcompiler: 1
basiccodegen: 0
basiccodeexec: 0
deepcodegen: 0
tensorrtdatatype: 0
deepcodeexec: 0We are currently installing MATLAB R2024b on our HPC cluster. The intillation works beautifully across all of our GPUs except an A100 that utilizes NVIDIA’s Multi-Instance GPU (MIG). When I launch a CLI session using
matlab -nodesktop -nodisplay -nosoftwareopengl
and run "validateGPU", I receive the following error: "Encountered error when calling NVML. The NVML error was: Invalid Argument."
The same sequence does not produce an error when ran on one of our other A100 GPUs with the same Driver and CUDA version. In our MATLAB version R2023b we do not receive this error with our MIG GPU and it is able to run GPU code successfully.
For robustness, here is the full output:
nvidia-smi
+—————————————————————————————–+
| NVIDIA-SMI 550.90.12 Driver Version: 550.90.12 CUDA Version: 12.4 |
|—————————————–+————————+———————-+
| GPU Name Persistence-M | Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap | Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|=========================================+========================+======================|
| 0 NVIDIA A100-PCIE-40GB On | 00000000:21:00.0 Off | On |
| N/A 29C P0 32W / 250W | 75MiB / 40960MiB | N/A Default |
| | | Enabled |
+—————————————–+————————+———————-+
| 1 NVIDIA A100-PCIE-40GB On | 00000000:81:00.0 Off | On |
| N/A 28C P0 33W / 250W | 75MiB / 40960MiB | N/A Default |
| | | Enabled |
+—————————————–+————————+———————-+
| 2 NVIDIA A100-PCIE-40GB On | 00000000:E2:00.0 Off | On |
| N/A 28C P0 34W / 250W | 75MiB / 40960MiB | N/A Default |
| | | Enabled |
+—————————————–+————————+———————-+
+—————————————————————————————–+
| MIG devices: |
+——————+———————————-+———–+———————–+
| GPU GI CI MIG | Memory-Usage | Vol| Shared |
| ID ID Dev | BAR1-Usage | SM Unc| CE ENC DEC OFA JPG |
| | | ECC| |
|==================+==================================+===========+=======================|
| 0 2 0 0 | 38MiB / 19968MiB | 42 0 | 3 0 2 0 0 |
| | 0MiB / 32767MiB | | |
+——————+———————————-+———–+———————–+
+—————————————————————————————–+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=========================================================================================|
| No running processes found |
+—————————————————————————————–+
Launching a session and attempting to validate the GPU:
matlab -nodesktop -nodisplay -nosoftwareopengl
< M A T L A B (R) >
Copyright 1984-2024 The MathWorks, Inc.
R2024b Update 2 (24.2.0.2773142) 64-bit (glnxa64)
October 22, 2024
To get started, type doc.
For product information, visit www.mathworks.com.
Warning: OpenGL Startup options will be removed in a future release.
>> validateGPU
# Beginning GPU validation
# Performing system validation
# CUDA-supported platform ………………………………………….PASSED
# CUDA-enabled graphics driver exists ……………………………….PASSED
# Version: 550.90.12
# CUDA-enabled graphics driver load …………………………………PASSED
# CUDA environment variables ……………………………………….PASSED
# CUDA_VISIBLE_DEVICES: "0"
# CUDA device count ……………………………………………….PASSED
# Found 1 devices.
# GPU libraries load ………………………………………………PASSED
#
# Performing device validation for device index 1
# Device exists …………………………………………………..FAILED
# Encountered error when calling NVML. The NVML error was:
# Invalid Argument.
#
# Device supported ………………………………………………..SKIPPED
# Device available ………………………………………………..SKIPPED
# Device selectable ……………………………………………….SKIPPED
# Device memory allocation …………………………………………SKIPPED
# Device kernel launch …………………………………………….SKIPPED
# Finished GPU validation with 1 failures.
Output using "coder.checkGpuInstall":
>> gpuEnvObj = coder.gpuEnvConfig;
>> gpuEnvObj.GpuId = 0;
>> gpuEnvObj.BasicCodegen = 1;
>> gpuEnvObj.BasicCodeexec = 1;
>> results = coder.checkGpuInstall(gpuEnvObj)
Compatible GPU : FAILED (There is a problem with the graphics driver or with this GPU device. Code execution will not be available. Check that you have a supported GPU and the latest graphics driver.)
CUDA Environment : FAILED (Unable to execute the nvcc command. Check your CUDA Toolkit installation.)
Runtime : PASSED
cuFFT : PASSED
cuSOLVER : PASSED
cuBLAS : PASSED
Host Compiler : PASSED
results =
struct with fields:
gpu: 0
cuda: 0
cudnn: 0
tensorrt: 0
hostcompiler: 1
basiccodegen: 0
basiccodeexec: 0
deepcodegen: 0
tensorrtdatatype: 0
deepcodeexec: 0 We are currently installing MATLAB R2024b on our HPC cluster. The intillation works beautifully across all of our GPUs except an A100 that utilizes NVIDIA’s Multi-Instance GPU (MIG). When I launch a CLI session using
matlab -nodesktop -nodisplay -nosoftwareopengl
and run "validateGPU", I receive the following error: "Encountered error when calling NVML. The NVML error was: Invalid Argument."
The same sequence does not produce an error when ran on one of our other A100 GPUs with the same Driver and CUDA version. In our MATLAB version R2023b we do not receive this error with our MIG GPU and it is able to run GPU code successfully.
For robustness, here is the full output:
nvidia-smi
+—————————————————————————————–+
| NVIDIA-SMI 550.90.12 Driver Version: 550.90.12 CUDA Version: 12.4 |
|—————————————–+————————+———————-+
| GPU Name Persistence-M | Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap | Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|=========================================+========================+======================|
| 0 NVIDIA A100-PCIE-40GB On | 00000000:21:00.0 Off | On |
| N/A 29C P0 32W / 250W | 75MiB / 40960MiB | N/A Default |
| | | Enabled |
+—————————————–+————————+———————-+
| 1 NVIDIA A100-PCIE-40GB On | 00000000:81:00.0 Off | On |
| N/A 28C P0 33W / 250W | 75MiB / 40960MiB | N/A Default |
| | | Enabled |
+—————————————–+————————+———————-+
| 2 NVIDIA A100-PCIE-40GB On | 00000000:E2:00.0 Off | On |
| N/A 28C P0 34W / 250W | 75MiB / 40960MiB | N/A Default |
| | | Enabled |
+—————————————–+————————+———————-+
+—————————————————————————————–+
| MIG devices: |
+——————+———————————-+———–+———————–+
| GPU GI CI MIG | Memory-Usage | Vol| Shared |
| ID ID Dev | BAR1-Usage | SM Unc| CE ENC DEC OFA JPG |
| | | ECC| |
|==================+==================================+===========+=======================|
| 0 2 0 0 | 38MiB / 19968MiB | 42 0 | 3 0 2 0 0 |
| | 0MiB / 32767MiB | | |
+——————+———————————-+———–+———————–+
+—————————————————————————————–+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=========================================================================================|
| No running processes found |
+—————————————————————————————–+
Launching a session and attempting to validate the GPU:
matlab -nodesktop -nodisplay -nosoftwareopengl
< M A T L A B (R) >
Copyright 1984-2024 The MathWorks, Inc.
R2024b Update 2 (24.2.0.2773142) 64-bit (glnxa64)
October 22, 2024
To get started, type doc.
For product information, visit www.mathworks.com.
Warning: OpenGL Startup options will be removed in a future release.
>> validateGPU
# Beginning GPU validation
# Performing system validation
# CUDA-supported platform ………………………………………….PASSED
# CUDA-enabled graphics driver exists ……………………………….PASSED
# Version: 550.90.12
# CUDA-enabled graphics driver load …………………………………PASSED
# CUDA environment variables ……………………………………….PASSED
# CUDA_VISIBLE_DEVICES: "0"
# CUDA device count ……………………………………………….PASSED
# Found 1 devices.
# GPU libraries load ………………………………………………PASSED
#
# Performing device validation for device index 1
# Device exists …………………………………………………..FAILED
# Encountered error when calling NVML. The NVML error was:
# Invalid Argument.
#
# Device supported ………………………………………………..SKIPPED
# Device available ………………………………………………..SKIPPED
# Device selectable ……………………………………………….SKIPPED
# Device memory allocation …………………………………………SKIPPED
# Device kernel launch …………………………………………….SKIPPED
# Finished GPU validation with 1 failures.
Output using "coder.checkGpuInstall":
>> gpuEnvObj = coder.gpuEnvConfig;
>> gpuEnvObj.GpuId = 0;
>> gpuEnvObj.BasicCodegen = 1;
>> gpuEnvObj.BasicCodeexec = 1;
>> results = coder.checkGpuInstall(gpuEnvObj)
Compatible GPU : FAILED (There is a problem with the graphics driver or with this GPU device. Code execution will not be available. Check that you have a supported GPU and the latest graphics driver.)
CUDA Environment : FAILED (Unable to execute the nvcc command. Check your CUDA Toolkit installation.)
Runtime : PASSED
cuFFT : PASSED
cuSOLVER : PASSED
cuBLAS : PASSED
Host Compiler : PASSED
results =
struct with fields:
gpu: 0
cuda: 0
cudnn: 0
tensorrt: 0
hostcompiler: 1
basiccodegen: 0
basiccodeexec: 0
deepcodegen: 0
tensorrtdatatype: 0
deepcodeexec: 0 gpu, matlab, mig, nvml error MATLAB Answers — New Questions
Problem in assigning proper eigevalues in a for-loop
Dear all, I encounter a problem in assigning and plotting the eigenvalues, the final graphs shown 3 separate cosine bands but the locations get some serious problems, causing many discontinuities. I have no idea how to fix it, but I think the problem goes to the fact that matlab does not know how to allocate the eigenvalues correctly for each k in the loop. Here is my code:
theta1= 0.4;
theta2= 0.2;
theta3= 0.4;
theta4= 0.5;
theta5= 0.4;
theta6= 0.3;
theta7= 0.8;
theta8= 0.5;
GellMann1 = [0 1 0; 1 0 0; 0 0 0];
GellMann2 = [0 -1i 0; 1i 0 0; 0 0 0];
GellMann3 = [1 0 0; 0 -1 0; 0 0 0];
GellMann4 = [0 0 1; 0 0 0; 1 0 0];
GellMann5 = [0 0 -1i; 0 0 0; 1i 0 0];
GellMann6 = [0 0 0; 0 0 1; 0 1 0];
GellMann7 = [0 0 0; 0 0 -1i; 0 1i 0];
GellMann8 = [1/sqrt(3) 0 0; 0 1/sqrt(3) 0; 0 0 -2/sqrt(3) ];
normtheta= sqrt(theta1^2 + theta2^2 + theta3^2 + theta4^2 + theta5^2 + theta6^2 + theta6^2 + theta8^2);
PhaseMatrix = theta1*GellMann1 + theta2*GellMann2 + theta3*GellMann3 + theta4*GellMann4 + theta5*GellMann5 + theta6*GellMann6+ theta7*GellMann7 + theta8*GellMann8 ;
J=0.8;
omega_1 = 0.08;
omega_2 = 0.1;
counter_Eigenvalues1_vector =1;
counter_Eigenvalues2_vector =1;
counter_Eigenvalues3_vector =1;
for k = -2*pi : 4*pi/500 : 2*pi
fprintf(‘The corresponding k is %d n’, k);
Hamiltonian= J*(expm(1i*(k*eye(3) – PhaseMatrix)) + expm(-1i*(k*eye(3) – PhaseMatrix)));
eig_Correct = eig(Hamiltonian);
e1correct = eig_Correct(1);
e2correct = eig_Correct(2);
e3correct = eig_Correct(3);
%%%Save the three eigenvalues into an array%%%%
Eigenvalues1_vector(1, counter_Eigenvalues1_vector) = (e1correct);
counter_Eigenvalues1_vector = counter_Eigenvalues1_vector +1;
Eigenvalues2_vector(1, counter_Eigenvalues2_vector) = (e2correct);
counter_Eigenvalues2_vector = counter_Eigenvalues2_vector +1;
Eigenvalues3_vector(1, counter_Eigenvalues3_vector) = (e3correct);
counter_Eigenvalues3_vector = counter_Eigenvalues3_vector +1;
end
%%%Plotting
figure(1)
k = -2*pi : 4*pi/500 : 2*pi
plot(k, Eigenvalues1_vector,k, Eigenvalues2_vector,k,Eigenvalues3_vector)
axis([-2*pi 2*pi -3 3])
xlabel(‘k’)
ylabel(‘E_k’)Dear all, I encounter a problem in assigning and plotting the eigenvalues, the final graphs shown 3 separate cosine bands but the locations get some serious problems, causing many discontinuities. I have no idea how to fix it, but I think the problem goes to the fact that matlab does not know how to allocate the eigenvalues correctly for each k in the loop. Here is my code:
theta1= 0.4;
theta2= 0.2;
theta3= 0.4;
theta4= 0.5;
theta5= 0.4;
theta6= 0.3;
theta7= 0.8;
theta8= 0.5;
GellMann1 = [0 1 0; 1 0 0; 0 0 0];
GellMann2 = [0 -1i 0; 1i 0 0; 0 0 0];
GellMann3 = [1 0 0; 0 -1 0; 0 0 0];
GellMann4 = [0 0 1; 0 0 0; 1 0 0];
GellMann5 = [0 0 -1i; 0 0 0; 1i 0 0];
GellMann6 = [0 0 0; 0 0 1; 0 1 0];
GellMann7 = [0 0 0; 0 0 -1i; 0 1i 0];
GellMann8 = [1/sqrt(3) 0 0; 0 1/sqrt(3) 0; 0 0 -2/sqrt(3) ];
normtheta= sqrt(theta1^2 + theta2^2 + theta3^2 + theta4^2 + theta5^2 + theta6^2 + theta6^2 + theta8^2);
PhaseMatrix = theta1*GellMann1 + theta2*GellMann2 + theta3*GellMann3 + theta4*GellMann4 + theta5*GellMann5 + theta6*GellMann6+ theta7*GellMann7 + theta8*GellMann8 ;
J=0.8;
omega_1 = 0.08;
omega_2 = 0.1;
counter_Eigenvalues1_vector =1;
counter_Eigenvalues2_vector =1;
counter_Eigenvalues3_vector =1;
for k = -2*pi : 4*pi/500 : 2*pi
fprintf(‘The corresponding k is %d n’, k);
Hamiltonian= J*(expm(1i*(k*eye(3) – PhaseMatrix)) + expm(-1i*(k*eye(3) – PhaseMatrix)));
eig_Correct = eig(Hamiltonian);
e1correct = eig_Correct(1);
e2correct = eig_Correct(2);
e3correct = eig_Correct(3);
%%%Save the three eigenvalues into an array%%%%
Eigenvalues1_vector(1, counter_Eigenvalues1_vector) = (e1correct);
counter_Eigenvalues1_vector = counter_Eigenvalues1_vector +1;
Eigenvalues2_vector(1, counter_Eigenvalues2_vector) = (e2correct);
counter_Eigenvalues2_vector = counter_Eigenvalues2_vector +1;
Eigenvalues3_vector(1, counter_Eigenvalues3_vector) = (e3correct);
counter_Eigenvalues3_vector = counter_Eigenvalues3_vector +1;
end
%%%Plotting
figure(1)
k = -2*pi : 4*pi/500 : 2*pi
plot(k, Eigenvalues1_vector,k, Eigenvalues2_vector,k,Eigenvalues3_vector)
axis([-2*pi 2*pi -3 3])
xlabel(‘k’)
ylabel(‘E_k’) Dear all, I encounter a problem in assigning and plotting the eigenvalues, the final graphs shown 3 separate cosine bands but the locations get some serious problems, causing many discontinuities. I have no idea how to fix it, but I think the problem goes to the fact that matlab does not know how to allocate the eigenvalues correctly for each k in the loop. Here is my code:
theta1= 0.4;
theta2= 0.2;
theta3= 0.4;
theta4= 0.5;
theta5= 0.4;
theta6= 0.3;
theta7= 0.8;
theta8= 0.5;
GellMann1 = [0 1 0; 1 0 0; 0 0 0];
GellMann2 = [0 -1i 0; 1i 0 0; 0 0 0];
GellMann3 = [1 0 0; 0 -1 0; 0 0 0];
GellMann4 = [0 0 1; 0 0 0; 1 0 0];
GellMann5 = [0 0 -1i; 0 0 0; 1i 0 0];
GellMann6 = [0 0 0; 0 0 1; 0 1 0];
GellMann7 = [0 0 0; 0 0 -1i; 0 1i 0];
GellMann8 = [1/sqrt(3) 0 0; 0 1/sqrt(3) 0; 0 0 -2/sqrt(3) ];
normtheta= sqrt(theta1^2 + theta2^2 + theta3^2 + theta4^2 + theta5^2 + theta6^2 + theta6^2 + theta8^2);
PhaseMatrix = theta1*GellMann1 + theta2*GellMann2 + theta3*GellMann3 + theta4*GellMann4 + theta5*GellMann5 + theta6*GellMann6+ theta7*GellMann7 + theta8*GellMann8 ;
J=0.8;
omega_1 = 0.08;
omega_2 = 0.1;
counter_Eigenvalues1_vector =1;
counter_Eigenvalues2_vector =1;
counter_Eigenvalues3_vector =1;
for k = -2*pi : 4*pi/500 : 2*pi
fprintf(‘The corresponding k is %d n’, k);
Hamiltonian= J*(expm(1i*(k*eye(3) – PhaseMatrix)) + expm(-1i*(k*eye(3) – PhaseMatrix)));
eig_Correct = eig(Hamiltonian);
e1correct = eig_Correct(1);
e2correct = eig_Correct(2);
e3correct = eig_Correct(3);
%%%Save the three eigenvalues into an array%%%%
Eigenvalues1_vector(1, counter_Eigenvalues1_vector) = (e1correct);
counter_Eigenvalues1_vector = counter_Eigenvalues1_vector +1;
Eigenvalues2_vector(1, counter_Eigenvalues2_vector) = (e2correct);
counter_Eigenvalues2_vector = counter_Eigenvalues2_vector +1;
Eigenvalues3_vector(1, counter_Eigenvalues3_vector) = (e3correct);
counter_Eigenvalues3_vector = counter_Eigenvalues3_vector +1;
end
%%%Plotting
figure(1)
k = -2*pi : 4*pi/500 : 2*pi
plot(k, Eigenvalues1_vector,k, Eigenvalues2_vector,k,Eigenvalues3_vector)
axis([-2*pi 2*pi -3 3])
xlabel(‘k’)
ylabel(‘E_k’) eigenvalues, sorting, plotting MATLAB Answers — New Questions
Loading user-defined classes from .mat files absent the classdef
At one time, if I had a .mat file with a user-defined class variable, but lacked the classdef file, loading the .mat file would succeed, but convert the class property data to struct form. Now, in more recent Matlab, it fails to do that. Is there a supported way to load a user-defined object in a stripped down form, like a struct, when the class definition is absent?At one time, if I had a .mat file with a user-defined class variable, but lacked the classdef file, loading the .mat file would succeed, but convert the class property data to struct form. Now, in more recent Matlab, it fails to do that. Is there a supported way to load a user-defined object in a stripped down form, like a struct, when the class definition is absent? At one time, if I had a .mat file with a user-defined class variable, but lacked the classdef file, loading the .mat file would succeed, but convert the class property data to struct form. Now, in more recent Matlab, it fails to do that. Is there a supported way to load a user-defined object in a stripped down form, like a struct, when the class definition is absent? oop, mat file, load, struct MATLAB Answers — New Questions
Definite Point by Point Integral
I have a data set of accelerlation data points over 10ms, sampled at 1MHz. I am trying to take this acceleration data and convert it to displacement data. I have a referenced graph that is attached that I am trying to get my data to match, but it seems like they did not do a cumtrapz, and only did a point by point integral.
When I tried to use Cumtrapz it seems like, A09 it does not have the return back to -5mm after a 2nd order cumtrapz. I have tried doing a point by point integration (A9(1:end-1)+A9(2:end)) * (dt/2); and this did not bring create the same graph.
I am looking for some insight on what the right function it should be/ the reason after doing a "double integral" these two graphs do not match.
Thank you for the insight.I have a data set of accelerlation data points over 10ms, sampled at 1MHz. I am trying to take this acceleration data and convert it to displacement data. I have a referenced graph that is attached that I am trying to get my data to match, but it seems like they did not do a cumtrapz, and only did a point by point integral.
When I tried to use Cumtrapz it seems like, A09 it does not have the return back to -5mm after a 2nd order cumtrapz. I have tried doing a point by point integration (A9(1:end-1)+A9(2:end)) * (dt/2); and this did not bring create the same graph.
I am looking for some insight on what the right function it should be/ the reason after doing a "double integral" these two graphs do not match.
Thank you for the insight. I have a data set of accelerlation data points over 10ms, sampled at 1MHz. I am trying to take this acceleration data and convert it to displacement data. I have a referenced graph that is attached that I am trying to get my data to match, but it seems like they did not do a cumtrapz, and only did a point by point integral.
When I tried to use Cumtrapz it seems like, A09 it does not have the return back to -5mm after a 2nd order cumtrapz. I have tried doing a point by point integration (A9(1:end-1)+A9(2:end)) * (dt/2); and this did not bring create the same graph.
I am looking for some insight on what the right function it should be/ the reason after doing a "double integral" these two graphs do not match.
Thank you for the insight. signal processing MATLAB Answers — New Questions
Non Linear Eigenvalue problem
I have been trying to solve a *Non linear Eigenvalue problem* using *fsolve and Newton’s iteration method* and have not been successful.
The matrix which I am looking to solve:
A=[2*w -300 0 0;sin(w/2) cos(w/2) -sin(w/2) cos(w/2); 2*cos(w/2) -2*sin(w/2) -cos(w/2) sin(w/2); 0 0 cos(w) -sin(w)]; (Found in a paper, using it as a practice case)
*My Newton method code:*
%Define intial values and tolerances for the variable
w0=0.1;
tol=2;
maxiter=1000;
w=w0;
wold=w0;
lambda=0.1;
%Start Iteration
for i=1:maxiter
%Define A and B
A=[2*w -300 0 0;sin(w/2) cos(w/2) -sin(w/2) cos(w/2); 2*cos(w/2) -2*sin(w/2) -cos(w/2) sin(w/2);
0 0 cos(w) -sin(w)];
B=[-2 0 0 0;-0.5*cos(w/2) 0.5*sin(w/2) 0.5*cos(w/2) -0.5*sin(w/2); sin(w/2) cos(w/2) -0.5*sin(w/2) -0.5*cos(w/2);
0 0 sin(w) cos(w)];
C=inv(B);
%Find Eigen value for the intermediate step
beta=eig(C*A);
epsilon=min(abs(beta));
%Update the variable
w=w0+epsilon;
err=abs(epsilon);
wold=w;
if(err<tol)
break;
end
end
*Fsolve code*
function fval=fun4evp(w)
A=[2*w -300 0 0;sin(w/2) cos(w/2) -sin(w/2) cos(w/2); 2*cos(w/2) -2*sin(w/2) -cos(w/2) sin(w/2);
0 0 cos(w) -sin(w)];
fval=det(A);
end
wsol=fsolve(@(w)fun4evp,0.1);
ThanksI have been trying to solve a *Non linear Eigenvalue problem* using *fsolve and Newton’s iteration method* and have not been successful.
The matrix which I am looking to solve:
A=[2*w -300 0 0;sin(w/2) cos(w/2) -sin(w/2) cos(w/2); 2*cos(w/2) -2*sin(w/2) -cos(w/2) sin(w/2); 0 0 cos(w) -sin(w)]; (Found in a paper, using it as a practice case)
*My Newton method code:*
%Define intial values and tolerances for the variable
w0=0.1;
tol=2;
maxiter=1000;
w=w0;
wold=w0;
lambda=0.1;
%Start Iteration
for i=1:maxiter
%Define A and B
A=[2*w -300 0 0;sin(w/2) cos(w/2) -sin(w/2) cos(w/2); 2*cos(w/2) -2*sin(w/2) -cos(w/2) sin(w/2);
0 0 cos(w) -sin(w)];
B=[-2 0 0 0;-0.5*cos(w/2) 0.5*sin(w/2) 0.5*cos(w/2) -0.5*sin(w/2); sin(w/2) cos(w/2) -0.5*sin(w/2) -0.5*cos(w/2);
0 0 sin(w) cos(w)];
C=inv(B);
%Find Eigen value for the intermediate step
beta=eig(C*A);
epsilon=min(abs(beta));
%Update the variable
w=w0+epsilon;
err=abs(epsilon);
wold=w;
if(err<tol)
break;
end
end
*Fsolve code*
function fval=fun4evp(w)
A=[2*w -300 0 0;sin(w/2) cos(w/2) -sin(w/2) cos(w/2); 2*cos(w/2) -2*sin(w/2) -cos(w/2) sin(w/2);
0 0 cos(w) -sin(w)];
fval=det(A);
end
wsol=fsolve(@(w)fun4evp,0.1);
Thanks I have been trying to solve a *Non linear Eigenvalue problem* using *fsolve and Newton’s iteration method* and have not been successful.
The matrix which I am looking to solve:
A=[2*w -300 0 0;sin(w/2) cos(w/2) -sin(w/2) cos(w/2); 2*cos(w/2) -2*sin(w/2) -cos(w/2) sin(w/2); 0 0 cos(w) -sin(w)]; (Found in a paper, using it as a practice case)
*My Newton method code:*
%Define intial values and tolerances for the variable
w0=0.1;
tol=2;
maxiter=1000;
w=w0;
wold=w0;
lambda=0.1;
%Start Iteration
for i=1:maxiter
%Define A and B
A=[2*w -300 0 0;sin(w/2) cos(w/2) -sin(w/2) cos(w/2); 2*cos(w/2) -2*sin(w/2) -cos(w/2) sin(w/2);
0 0 cos(w) -sin(w)];
B=[-2 0 0 0;-0.5*cos(w/2) 0.5*sin(w/2) 0.5*cos(w/2) -0.5*sin(w/2); sin(w/2) cos(w/2) -0.5*sin(w/2) -0.5*cos(w/2);
0 0 sin(w) cos(w)];
C=inv(B);
%Find Eigen value for the intermediate step
beta=eig(C*A);
epsilon=min(abs(beta));
%Update the variable
w=w0+epsilon;
err=abs(epsilon);
wold=w;
if(err<tol)
break;
end
end
*Fsolve code*
function fval=fun4evp(w)
A=[2*w -300 0 0;sin(w/2) cos(w/2) -sin(w/2) cos(w/2); 2*cos(w/2) -2*sin(w/2) -cos(w/2) sin(w/2);
0 0 cos(w) -sin(w)];
fval=det(A);
end
wsol=fsolve(@(w)fun4evp,0.1);
Thanks fsolve, eigenvalue, nonlinear, nonlinear eigenvalue problem MATLAB Answers — New Questions
Numerical search for the singular points of a complex matrix
Hello, I have a function that takes in a complex number and generates a square matrix of complex numbers. What I am trying to do is to locate the values of s such that , ie that the matrix Z is singular.
To do this, the method I implemented a grid of s values and computed the condition number at each point. From what I gathered from the answers on this site, using MATLAB’s det function outright was not the way to go. While visually this gives the answer I am looking for, it is extremely time intensive and the accuracy of the answer is dependent on the refinement of that grid.
In a research paper I have read (admittedly quite dated ~1972), the method they claim to use is a Newton-Rahpson method to locate the singular points.
They use the Taylor expansion to find the singular point
In this case, I can get as arbitrarily close to as I would like to, and it is easy for me to procure initial guesses that work. However, the implementation of this requires not only the determinant but the derivative of the determinant as well. On top of this, the output must be a complex number, as the final answer must also be a complex number. I’m not sure how they implemented this (and in 1972 no less) such that near the singular point their computation didn’t go crazy, but their answers are certainly correct.
Therefore my question is, is there a good way to apply MATLAB’s det function here to get what I need? Or is there another way for me to do this search for the singular points that doesn’t involve a full sweep of the search space? And less importantly but still curious, how the heck might they have done this in 1972?
Thanks in advance
My code is too long to post but the current setup with the grid formation is basically (this is dummy code, not real, just to give an idea)
num_x = 100;
num_y = 51;
omega = linspace(0, 1, num_x));
sigmas = linspace(0, 2, num_y);
for i=1:num_x
for j=1:num_y
s = sigmas(j) + 1i.*omegas(i);
Z = % some involved square matrix computation here
conds(ii,jj) = cond(Z);
end
endHello, I have a function that takes in a complex number and generates a square matrix of complex numbers. What I am trying to do is to locate the values of s such that , ie that the matrix Z is singular.
To do this, the method I implemented a grid of s values and computed the condition number at each point. From what I gathered from the answers on this site, using MATLAB’s det function outright was not the way to go. While visually this gives the answer I am looking for, it is extremely time intensive and the accuracy of the answer is dependent on the refinement of that grid.
In a research paper I have read (admittedly quite dated ~1972), the method they claim to use is a Newton-Rahpson method to locate the singular points.
They use the Taylor expansion to find the singular point
In this case, I can get as arbitrarily close to as I would like to, and it is easy for me to procure initial guesses that work. However, the implementation of this requires not only the determinant but the derivative of the determinant as well. On top of this, the output must be a complex number, as the final answer must also be a complex number. I’m not sure how they implemented this (and in 1972 no less) such that near the singular point their computation didn’t go crazy, but their answers are certainly correct.
Therefore my question is, is there a good way to apply MATLAB’s det function here to get what I need? Or is there another way for me to do this search for the singular points that doesn’t involve a full sweep of the search space? And less importantly but still curious, how the heck might they have done this in 1972?
Thanks in advance
My code is too long to post but the current setup with the grid formation is basically (this is dummy code, not real, just to give an idea)
num_x = 100;
num_y = 51;
omega = linspace(0, 1, num_x));
sigmas = linspace(0, 2, num_y);
for i=1:num_x
for j=1:num_y
s = sigmas(j) + 1i.*omegas(i);
Z = % some involved square matrix computation here
conds(ii,jj) = cond(Z);
end
end Hello, I have a function that takes in a complex number and generates a square matrix of complex numbers. What I am trying to do is to locate the values of s such that , ie that the matrix Z is singular.
To do this, the method I implemented a grid of s values and computed the condition number at each point. From what I gathered from the answers on this site, using MATLAB’s det function outright was not the way to go. While visually this gives the answer I am looking for, it is extremely time intensive and the accuracy of the answer is dependent on the refinement of that grid.
In a research paper I have read (admittedly quite dated ~1972), the method they claim to use is a Newton-Rahpson method to locate the singular points.
They use the Taylor expansion to find the singular point
In this case, I can get as arbitrarily close to as I would like to, and it is easy for me to procure initial guesses that work. However, the implementation of this requires not only the determinant but the derivative of the determinant as well. On top of this, the output must be a complex number, as the final answer must also be a complex number. I’m not sure how they implemented this (and in 1972 no less) such that near the singular point their computation didn’t go crazy, but their answers are certainly correct.
Therefore my question is, is there a good way to apply MATLAB’s det function here to get what I need? Or is there another way for me to do this search for the singular points that doesn’t involve a full sweep of the search space? And less importantly but still curious, how the heck might they have done this in 1972?
Thanks in advance
My code is too long to post but the current setup with the grid formation is basically (this is dummy code, not real, just to give an idea)
num_x = 100;
num_y = 51;
omega = linspace(0, 1, num_x));
sigmas = linspace(0, 2, num_y);
for i=1:num_x
for j=1:num_y
s = sigmas(j) + 1i.*omegas(i);
Z = % some involved square matrix computation here
conds(ii,jj) = cond(Z);
end
end singular matrix, root search, determinants, nonlinear eigenvalue problem MATLAB Answers — New Questions
Neural network gives very bad results for change in condition.
<</matlabcentral/answers/uploaded_files/1822926/Nnt1.jpg>>
<</matlabcentral/answers/uploaded_files/1822927/Nnt2.jpg>>
I have a simulink circuit which has two PI controllers. I wanted to replace them with neural network blocks. I trained neural network blocks from data for normal conditions of the circuit. The neural network blocks give good results. But when I changed the normal condition of the circuit (changed input voltage) the output was unexpected. I need to know can the Ann blocks work for changed conditions of circuit? How can I make it able to work at variable conditions? The training results are given above.<</matlabcentral/answers/uploaded_files/1822926/Nnt1.jpg>>
<</matlabcentral/answers/uploaded_files/1822927/Nnt2.jpg>>
I have a simulink circuit which has two PI controllers. I wanted to replace them with neural network blocks. I trained neural network blocks from data for normal conditions of the circuit. The neural network blocks give good results. But when I changed the normal condition of the circuit (changed input voltage) the output was unexpected. I need to know can the Ann blocks work for changed conditions of circuit? How can I make it able to work at variable conditions? The training results are given above. <</matlabcentral/answers/uploaded_files/1822926/Nnt1.jpg>>
<</matlabcentral/answers/uploaded_files/1822927/Nnt2.jpg>>
I have a simulink circuit which has two PI controllers. I wanted to replace them with neural network blocks. I trained neural network blocks from data for normal conditions of the circuit. The neural network blocks give good results. But when I changed the normal condition of the circuit (changed input voltage) the output was unexpected. I need to know can the Ann blocks work for changed conditions of circuit? How can I make it able to work at variable conditions? The training results are given above. variable conditions of circuit MATLAB Answers — New Questions