Author: PuTI
Matlab Signal editor issue- Unable to see the signals and scenarios after adding
Hi,
I ‘m facing the signal editor issue in Matlab 2023b. I couldn’t see the signals and scenarios after adding the signals in the signal editor in matlab 2023b. Even though after adding existing .mat file. The signals exists in .mat file also not appeared in the signal editor. I think the side inputs panel was missing . Is there any way to get the side inputs panel ? please let me know the solutionHi,
I ‘m facing the signal editor issue in Matlab 2023b. I couldn’t see the signals and scenarios after adding the signals in the signal editor in matlab 2023b. Even though after adding existing .mat file. The signals exists in .mat file also not appeared in the signal editor. I think the side inputs panel was missing . Is there any way to get the side inputs panel ? please let me know the solution Hi,
I ‘m facing the signal editor issue in Matlab 2023b. I couldn’t see the signals and scenarios after adding the signals in the signal editor in matlab 2023b. Even though after adding existing .mat file. The signals exists in .mat file also not appeared in the signal editor. I think the side inputs panel was missing . Is there any way to get the side inputs panel ? please let me know the solution matlab, signal processing, simulink, signal editor MATLAB Answers — New Questions
Failed to run led demo in external mode at the raspberry pi 4B with simulink
I have tried different 32bit bullseye raspberry OS, and different matlab version, but the issuse is still exsisted, could somebody kindly please tell me about the stable version raspberry OS and Matlab for running external mode on raspberry 4B.
matlab :2023b; 2024a;
raspberry pi os: 32-bii-bullseye-armhf_2024-10-22
Error:
### Starting build procedure for: untitled
### Build procedure for untitled aborted due to an error.
Build Summary
Top model targets built:
Model Action Rebuild Reason
====================================================================
untitled Failed Code generation information file does not exist.
0 of 1 models built (0 models already up to date)
Build duration: 0h 0m 28.07s
Error executing command "touch -c /home/pi/MATLAB_ws/R2023b/C/Users/chenz/Documents/MATLAB/Examples/R2023b/raspberrypi/GettingStartedWithSimulinkRaspberryPiHardwareExample/untitled_ert_rtw/*.*;make MATLAB_ROOT=%MATLAB_ROOT% ALT_MATLAB_ROOT=%ALT_MATLAB_ROOT% MATLAB_BIN=%MATLAB_BIN% ALT_MATLAB_BIN=%ALT_MATLAB_BIN% -j$(($(nproc)+1)) -Otarget -f untitled.mk all MATLAB_WORKSPACE="/home/pi/MATLAB_ws/R2023b" LINUX_TARGET_LIBS_MACRO="" -C /home/pi/MATLAB_ws/R2023b/C/Users/chenz/Documents/MATLAB/Examples/R2023b/raspberrypi/GettingStartedWithSimulinkRaspberryPiHardwareExample/untitled_ert_rtw LC_ALL=C". Details:
STDERR: make: *** No rule to make target ‘%MATLAB_ROOT%/rtw/c/src/ext_mode/common/ext_svr.c’, needed by ‘ext_svr.c.o’. Stop.
make: *** Waiting for unfinished jobs….
In file included from /home/pi/MATLAB_ws/R2023b/C/Users/chenz/Documents/MATLAB/Examples/R2023b/raspberrypi/GettingStartedWithSimulinkRaspberryPiHardwareExample/untitled_ert_rtw/untitled.h:6,
from /home/pi/MATLAB_ws/R2023b/C/Users/chenz/Documents/MATLAB/Examples/R2023b/raspberrypi/GettingStartedWithSimulinkRaspberryPiHardwareExample/untitled_ert_rtw/untitled.c:2:
/home/pi/MATLAB_ws/R2023b/C/Users/chenz/Documents/MATLAB/Examples/R2023b/raspberrypi/GettingStartedWithSimulinkRaspberryPiHardwareExample/untitled_ert_rtw/rtwtypes.h:4:10: fatal error: tmwtypes.h: No such file or directory
4 | #include "tmwtypes.h"
| ^~~~~~~~~~~~
compilation terminated.
make: *** [untitled.mk:461: untitled.c.o] Error 1
In file included from /home/pi/MATLAB_ws/R2023b/C/ProgramData/MATLAB/SupportPackages/R2023b/toolbox/realtime/targets/raspi/unifiedserver/common.h:5,
from /home/pi/MATLAB_ws/R2023b/C/ProgramData/MATLAB/SupportPackages/R2023b/toolbox/realtime/targets/raspi/unifiedserver/devices.h:3,
from /home/pi/MATLAB_ws/R2023b/C/ProgramData/MATLAB/SupportPackages/R2023b/toolbox/realtime/targets/raspi/unifiedserver/devices.c:6:
/home/pi/MATLAB_ws/R2023b/C/Users/chenz/Documents/MATLAB/Examples/R2023b/raspberrypi/GettingStartedWithSimulinkRaspberryPiHardwareExample/untitled_ert_rtw/rtwtypes.h:4:10: fatal error: tmwtypes.h: No such file or directory
4 | #include "tmwtypes.h"
| ^~~~~~~~~~~~
compilation terminated.
make: *** [untitled.mk:449: devices.c.o] Error 1
In file included from /home/pi/MATLAB_ws/R2023b/C/Users/chenz/Documents/MATLAB/Examples/R2023b/raspberrypi/GettingStartedWithSimulinkRaspberryPiHardwareExample/untitled_ert_rtw/untitled.h:6,
from /home/pi/MATLAB_ws/R2023b/C/Users/chenz/Documents/MATLAB/Examples/R2023b/raspberrypi/GettingStartedWithSimulinkRaspberryPiHardwareExample/untitled_ert_rtw/untitled_data.c:2:
/home/pi/MATLAB_ws/R2023b/C/Users/chenz/Documents/MATLAB/Examples/R2023b/raspberrypi/GettingStartedWithSimulinkRaspberryPiHardwareExample/untitled_ert_rtw/rtwtypes.h:4:10: fatal error: tmwtypes.h: No such file or directory
4 | #include "tmwtypes.h"
| ^~~~~~~~~~~~
compilation terminated.
make: *** [untitled.mk:465: untitled_data.c.o] Error 1
In file included from /home/pi/MATLAB_ws/R2023b/C/ProgramData/MATLAB/SupportPackages/R2023b/toolbox/realtime/targets/raspi/unifiedserver/common.h:5,
from /home/pi/MATLAB_ws/R2023b/C/ProgramData/MATLAB/SupportPackages/R2023b/toolbox/realtime/targets/raspi/unifiedserver/LED.c:8:
/home/pi/MATLAB_ws/R2023b/C/Users/chenz/Documents/MATLAB/Examples/R2023b/raspberrypi/GettingStartedWithSimulinkRaspberryPiHardwareExample/untitled_ert_rtw/rtwtypes.h:4:10: fatal error: tmwtypes.h: No such file or directory
4 | #include "tmwtypes.h"
| ^~~~~~~~~~~~
compilation terminated.
make: *** [untitled.mk:453: LED.c.o] Error 1
STDOUT: make: Entering directory ‘/home/pi/MATLAB_ws/R2023b/C/Users/chenz/Documents/MATLAB/Examples/R2023b/raspberrypi/GettingStartedWithSimulinkRaspberryPiHardwareExample/untitled_ert_rtw’
gcc -c -MMD -MP -MF"untitled.c.dep" -MT"untitled.c.o" -O2 -DMW_NUM_CORES=4 -D__MW_TARGET_USE_HARDWARE_RESOURCES_H__ -DMW_CAN_BITRATE=500000 -DMW_CAN_ALLOWALLMSGS=1 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DEXT_MODE=1 -DONESTEPFCN=1 -DTERMFCN=1 -DMULTI_INSTANCE_CODE=0 -DINTEGER_CODE=0 -DMT=0 -DON_TARGET_WAIT_FOR_START=1 -DTID01EQ=0 -D__linux__ -DARM_PROJECT -D_USE_TARGET_UDP_ -D_RUNONTARGETHARDWARE_BUILD_ -DSTACK_SIZE=64 -DRT -DMODEL=untitled -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -DMODEL_HAS_DYNAMICALLY_LOADED_SFCNS=0 -I/home/pi/MATLAB_ws/R2023b/C/Users/chenz/Documents/MATLAB/Examples/R2023b/raspberrypi/GettingStartedWithSimulinkRaspberryPiHardwareExample -I/home/pi/MATLAB_ws/R2023b/C/ProgramData/MATLAB/SupportPackages/R2023b/toolbox/realtime/targets/raspi/unifiedserver -I/home/pi/MATLAB_ws/R2023b/C/Users/chenz/Documents/MATLAB/Examples/R2023b/raspberrypi/GettingStartedWithSimulinkRaspberryPiHardwareExample/untitled_ert_rtw -I%MATLAB_ROOT%/extern/include -I%MATLAB_ROOT%/simulink/include -I%MATLAB_ROOT%/rtw/c/src -I%MATLAB_ROOT%/rtw/c/src/ext_mode/common -I%MATLAB_ROOT%/rtw/c/ert -I%MATLAB_ROOT%/toolbox/coder/rtiostream/src -I%MATLAB_ROOT%/toolbox/coder/rtiostream/src/utils -I/home/pi/MATLAB_ws/R2023b/C/ProgramData/MATLAB/SupportPackages/R2023b/toolbox/realtime/targets/raspi/include -I%MATLAB_ROOT%/toolbox/target/codertarget/rtos/inc -o "untitled.c.o" "/home/pi/MATLAB_ws/R2023b/C/Users/chenz/Documents/MATLAB/Examples/R2023b/raspberrypi/GettingStartedWithSimulinkRaspberryPiHardwareExample/untitled_ert_rtw/untitled.c"
make: Leaving directory ‘/home/pi/MATLAB_ws/R2023b/C/Users/chenz/Documents/MATLAB/Examples/R2023b/raspberrypi/GettingStartedWithSimulinkRaspberryPiHardwareExample/untitled_ert_rtw’
make: Entering directory ‘/home/pi/MATLAB_ws/R2023b/C/Users/chenz/Documents/MATLAB/Examples/R2023b/raspberrypi/GettingStartedWithSimulinkRaspberryPiHardwareExample/untitled_ert_rtw’
gcc -c -MMD -MP -MF"devices.c.dep" -MT"devices.c.o" -O2 -DMW_NUM_CORES=4 -D__MW_TARGET_USE_HARDWARE_RESOURCES_H__ -DMW_CAN_BITRATE=500000 -DMW_CAN_ALLOWALLMSGS=1 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DEXT_MODE=1 -DONESTEPFCN=1 -DTERMFCN=1 -DMULTI_INSTANCE_CODE=0 -DINTEGER_CODE=0 -DMT=0 -DON_TARGET_WAIT_FOR_START=1 -DTID01EQ=0 -D__linux__ -DARM_PROJECT -D_USE_TARGET_UDP_ -D_RUNONTARGETHARDWARE_BUILD_ -DSTACK_SIZE=64 -DRT -DMODEL=untitled -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -DMODEL_HAS_DYNAMICALLY_LOADED_SFCNS=0 -I/home/pi/MATLAB_ws/R2023b/C/Users/chenz/Documents/MATLAB/Examples/R2023b/raspberrypi/GettingStartedWithSimulinkRaspberryPiHardwareExample -I/home/pi/MATLAB_ws/R2023b/C/ProgramData/MATLAB/SupportPackages/R2023b/toolbox/realtime/targets/raspi/unifiedserver -I/home/pi/MATLAB_ws/R2023b/C/Users/chenz/Documents/MATLAB/Examples/R2023b/raspberrypi/GettingStartedWithSimulinkRaspberryPiHardwareExample/untitled_ert_rtw -I%MATLAB_ROOT%/extern/include -I%MATLAB_ROOT%/simulink/include -I%MATLAB_ROOT%/rtw/c/src -I%MATLAB_ROOT%/rtw/c/src/ext_mode/common -I%MATLAB_ROOT%/rtw/c/ert -I%MATLAB_ROOT%/toolbox/coder/rtiostream/src -I%MATLAB_ROOT%/toolbox/coder/rtiostream/src/utils -I/home/pi/MATLAB_ws/R2023b/C/ProgramData/MATLAB/SupportPackages/R2023b/toolbox/realtime/targets/raspi/include -I%MATLAB_ROOT%/toolbox/target/codertarget/rtos/inc -o "devices.c.o" "/home/pi/MATLAB_ws/R2023b/C/ProgramData/MATLAB/SupportPackages/R2023b/toolbox/realtime/targets/raspi/unifiedserver/devices.c"
make: Leaving directory ‘/home/pi/MATLAB_ws/R2023b/C/Users/chenz/Documents/MATLAB/Examples/R2023b/raspberrypi/GettingStartedWithSimulinkRaspberryPiHardwareExample/untitled_ert_rtw’
make: Entering directory ‘/home/pi/MATLAB_ws/R2023b/C/Users/chenz/Documents/MATLAB/Examples/R2023b/raspberrypi/GettingStartedWithSimulinkRaspberryPiHardwareExample/untitled_ert_rtw’
gcc -c -MMD -MP -MF"untitled_data.c.dep" -MT"untitled_data.c.o" -O2 -DMW_NUM_CORES=4 -D__MW_TARGET_USE_HARDWARE_RESOURCES_H__ -DMW_CAN_BITRATE=500000 -DMW_CAN_ALLOWALLMSGS=1 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DEXT_MODE=1 -DONESTEPFCN=1 -DTERMFCN=1 -DMULTI_INSTANCE_CODE=0 -DINTEGER_CODE=0 -DMT=0 -DON_TARGET_WAIT_FOR_START=1 -DTID01EQ=0 -D__linux__ -DARM_PROJECT -D_USE_TARGET_UDP_ -D_RUNONTARGETHARDWARE_BUILD_ -DSTACK_SIZE=64 -DRT -DMODEL=untitled -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -DMODEL_HAS_DYNAMICALLY_LOADED_SFCNS=0 -I/home/pi/MATLAB_ws/R2023b/C/Users/chenz/Documents/MATLAB/Examples/R2023b/raspberrypi/GettingStartedWithSimulinkRaspberryPiHardwareExample -I/home/pi/MATLAB_ws/R2023b/C/ProgramData/MATLAB/SupportPackages/R2023b/toolbox/realtime/targets/raspi/unifiedserver -I/home/pi/MATLAB_ws/R2023b/C/Users/chenz/Documents/MATLAB/Examples/R2023b/raspberrypi/GettingStartedWithSimulinkRaspberryPiHardwareExample/untitled_ert_rtw -I%MATLAB_ROOT%/extern/include -I%MATLAB_ROOT%/simulink/include -I%MATLAB_ROOT%/rtw/c/src -I%MATLAB_ROOT%/rtw/c/src/ext_mode/common -I%MATLAB_ROOT%/rtw/c/ert -I%MATLAB_ROOT%/toolbox/coder/rtiostream/src -I%MATLAB_ROOT%/toolbox/coder/rtiostream/src/utils -I/home/pi/MATLAB_ws/R2023b/C/ProgramData/MATLAB/SupportPackages/R2023b/toolbox/realtime/targets/raspi/include -I%MATLAB_ROOT%/toolbox/target/codertarget/rtos/inc -o "untitled_data.c.o" "/home/pi/MATLAB_ws/R2023b/C/Users/chenz/Documents/MATLAB/Examples/R2023b/raspberrypi/GettingStartedWithSimulinkRaspberryPiHardwareExample/untitled_ert_rtw/untitled_data.c"
make: Leaving directory ‘/home/pi/MATLAB_ws/R2023b/C/Users/chenz/Documents/MATLAB/Examples/R2023b/raspberrypi/GettingStartedWithSimulinkRaspberryPiHardwareExample/untitled_ert_rtw’
make: Entering directory ‘/home/pi/MATLAB_ws/R2023b/C/Users/chenz/Documents/MATLAB/Examples/R2023b/raspberrypi/GettingStartedWithSimulinkRaspberryPiHardwareExample/untitled_ert_rtw’
gcc -c -MMD -MP -MF"LED.c.dep" -MT"LED.c.o" -O2 -DMW_NUM_CORES=4 -D__MW_TARGET_USE_HARDWARE_RESOURCES_H__ -DMW_CAN_BITRATE=500000 -DMW_CAN_ALLOWALLMSGS=1 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DEXT_MODE=1 -DONESTEPFCN=1 -DTERMFCN=1 -DMULTI_INSTANCE_CODE=0 -DINTEGER_CODE=0 -DMT=0 -DON_TARGET_WAIT_FOR_START=1 -DTID01EQ=0 -D__linux__ -DARM_PROJECT -D_USE_TARGET_UDP_ -D_RUNONTARGETHARDWARE_BUILD_ -DSTACK_SIZE=64 -DRT -DMODEL=untitled -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -DMODEL_HAS_DYNAMICALLY_LOADED_SFCNS=0 -I/home/pi/MATLAB_ws/R2023b/C/Users/chenz/Documents/MATLAB/Examples/R2023b/raspberrypi/GettingStartedWithSimulinkRaspberryPiHardwareExample -I/home/pi/MATLAB_ws/R2023b/C/ProgramData/MATLAB/SupportPackages/R2023b/toolbox/realtime/targets/raspi/unifiedserver -I/home/pi/MATLAB_ws/R2023b/C/Users/chenz/Documents/MATLAB/Examples/R2023b/raspberrypi/GettingStartedWithSimulinkRaspberryPiHardwareExample/untitled_ert_rtw -I%MATLAB_ROOT%/extern/include -I%MATLAB_ROOT%/simulink/include -I%MATLAB_ROOT%/rtw/c/src -I%MATLAB_ROOT%/rtw/c/src/ext_mode/common -I%MATLAB_ROOT%/rtw/c/ert -I%MATLAB_ROOT%/toolbox/coder/rtiostream/src -I%MATLAB_ROOT%/toolbox/coder/rtiostream/src/utils -I/home/pi/MATLAB_ws/R2023b/C/ProgramData/MATLAB/SupportPackages/R2023b/toolbox/realtime/targets/raspi/include -I%MATLAB_ROOT%/toolbox/target/codertarget/rtos/inc -o "LED.c.o" "/home/pi/MATLAB_ws/R2023b/C/ProgramData/MATLAB/SupportPackages/R2023b/toolbox/realtime/targets/raspi/unifiedserver/LED.c"
make: Leaving directory ‘/home/pi/MATLAB_ws/R2023b/C/Users/chenz/Documents/MATLAB/Examples/R2023b/raspberrypi/GettingStartedWithSimulinkRaspberryPiHardwareExample/untitled_ert_rtw’
In addition, it can run in matlab, but the name is wrong, I suspect that this name might lead to this error.
r=raspi(‘xxx.xxx.xxx.xxx’,’pi’,’raspberry’)
r =
raspi with properties:
DeviceAddress: ‘192.168.137.176’
Port: 18734
BoardName: ‘Raspberry Pi 2 Model B’
AvailableLEDs: {‘led0’}
AvailableDigitalPins: [4,5,6,10,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27]
AvailableSPIChannels: {‘CE1’}
AvailableI2CBuses: {‘i2c-1’}
AvailableWebcams: {}
I2CBusSpeed: 100000
AvailableCANInterfaces: {}I have tried different 32bit bullseye raspberry OS, and different matlab version, but the issuse is still exsisted, could somebody kindly please tell me about the stable version raspberry OS and Matlab for running external mode on raspberry 4B.
matlab :2023b; 2024a;
raspberry pi os: 32-bii-bullseye-armhf_2024-10-22
Error:
### Starting build procedure for: untitled
### Build procedure for untitled aborted due to an error.
Build Summary
Top model targets built:
Model Action Rebuild Reason
====================================================================
untitled Failed Code generation information file does not exist.
0 of 1 models built (0 models already up to date)
Build duration: 0h 0m 28.07s
Error executing command "touch -c /home/pi/MATLAB_ws/R2023b/C/Users/chenz/Documents/MATLAB/Examples/R2023b/raspberrypi/GettingStartedWithSimulinkRaspberryPiHardwareExample/untitled_ert_rtw/*.*;make MATLAB_ROOT=%MATLAB_ROOT% ALT_MATLAB_ROOT=%ALT_MATLAB_ROOT% MATLAB_BIN=%MATLAB_BIN% ALT_MATLAB_BIN=%ALT_MATLAB_BIN% -j$(($(nproc)+1)) -Otarget -f untitled.mk all MATLAB_WORKSPACE="/home/pi/MATLAB_ws/R2023b" LINUX_TARGET_LIBS_MACRO="" -C /home/pi/MATLAB_ws/R2023b/C/Users/chenz/Documents/MATLAB/Examples/R2023b/raspberrypi/GettingStartedWithSimulinkRaspberryPiHardwareExample/untitled_ert_rtw LC_ALL=C". Details:
STDERR: make: *** No rule to make target ‘%MATLAB_ROOT%/rtw/c/src/ext_mode/common/ext_svr.c’, needed by ‘ext_svr.c.o’. Stop.
make: *** Waiting for unfinished jobs….
In file included from /home/pi/MATLAB_ws/R2023b/C/Users/chenz/Documents/MATLAB/Examples/R2023b/raspberrypi/GettingStartedWithSimulinkRaspberryPiHardwareExample/untitled_ert_rtw/untitled.h:6,
from /home/pi/MATLAB_ws/R2023b/C/Users/chenz/Documents/MATLAB/Examples/R2023b/raspberrypi/GettingStartedWithSimulinkRaspberryPiHardwareExample/untitled_ert_rtw/untitled.c:2:
/home/pi/MATLAB_ws/R2023b/C/Users/chenz/Documents/MATLAB/Examples/R2023b/raspberrypi/GettingStartedWithSimulinkRaspberryPiHardwareExample/untitled_ert_rtw/rtwtypes.h:4:10: fatal error: tmwtypes.h: No such file or directory
4 | #include "tmwtypes.h"
| ^~~~~~~~~~~~
compilation terminated.
make: *** [untitled.mk:461: untitled.c.o] Error 1
In file included from /home/pi/MATLAB_ws/R2023b/C/ProgramData/MATLAB/SupportPackages/R2023b/toolbox/realtime/targets/raspi/unifiedserver/common.h:5,
from /home/pi/MATLAB_ws/R2023b/C/ProgramData/MATLAB/SupportPackages/R2023b/toolbox/realtime/targets/raspi/unifiedserver/devices.h:3,
from /home/pi/MATLAB_ws/R2023b/C/ProgramData/MATLAB/SupportPackages/R2023b/toolbox/realtime/targets/raspi/unifiedserver/devices.c:6:
/home/pi/MATLAB_ws/R2023b/C/Users/chenz/Documents/MATLAB/Examples/R2023b/raspberrypi/GettingStartedWithSimulinkRaspberryPiHardwareExample/untitled_ert_rtw/rtwtypes.h:4:10: fatal error: tmwtypes.h: No such file or directory
4 | #include "tmwtypes.h"
| ^~~~~~~~~~~~
compilation terminated.
make: *** [untitled.mk:449: devices.c.o] Error 1
In file included from /home/pi/MATLAB_ws/R2023b/C/Users/chenz/Documents/MATLAB/Examples/R2023b/raspberrypi/GettingStartedWithSimulinkRaspberryPiHardwareExample/untitled_ert_rtw/untitled.h:6,
from /home/pi/MATLAB_ws/R2023b/C/Users/chenz/Documents/MATLAB/Examples/R2023b/raspberrypi/GettingStartedWithSimulinkRaspberryPiHardwareExample/untitled_ert_rtw/untitled_data.c:2:
/home/pi/MATLAB_ws/R2023b/C/Users/chenz/Documents/MATLAB/Examples/R2023b/raspberrypi/GettingStartedWithSimulinkRaspberryPiHardwareExample/untitled_ert_rtw/rtwtypes.h:4:10: fatal error: tmwtypes.h: No such file or directory
4 | #include "tmwtypes.h"
| ^~~~~~~~~~~~
compilation terminated.
make: *** [untitled.mk:465: untitled_data.c.o] Error 1
In file included from /home/pi/MATLAB_ws/R2023b/C/ProgramData/MATLAB/SupportPackages/R2023b/toolbox/realtime/targets/raspi/unifiedserver/common.h:5,
from /home/pi/MATLAB_ws/R2023b/C/ProgramData/MATLAB/SupportPackages/R2023b/toolbox/realtime/targets/raspi/unifiedserver/LED.c:8:
/home/pi/MATLAB_ws/R2023b/C/Users/chenz/Documents/MATLAB/Examples/R2023b/raspberrypi/GettingStartedWithSimulinkRaspberryPiHardwareExample/untitled_ert_rtw/rtwtypes.h:4:10: fatal error: tmwtypes.h: No such file or directory
4 | #include "tmwtypes.h"
| ^~~~~~~~~~~~
compilation terminated.
make: *** [untitled.mk:453: LED.c.o] Error 1
STDOUT: make: Entering directory ‘/home/pi/MATLAB_ws/R2023b/C/Users/chenz/Documents/MATLAB/Examples/R2023b/raspberrypi/GettingStartedWithSimulinkRaspberryPiHardwareExample/untitled_ert_rtw’
gcc -c -MMD -MP -MF"untitled.c.dep" -MT"untitled.c.o" -O2 -DMW_NUM_CORES=4 -D__MW_TARGET_USE_HARDWARE_RESOURCES_H__ -DMW_CAN_BITRATE=500000 -DMW_CAN_ALLOWALLMSGS=1 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DEXT_MODE=1 -DONESTEPFCN=1 -DTERMFCN=1 -DMULTI_INSTANCE_CODE=0 -DINTEGER_CODE=0 -DMT=0 -DON_TARGET_WAIT_FOR_START=1 -DTID01EQ=0 -D__linux__ -DARM_PROJECT -D_USE_TARGET_UDP_ -D_RUNONTARGETHARDWARE_BUILD_ -DSTACK_SIZE=64 -DRT -DMODEL=untitled -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -DMODEL_HAS_DYNAMICALLY_LOADED_SFCNS=0 -I/home/pi/MATLAB_ws/R2023b/C/Users/chenz/Documents/MATLAB/Examples/R2023b/raspberrypi/GettingStartedWithSimulinkRaspberryPiHardwareExample -I/home/pi/MATLAB_ws/R2023b/C/ProgramData/MATLAB/SupportPackages/R2023b/toolbox/realtime/targets/raspi/unifiedserver -I/home/pi/MATLAB_ws/R2023b/C/Users/chenz/Documents/MATLAB/Examples/R2023b/raspberrypi/GettingStartedWithSimulinkRaspberryPiHardwareExample/untitled_ert_rtw -I%MATLAB_ROOT%/extern/include -I%MATLAB_ROOT%/simulink/include -I%MATLAB_ROOT%/rtw/c/src -I%MATLAB_ROOT%/rtw/c/src/ext_mode/common -I%MATLAB_ROOT%/rtw/c/ert -I%MATLAB_ROOT%/toolbox/coder/rtiostream/src -I%MATLAB_ROOT%/toolbox/coder/rtiostream/src/utils -I/home/pi/MATLAB_ws/R2023b/C/ProgramData/MATLAB/SupportPackages/R2023b/toolbox/realtime/targets/raspi/include -I%MATLAB_ROOT%/toolbox/target/codertarget/rtos/inc -o "untitled.c.o" "/home/pi/MATLAB_ws/R2023b/C/Users/chenz/Documents/MATLAB/Examples/R2023b/raspberrypi/GettingStartedWithSimulinkRaspberryPiHardwareExample/untitled_ert_rtw/untitled.c"
make: Leaving directory ‘/home/pi/MATLAB_ws/R2023b/C/Users/chenz/Documents/MATLAB/Examples/R2023b/raspberrypi/GettingStartedWithSimulinkRaspberryPiHardwareExample/untitled_ert_rtw’
make: Entering directory ‘/home/pi/MATLAB_ws/R2023b/C/Users/chenz/Documents/MATLAB/Examples/R2023b/raspberrypi/GettingStartedWithSimulinkRaspberryPiHardwareExample/untitled_ert_rtw’
gcc -c -MMD -MP -MF"devices.c.dep" -MT"devices.c.o" -O2 -DMW_NUM_CORES=4 -D__MW_TARGET_USE_HARDWARE_RESOURCES_H__ -DMW_CAN_BITRATE=500000 -DMW_CAN_ALLOWALLMSGS=1 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DEXT_MODE=1 -DONESTEPFCN=1 -DTERMFCN=1 -DMULTI_INSTANCE_CODE=0 -DINTEGER_CODE=0 -DMT=0 -DON_TARGET_WAIT_FOR_START=1 -DTID01EQ=0 -D__linux__ -DARM_PROJECT -D_USE_TARGET_UDP_ -D_RUNONTARGETHARDWARE_BUILD_ -DSTACK_SIZE=64 -DRT -DMODEL=untitled -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -DMODEL_HAS_DYNAMICALLY_LOADED_SFCNS=0 -I/home/pi/MATLAB_ws/R2023b/C/Users/chenz/Documents/MATLAB/Examples/R2023b/raspberrypi/GettingStartedWithSimulinkRaspberryPiHardwareExample -I/home/pi/MATLAB_ws/R2023b/C/ProgramData/MATLAB/SupportPackages/R2023b/toolbox/realtime/targets/raspi/unifiedserver -I/home/pi/MATLAB_ws/R2023b/C/Users/chenz/Documents/MATLAB/Examples/R2023b/raspberrypi/GettingStartedWithSimulinkRaspberryPiHardwareExample/untitled_ert_rtw -I%MATLAB_ROOT%/extern/include -I%MATLAB_ROOT%/simulink/include -I%MATLAB_ROOT%/rtw/c/src -I%MATLAB_ROOT%/rtw/c/src/ext_mode/common -I%MATLAB_ROOT%/rtw/c/ert -I%MATLAB_ROOT%/toolbox/coder/rtiostream/src -I%MATLAB_ROOT%/toolbox/coder/rtiostream/src/utils -I/home/pi/MATLAB_ws/R2023b/C/ProgramData/MATLAB/SupportPackages/R2023b/toolbox/realtime/targets/raspi/include -I%MATLAB_ROOT%/toolbox/target/codertarget/rtos/inc -o "devices.c.o" "/home/pi/MATLAB_ws/R2023b/C/ProgramData/MATLAB/SupportPackages/R2023b/toolbox/realtime/targets/raspi/unifiedserver/devices.c"
make: Leaving directory ‘/home/pi/MATLAB_ws/R2023b/C/Users/chenz/Documents/MATLAB/Examples/R2023b/raspberrypi/GettingStartedWithSimulinkRaspberryPiHardwareExample/untitled_ert_rtw’
make: Entering directory ‘/home/pi/MATLAB_ws/R2023b/C/Users/chenz/Documents/MATLAB/Examples/R2023b/raspberrypi/GettingStartedWithSimulinkRaspberryPiHardwareExample/untitled_ert_rtw’
gcc -c -MMD -MP -MF"untitled_data.c.dep" -MT"untitled_data.c.o" -O2 -DMW_NUM_CORES=4 -D__MW_TARGET_USE_HARDWARE_RESOURCES_H__ -DMW_CAN_BITRATE=500000 -DMW_CAN_ALLOWALLMSGS=1 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DEXT_MODE=1 -DONESTEPFCN=1 -DTERMFCN=1 -DMULTI_INSTANCE_CODE=0 -DINTEGER_CODE=0 -DMT=0 -DON_TARGET_WAIT_FOR_START=1 -DTID01EQ=0 -D__linux__ -DARM_PROJECT -D_USE_TARGET_UDP_ -D_RUNONTARGETHARDWARE_BUILD_ -DSTACK_SIZE=64 -DRT -DMODEL=untitled -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -DMODEL_HAS_DYNAMICALLY_LOADED_SFCNS=0 -I/home/pi/MATLAB_ws/R2023b/C/Users/chenz/Documents/MATLAB/Examples/R2023b/raspberrypi/GettingStartedWithSimulinkRaspberryPiHardwareExample -I/home/pi/MATLAB_ws/R2023b/C/ProgramData/MATLAB/SupportPackages/R2023b/toolbox/realtime/targets/raspi/unifiedserver -I/home/pi/MATLAB_ws/R2023b/C/Users/chenz/Documents/MATLAB/Examples/R2023b/raspberrypi/GettingStartedWithSimulinkRaspberryPiHardwareExample/untitled_ert_rtw -I%MATLAB_ROOT%/extern/include -I%MATLAB_ROOT%/simulink/include -I%MATLAB_ROOT%/rtw/c/src -I%MATLAB_ROOT%/rtw/c/src/ext_mode/common -I%MATLAB_ROOT%/rtw/c/ert -I%MATLAB_ROOT%/toolbox/coder/rtiostream/src -I%MATLAB_ROOT%/toolbox/coder/rtiostream/src/utils -I/home/pi/MATLAB_ws/R2023b/C/ProgramData/MATLAB/SupportPackages/R2023b/toolbox/realtime/targets/raspi/include -I%MATLAB_ROOT%/toolbox/target/codertarget/rtos/inc -o "untitled_data.c.o" "/home/pi/MATLAB_ws/R2023b/C/Users/chenz/Documents/MATLAB/Examples/R2023b/raspberrypi/GettingStartedWithSimulinkRaspberryPiHardwareExample/untitled_ert_rtw/untitled_data.c"
make: Leaving directory ‘/home/pi/MATLAB_ws/R2023b/C/Users/chenz/Documents/MATLAB/Examples/R2023b/raspberrypi/GettingStartedWithSimulinkRaspberryPiHardwareExample/untitled_ert_rtw’
make: Entering directory ‘/home/pi/MATLAB_ws/R2023b/C/Users/chenz/Documents/MATLAB/Examples/R2023b/raspberrypi/GettingStartedWithSimulinkRaspberryPiHardwareExample/untitled_ert_rtw’
gcc -c -MMD -MP -MF"LED.c.dep" -MT"LED.c.o" -O2 -DMW_NUM_CORES=4 -D__MW_TARGET_USE_HARDWARE_RESOURCES_H__ -DMW_CAN_BITRATE=500000 -DMW_CAN_ALLOWALLMSGS=1 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DEXT_MODE=1 -DONESTEPFCN=1 -DTERMFCN=1 -DMULTI_INSTANCE_CODE=0 -DINTEGER_CODE=0 -DMT=0 -DON_TARGET_WAIT_FOR_START=1 -DTID01EQ=0 -D__linux__ -DARM_PROJECT -D_USE_TARGET_UDP_ -D_RUNONTARGETHARDWARE_BUILD_ -DSTACK_SIZE=64 -DRT -DMODEL=untitled -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -DMODEL_HAS_DYNAMICALLY_LOADED_SFCNS=0 -I/home/pi/MATLAB_ws/R2023b/C/Users/chenz/Documents/MATLAB/Examples/R2023b/raspberrypi/GettingStartedWithSimulinkRaspberryPiHardwareExample -I/home/pi/MATLAB_ws/R2023b/C/ProgramData/MATLAB/SupportPackages/R2023b/toolbox/realtime/targets/raspi/unifiedserver -I/home/pi/MATLAB_ws/R2023b/C/Users/chenz/Documents/MATLAB/Examples/R2023b/raspberrypi/GettingStartedWithSimulinkRaspberryPiHardwareExample/untitled_ert_rtw -I%MATLAB_ROOT%/extern/include -I%MATLAB_ROOT%/simulink/include -I%MATLAB_ROOT%/rtw/c/src -I%MATLAB_ROOT%/rtw/c/src/ext_mode/common -I%MATLAB_ROOT%/rtw/c/ert -I%MATLAB_ROOT%/toolbox/coder/rtiostream/src -I%MATLAB_ROOT%/toolbox/coder/rtiostream/src/utils -I/home/pi/MATLAB_ws/R2023b/C/ProgramData/MATLAB/SupportPackages/R2023b/toolbox/realtime/targets/raspi/include -I%MATLAB_ROOT%/toolbox/target/codertarget/rtos/inc -o "LED.c.o" "/home/pi/MATLAB_ws/R2023b/C/ProgramData/MATLAB/SupportPackages/R2023b/toolbox/realtime/targets/raspi/unifiedserver/LED.c"
make: Leaving directory ‘/home/pi/MATLAB_ws/R2023b/C/Users/chenz/Documents/MATLAB/Examples/R2023b/raspberrypi/GettingStartedWithSimulinkRaspberryPiHardwareExample/untitled_ert_rtw’
In addition, it can run in matlab, but the name is wrong, I suspect that this name might lead to this error.
r=raspi(‘xxx.xxx.xxx.xxx’,’pi’,’raspberry’)
r =
raspi with properties:
DeviceAddress: ‘192.168.137.176’
Port: 18734
BoardName: ‘Raspberry Pi 2 Model B’
AvailableLEDs: {‘led0’}
AvailableDigitalPins: [4,5,6,10,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27]
AvailableSPIChannels: {‘CE1’}
AvailableI2CBuses: {‘i2c-1’}
AvailableWebcams: {}
I2CBusSpeed: 100000
AvailableCANInterfaces: {} I have tried different 32bit bullseye raspberry OS, and different matlab version, but the issuse is still exsisted, could somebody kindly please tell me about the stable version raspberry OS and Matlab for running external mode on raspberry 4B.
matlab :2023b; 2024a;
raspberry pi os: 32-bii-bullseye-armhf_2024-10-22
Error:
### Starting build procedure for: untitled
### Build procedure for untitled aborted due to an error.
Build Summary
Top model targets built:
Model Action Rebuild Reason
====================================================================
untitled Failed Code generation information file does not exist.
0 of 1 models built (0 models already up to date)
Build duration: 0h 0m 28.07s
Error executing command "touch -c /home/pi/MATLAB_ws/R2023b/C/Users/chenz/Documents/MATLAB/Examples/R2023b/raspberrypi/GettingStartedWithSimulinkRaspberryPiHardwareExample/untitled_ert_rtw/*.*;make MATLAB_ROOT=%MATLAB_ROOT% ALT_MATLAB_ROOT=%ALT_MATLAB_ROOT% MATLAB_BIN=%MATLAB_BIN% ALT_MATLAB_BIN=%ALT_MATLAB_BIN% -j$(($(nproc)+1)) -Otarget -f untitled.mk all MATLAB_WORKSPACE="/home/pi/MATLAB_ws/R2023b" LINUX_TARGET_LIBS_MACRO="" -C /home/pi/MATLAB_ws/R2023b/C/Users/chenz/Documents/MATLAB/Examples/R2023b/raspberrypi/GettingStartedWithSimulinkRaspberryPiHardwareExample/untitled_ert_rtw LC_ALL=C". Details:
STDERR: make: *** No rule to make target ‘%MATLAB_ROOT%/rtw/c/src/ext_mode/common/ext_svr.c’, needed by ‘ext_svr.c.o’. Stop.
make: *** Waiting for unfinished jobs….
In file included from /home/pi/MATLAB_ws/R2023b/C/Users/chenz/Documents/MATLAB/Examples/R2023b/raspberrypi/GettingStartedWithSimulinkRaspberryPiHardwareExample/untitled_ert_rtw/untitled.h:6,
from /home/pi/MATLAB_ws/R2023b/C/Users/chenz/Documents/MATLAB/Examples/R2023b/raspberrypi/GettingStartedWithSimulinkRaspberryPiHardwareExample/untitled_ert_rtw/untitled.c:2:
/home/pi/MATLAB_ws/R2023b/C/Users/chenz/Documents/MATLAB/Examples/R2023b/raspberrypi/GettingStartedWithSimulinkRaspberryPiHardwareExample/untitled_ert_rtw/rtwtypes.h:4:10: fatal error: tmwtypes.h: No such file or directory
4 | #include "tmwtypes.h"
| ^~~~~~~~~~~~
compilation terminated.
make: *** [untitled.mk:461: untitled.c.o] Error 1
In file included from /home/pi/MATLAB_ws/R2023b/C/ProgramData/MATLAB/SupportPackages/R2023b/toolbox/realtime/targets/raspi/unifiedserver/common.h:5,
from /home/pi/MATLAB_ws/R2023b/C/ProgramData/MATLAB/SupportPackages/R2023b/toolbox/realtime/targets/raspi/unifiedserver/devices.h:3,
from /home/pi/MATLAB_ws/R2023b/C/ProgramData/MATLAB/SupportPackages/R2023b/toolbox/realtime/targets/raspi/unifiedserver/devices.c:6:
/home/pi/MATLAB_ws/R2023b/C/Users/chenz/Documents/MATLAB/Examples/R2023b/raspberrypi/GettingStartedWithSimulinkRaspberryPiHardwareExample/untitled_ert_rtw/rtwtypes.h:4:10: fatal error: tmwtypes.h: No such file or directory
4 | #include "tmwtypes.h"
| ^~~~~~~~~~~~
compilation terminated.
make: *** [untitled.mk:449: devices.c.o] Error 1
In file included from /home/pi/MATLAB_ws/R2023b/C/Users/chenz/Documents/MATLAB/Examples/R2023b/raspberrypi/GettingStartedWithSimulinkRaspberryPiHardwareExample/untitled_ert_rtw/untitled.h:6,
from /home/pi/MATLAB_ws/R2023b/C/Users/chenz/Documents/MATLAB/Examples/R2023b/raspberrypi/GettingStartedWithSimulinkRaspberryPiHardwareExample/untitled_ert_rtw/untitled_data.c:2:
/home/pi/MATLAB_ws/R2023b/C/Users/chenz/Documents/MATLAB/Examples/R2023b/raspberrypi/GettingStartedWithSimulinkRaspberryPiHardwareExample/untitled_ert_rtw/rtwtypes.h:4:10: fatal error: tmwtypes.h: No such file or directory
4 | #include "tmwtypes.h"
| ^~~~~~~~~~~~
compilation terminated.
make: *** [untitled.mk:465: untitled_data.c.o] Error 1
In file included from /home/pi/MATLAB_ws/R2023b/C/ProgramData/MATLAB/SupportPackages/R2023b/toolbox/realtime/targets/raspi/unifiedserver/common.h:5,
from /home/pi/MATLAB_ws/R2023b/C/ProgramData/MATLAB/SupportPackages/R2023b/toolbox/realtime/targets/raspi/unifiedserver/LED.c:8:
/home/pi/MATLAB_ws/R2023b/C/Users/chenz/Documents/MATLAB/Examples/R2023b/raspberrypi/GettingStartedWithSimulinkRaspberryPiHardwareExample/untitled_ert_rtw/rtwtypes.h:4:10: fatal error: tmwtypes.h: No such file or directory
4 | #include "tmwtypes.h"
| ^~~~~~~~~~~~
compilation terminated.
make: *** [untitled.mk:453: LED.c.o] Error 1
STDOUT: make: Entering directory ‘/home/pi/MATLAB_ws/R2023b/C/Users/chenz/Documents/MATLAB/Examples/R2023b/raspberrypi/GettingStartedWithSimulinkRaspberryPiHardwareExample/untitled_ert_rtw’
gcc -c -MMD -MP -MF"untitled.c.dep" -MT"untitled.c.o" -O2 -DMW_NUM_CORES=4 -D__MW_TARGET_USE_HARDWARE_RESOURCES_H__ -DMW_CAN_BITRATE=500000 -DMW_CAN_ALLOWALLMSGS=1 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DEXT_MODE=1 -DONESTEPFCN=1 -DTERMFCN=1 -DMULTI_INSTANCE_CODE=0 -DINTEGER_CODE=0 -DMT=0 -DON_TARGET_WAIT_FOR_START=1 -DTID01EQ=0 -D__linux__ -DARM_PROJECT -D_USE_TARGET_UDP_ -D_RUNONTARGETHARDWARE_BUILD_ -DSTACK_SIZE=64 -DRT -DMODEL=untitled -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -DMODEL_HAS_DYNAMICALLY_LOADED_SFCNS=0 -I/home/pi/MATLAB_ws/R2023b/C/Users/chenz/Documents/MATLAB/Examples/R2023b/raspberrypi/GettingStartedWithSimulinkRaspberryPiHardwareExample -I/home/pi/MATLAB_ws/R2023b/C/ProgramData/MATLAB/SupportPackages/R2023b/toolbox/realtime/targets/raspi/unifiedserver -I/home/pi/MATLAB_ws/R2023b/C/Users/chenz/Documents/MATLAB/Examples/R2023b/raspberrypi/GettingStartedWithSimulinkRaspberryPiHardwareExample/untitled_ert_rtw -I%MATLAB_ROOT%/extern/include -I%MATLAB_ROOT%/simulink/include -I%MATLAB_ROOT%/rtw/c/src -I%MATLAB_ROOT%/rtw/c/src/ext_mode/common -I%MATLAB_ROOT%/rtw/c/ert -I%MATLAB_ROOT%/toolbox/coder/rtiostream/src -I%MATLAB_ROOT%/toolbox/coder/rtiostream/src/utils -I/home/pi/MATLAB_ws/R2023b/C/ProgramData/MATLAB/SupportPackages/R2023b/toolbox/realtime/targets/raspi/include -I%MATLAB_ROOT%/toolbox/target/codertarget/rtos/inc -o "untitled.c.o" "/home/pi/MATLAB_ws/R2023b/C/Users/chenz/Documents/MATLAB/Examples/R2023b/raspberrypi/GettingStartedWithSimulinkRaspberryPiHardwareExample/untitled_ert_rtw/untitled.c"
make: Leaving directory ‘/home/pi/MATLAB_ws/R2023b/C/Users/chenz/Documents/MATLAB/Examples/R2023b/raspberrypi/GettingStartedWithSimulinkRaspberryPiHardwareExample/untitled_ert_rtw’
make: Entering directory ‘/home/pi/MATLAB_ws/R2023b/C/Users/chenz/Documents/MATLAB/Examples/R2023b/raspberrypi/GettingStartedWithSimulinkRaspberryPiHardwareExample/untitled_ert_rtw’
gcc -c -MMD -MP -MF"devices.c.dep" -MT"devices.c.o" -O2 -DMW_NUM_CORES=4 -D__MW_TARGET_USE_HARDWARE_RESOURCES_H__ -DMW_CAN_BITRATE=500000 -DMW_CAN_ALLOWALLMSGS=1 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DEXT_MODE=1 -DONESTEPFCN=1 -DTERMFCN=1 -DMULTI_INSTANCE_CODE=0 -DINTEGER_CODE=0 -DMT=0 -DON_TARGET_WAIT_FOR_START=1 -DTID01EQ=0 -D__linux__ -DARM_PROJECT -D_USE_TARGET_UDP_ -D_RUNONTARGETHARDWARE_BUILD_ -DSTACK_SIZE=64 -DRT -DMODEL=untitled -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -DMODEL_HAS_DYNAMICALLY_LOADED_SFCNS=0 -I/home/pi/MATLAB_ws/R2023b/C/Users/chenz/Documents/MATLAB/Examples/R2023b/raspberrypi/GettingStartedWithSimulinkRaspberryPiHardwareExample -I/home/pi/MATLAB_ws/R2023b/C/ProgramData/MATLAB/SupportPackages/R2023b/toolbox/realtime/targets/raspi/unifiedserver -I/home/pi/MATLAB_ws/R2023b/C/Users/chenz/Documents/MATLAB/Examples/R2023b/raspberrypi/GettingStartedWithSimulinkRaspberryPiHardwareExample/untitled_ert_rtw -I%MATLAB_ROOT%/extern/include -I%MATLAB_ROOT%/simulink/include -I%MATLAB_ROOT%/rtw/c/src -I%MATLAB_ROOT%/rtw/c/src/ext_mode/common -I%MATLAB_ROOT%/rtw/c/ert -I%MATLAB_ROOT%/toolbox/coder/rtiostream/src -I%MATLAB_ROOT%/toolbox/coder/rtiostream/src/utils -I/home/pi/MATLAB_ws/R2023b/C/ProgramData/MATLAB/SupportPackages/R2023b/toolbox/realtime/targets/raspi/include -I%MATLAB_ROOT%/toolbox/target/codertarget/rtos/inc -o "devices.c.o" "/home/pi/MATLAB_ws/R2023b/C/ProgramData/MATLAB/SupportPackages/R2023b/toolbox/realtime/targets/raspi/unifiedserver/devices.c"
make: Leaving directory ‘/home/pi/MATLAB_ws/R2023b/C/Users/chenz/Documents/MATLAB/Examples/R2023b/raspberrypi/GettingStartedWithSimulinkRaspberryPiHardwareExample/untitled_ert_rtw’
make: Entering directory ‘/home/pi/MATLAB_ws/R2023b/C/Users/chenz/Documents/MATLAB/Examples/R2023b/raspberrypi/GettingStartedWithSimulinkRaspberryPiHardwareExample/untitled_ert_rtw’
gcc -c -MMD -MP -MF"untitled_data.c.dep" -MT"untitled_data.c.o" -O2 -DMW_NUM_CORES=4 -D__MW_TARGET_USE_HARDWARE_RESOURCES_H__ -DMW_CAN_BITRATE=500000 -DMW_CAN_ALLOWALLMSGS=1 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DEXT_MODE=1 -DONESTEPFCN=1 -DTERMFCN=1 -DMULTI_INSTANCE_CODE=0 -DINTEGER_CODE=0 -DMT=0 -DON_TARGET_WAIT_FOR_START=1 -DTID01EQ=0 -D__linux__ -DARM_PROJECT -D_USE_TARGET_UDP_ -D_RUNONTARGETHARDWARE_BUILD_ -DSTACK_SIZE=64 -DRT -DMODEL=untitled -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -DMODEL_HAS_DYNAMICALLY_LOADED_SFCNS=0 -I/home/pi/MATLAB_ws/R2023b/C/Users/chenz/Documents/MATLAB/Examples/R2023b/raspberrypi/GettingStartedWithSimulinkRaspberryPiHardwareExample -I/home/pi/MATLAB_ws/R2023b/C/ProgramData/MATLAB/SupportPackages/R2023b/toolbox/realtime/targets/raspi/unifiedserver -I/home/pi/MATLAB_ws/R2023b/C/Users/chenz/Documents/MATLAB/Examples/R2023b/raspberrypi/GettingStartedWithSimulinkRaspberryPiHardwareExample/untitled_ert_rtw -I%MATLAB_ROOT%/extern/include -I%MATLAB_ROOT%/simulink/include -I%MATLAB_ROOT%/rtw/c/src -I%MATLAB_ROOT%/rtw/c/src/ext_mode/common -I%MATLAB_ROOT%/rtw/c/ert -I%MATLAB_ROOT%/toolbox/coder/rtiostream/src -I%MATLAB_ROOT%/toolbox/coder/rtiostream/src/utils -I/home/pi/MATLAB_ws/R2023b/C/ProgramData/MATLAB/SupportPackages/R2023b/toolbox/realtime/targets/raspi/include -I%MATLAB_ROOT%/toolbox/target/codertarget/rtos/inc -o "untitled_data.c.o" "/home/pi/MATLAB_ws/R2023b/C/Users/chenz/Documents/MATLAB/Examples/R2023b/raspberrypi/GettingStartedWithSimulinkRaspberryPiHardwareExample/untitled_ert_rtw/untitled_data.c"
make: Leaving directory ‘/home/pi/MATLAB_ws/R2023b/C/Users/chenz/Documents/MATLAB/Examples/R2023b/raspberrypi/GettingStartedWithSimulinkRaspberryPiHardwareExample/untitled_ert_rtw’
make: Entering directory ‘/home/pi/MATLAB_ws/R2023b/C/Users/chenz/Documents/MATLAB/Examples/R2023b/raspberrypi/GettingStartedWithSimulinkRaspberryPiHardwareExample/untitled_ert_rtw’
gcc -c -MMD -MP -MF"LED.c.dep" -MT"LED.c.o" -O2 -DMW_NUM_CORES=4 -D__MW_TARGET_USE_HARDWARE_RESOURCES_H__ -DMW_CAN_BITRATE=500000 -DMW_CAN_ALLOWALLMSGS=1 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DEXT_MODE=1 -DONESTEPFCN=1 -DTERMFCN=1 -DMULTI_INSTANCE_CODE=0 -DINTEGER_CODE=0 -DMT=0 -DON_TARGET_WAIT_FOR_START=1 -DTID01EQ=0 -D__linux__ -DARM_PROJECT -D_USE_TARGET_UDP_ -D_RUNONTARGETHARDWARE_BUILD_ -DSTACK_SIZE=64 -DRT -DMODEL=untitled -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -DMODEL_HAS_DYNAMICALLY_LOADED_SFCNS=0 -I/home/pi/MATLAB_ws/R2023b/C/Users/chenz/Documents/MATLAB/Examples/R2023b/raspberrypi/GettingStartedWithSimulinkRaspberryPiHardwareExample -I/home/pi/MATLAB_ws/R2023b/C/ProgramData/MATLAB/SupportPackages/R2023b/toolbox/realtime/targets/raspi/unifiedserver -I/home/pi/MATLAB_ws/R2023b/C/Users/chenz/Documents/MATLAB/Examples/R2023b/raspberrypi/GettingStartedWithSimulinkRaspberryPiHardwareExample/untitled_ert_rtw -I%MATLAB_ROOT%/extern/include -I%MATLAB_ROOT%/simulink/include -I%MATLAB_ROOT%/rtw/c/src -I%MATLAB_ROOT%/rtw/c/src/ext_mode/common -I%MATLAB_ROOT%/rtw/c/ert -I%MATLAB_ROOT%/toolbox/coder/rtiostream/src -I%MATLAB_ROOT%/toolbox/coder/rtiostream/src/utils -I/home/pi/MATLAB_ws/R2023b/C/ProgramData/MATLAB/SupportPackages/R2023b/toolbox/realtime/targets/raspi/include -I%MATLAB_ROOT%/toolbox/target/codertarget/rtos/inc -o "LED.c.o" "/home/pi/MATLAB_ws/R2023b/C/ProgramData/MATLAB/SupportPackages/R2023b/toolbox/realtime/targets/raspi/unifiedserver/LED.c"
make: Leaving directory ‘/home/pi/MATLAB_ws/R2023b/C/Users/chenz/Documents/MATLAB/Examples/R2023b/raspberrypi/GettingStartedWithSimulinkRaspberryPiHardwareExample/untitled_ert_rtw’
In addition, it can run in matlab, but the name is wrong, I suspect that this name might lead to this error.
r=raspi(‘xxx.xxx.xxx.xxx’,’pi’,’raspberry’)
r =
raspi with properties:
DeviceAddress: ‘192.168.137.176’
Port: 18734
BoardName: ‘Raspberry Pi 2 Model B’
AvailableLEDs: {‘led0’}
AvailableDigitalPins: [4,5,6,10,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27]
AvailableSPIChannels: {‘CE1’}
AvailableI2CBuses: {‘i2c-1’}
AvailableWebcams: {}
I2CBusSpeed: 100000
AvailableCANInterfaces: {} raspberry pi 4b simullink matlab MATLAB Answers — New Questions
How to make an FRF with my accelerometer Data and FFT?
Dear, Matlab Users.
I have some inquiries about my accelerometer Data, that was processed by a Dewesoft Software.
So, I am gonna share my code and data, and I would like to know if there any suggestion to this resolution.
Sensitivy: 102 mV/g, or 10.40 mV/m/s^2
%Load data
clear all
load("C:UsersjoantDesktopField_ResearchMatlab_Codedata_test.mat")
whos
close all
%Plot the array according to the data
%Data of Channel 1
g1= transpose(Data1_352C33OLD)
t1= transpose(Data1_time_352C33OLD); % time
dt=1/(Sample_rate) % period
L=length(g1)
%Iterate
% Figure of Channel 1
figure(1)
plot(t1,g1,’b.-‘)
set(gca,’Fontsize’,14)
xlabel(‘time(s)’)
ylabel(‘g’)
xlim([min(t1) max(t1)])
%ylim([-6 6])
grid on
% Calculate Fourier transform of force
points=round((t1(L))/dt) %Calculate the points
A_F= g1; % This is the Force for setting in the fft.
freq= (0:1/(dt*points):(1-1/(2*points))/dt)’; %Hz
freq=freq(1:round(points/2+1),:); %Hz
length(freq)
length(fft(A_F))
%In this part I need help
A_fft=fft(g1); %without the conversion by 9.8 m/s^2
abs_A=abs(A_fft)
figure(4)
plot(freq,abs_A(1:length(freq)))
xlim([0 6]) % Because 5 Hz is 300 RPM
%ylim([-400 400])
xlabel(‘Frequency (Hz)’)
ylabel(‘g’)
%According to the practice in the laboratory the result is the following
%image.
This was my process to obtain the FFT, I would like to know if this process is correct?. Because when I plot this data is not the same values in y-axis that I had in the Dewesoft software.
Dewesoft fft(g) (attached) vs matlab fft(g) (attached)
Question #2
According to a Mechanical vibration book, I have the next equation to find the FRF. I applied this but my FRF y axis value is too high so, I don’t know If I didn’t applied correctly. That information is in my code and I use the following equation.
w= natural frequency = 31.42 rad/s^2.
I assumpted that A/F is g because according to the book, it says the next information: "Because the acceloremeter produces a voltage that is proportional to acceleration, we obtain the accelerance, A/F(w), from the dynamic signal analyzer".
My graph result:
This graph it doesn’t have sense, because I need values aroun of 0.15-0.17 in the first vibration mode. So, I would like to know if there any suggestion how to resolve this.
Best Regards,
Jo98.Dear, Matlab Users.
I have some inquiries about my accelerometer Data, that was processed by a Dewesoft Software.
So, I am gonna share my code and data, and I would like to know if there any suggestion to this resolution.
Sensitivy: 102 mV/g, or 10.40 mV/m/s^2
%Load data
clear all
load("C:UsersjoantDesktopField_ResearchMatlab_Codedata_test.mat")
whos
close all
%Plot the array according to the data
%Data of Channel 1
g1= transpose(Data1_352C33OLD)
t1= transpose(Data1_time_352C33OLD); % time
dt=1/(Sample_rate) % period
L=length(g1)
%Iterate
% Figure of Channel 1
figure(1)
plot(t1,g1,’b.-‘)
set(gca,’Fontsize’,14)
xlabel(‘time(s)’)
ylabel(‘g’)
xlim([min(t1) max(t1)])
%ylim([-6 6])
grid on
% Calculate Fourier transform of force
points=round((t1(L))/dt) %Calculate the points
A_F= g1; % This is the Force for setting in the fft.
freq= (0:1/(dt*points):(1-1/(2*points))/dt)’; %Hz
freq=freq(1:round(points/2+1),:); %Hz
length(freq)
length(fft(A_F))
%In this part I need help
A_fft=fft(g1); %without the conversion by 9.8 m/s^2
abs_A=abs(A_fft)
figure(4)
plot(freq,abs_A(1:length(freq)))
xlim([0 6]) % Because 5 Hz is 300 RPM
%ylim([-400 400])
xlabel(‘Frequency (Hz)’)
ylabel(‘g’)
%According to the practice in the laboratory the result is the following
%image.
This was my process to obtain the FFT, I would like to know if this process is correct?. Because when I plot this data is not the same values in y-axis that I had in the Dewesoft software.
Dewesoft fft(g) (attached) vs matlab fft(g) (attached)
Question #2
According to a Mechanical vibration book, I have the next equation to find the FRF. I applied this but my FRF y axis value is too high so, I don’t know If I didn’t applied correctly. That information is in my code and I use the following equation.
w= natural frequency = 31.42 rad/s^2.
I assumpted that A/F is g because according to the book, it says the next information: "Because the acceloremeter produces a voltage that is proportional to acceleration, we obtain the accelerance, A/F(w), from the dynamic signal analyzer".
My graph result:
This graph it doesn’t have sense, because I need values aroun of 0.15-0.17 in the first vibration mode. So, I would like to know if there any suggestion how to resolve this.
Best Regards,
Jo98. Dear, Matlab Users.
I have some inquiries about my accelerometer Data, that was processed by a Dewesoft Software.
So, I am gonna share my code and data, and I would like to know if there any suggestion to this resolution.
Sensitivy: 102 mV/g, or 10.40 mV/m/s^2
%Load data
clear all
load("C:UsersjoantDesktopField_ResearchMatlab_Codedata_test.mat")
whos
close all
%Plot the array according to the data
%Data of Channel 1
g1= transpose(Data1_352C33OLD)
t1= transpose(Data1_time_352C33OLD); % time
dt=1/(Sample_rate) % period
L=length(g1)
%Iterate
% Figure of Channel 1
figure(1)
plot(t1,g1,’b.-‘)
set(gca,’Fontsize’,14)
xlabel(‘time(s)’)
ylabel(‘g’)
xlim([min(t1) max(t1)])
%ylim([-6 6])
grid on
% Calculate Fourier transform of force
points=round((t1(L))/dt) %Calculate the points
A_F= g1; % This is the Force for setting in the fft.
freq= (0:1/(dt*points):(1-1/(2*points))/dt)’; %Hz
freq=freq(1:round(points/2+1),:); %Hz
length(freq)
length(fft(A_F))
%In this part I need help
A_fft=fft(g1); %without the conversion by 9.8 m/s^2
abs_A=abs(A_fft)
figure(4)
plot(freq,abs_A(1:length(freq)))
xlim([0 6]) % Because 5 Hz is 300 RPM
%ylim([-400 400])
xlabel(‘Frequency (Hz)’)
ylabel(‘g’)
%According to the practice in the laboratory the result is the following
%image.
This was my process to obtain the FFT, I would like to know if this process is correct?. Because when I plot this data is not the same values in y-axis that I had in the Dewesoft software.
Dewesoft fft(g) (attached) vs matlab fft(g) (attached)
Question #2
According to a Mechanical vibration book, I have the next equation to find the FRF. I applied this but my FRF y axis value is too high so, I don’t know If I didn’t applied correctly. That information is in my code and I use the following equation.
w= natural frequency = 31.42 rad/s^2.
I assumpted that A/F is g because according to the book, it says the next information: "Because the acceloremeter produces a voltage that is proportional to acceleration, we obtain the accelerance, A/F(w), from the dynamic signal analyzer".
My graph result:
This graph it doesn’t have sense, because I need values aroun of 0.15-0.17 in the first vibration mode. So, I would like to know if there any suggestion how to resolve this.
Best Regards,
Jo98. fft, frf, plot MATLAB Answers — New Questions
What to change in the given code for Plotting SPR curve between R and wavelength?
In this code Drude model is used to calculate the complex permitivity of metal. After running this 100% reflectivity is coming.Kindly tell what other changes is required? Here is code:
clear all
close all
c = 299792458; % Speed of light (m/s)
lambda = linspace(200e-9, 1000e-9, 200);
%twopic = 1.883651567308853e+09; % twopic=2*pi*c where c is speed of light
%omegalight = twopic*(lambda.^(-1)); % angular frequency of light (rad/s)
invsqrt2 = 0.707106781186547; % 1/sqrt(2)
ehbar = 1.51926751447914e+015; % e/hbar where hbar=h/(2*pi) and e=1.6e-19
omegap = 9.03*ehbar;
gamma=1e10;
n_prism = 1.7786;
theta=37.2;
THETA = theta / 180 * pi;
d_gold = 50e-9;
n_subphase=1.33;
en = [n_prism, n_subphase];
ek = [0, 0];
er=en(1)^2-ek(1)^2;
ei=2*en(1)*ek(1);
e(1)=complex(er,ei);
er=en(2)^2-ek(2)^2;
ei=2*en(2)*ek(2);
e(2)=complex(er,ei);
q1=sqrt(e(1)-en(1)^2*sin(THETA)^2)/e(1);
q2=sqrt(e(2)-en(1)^2*sin(THETA)^2)/e(2);
% Pre-allocate epsilon array
epsilon_values = zeros(1, length(lambda)); % Array to store 200 epsilon values
beta_values = zeros(1, length(lambda)); % Array to store 200 beta values
q_values=zeros(1,length(lambda));
em = zeros(length(lambda), 2, 2);
% Loop over each wavelength
for j = 1:length(lambda)
lambda1 = lambda(j); % Current wavelength
omegal = 2 * pi * c / lambda1; % Angular frequency for the current wavelength
% Calculate epsilon using the Drude model
epsilon_D = 1 – (omegap^2) / (omegal^2 + 1i * gamma * omegal);
epsilon_values(j) = epsilon_D; % Store the epsilon value
% Calculate beta for the current epsilon
beta = (d_gold * 2 * pi / lambda1) * sqrt(epsilon_D – en(1)^2 * sin(THETA)^2);
beta_values(j) = beta; % Store the beta value
q=sqrt(epsilon_D-en(1)^2*sin(THETA)^2)/epsilon_D;
q_values(j)=q;
% Fill the em matrix components
em(j, 1, 1) = cos(beta);
em(j, 1, 2) = -1i * sin(beta) / q;
em(j, 2, 1) = -1i * sin(beta) * q;
em(j, 2, 2) = cos(beta);
end
% Initialize the total transfer matrix
emtot = eye(2); % 2×2 Identity matrix
% Loop to compute the total transfer matrix emtot
for j = 2:(length(epsilon_values) – 1)
emtot1 = squeeze(em(j, :, :)); % Extract em(j, :, 🙂
emtot = emtot * emtot1;
end
for j = 1:length(lambda)
rp = ((emtot(1, 1) + emtot(1, 2) * q2) * q1 – (emtot(2, 1) + emtot(2, 2) * q2)) / …
((emtot(1, 1) + emtot(1, 2) * q2) * q1 + (emtot(2, 1) + emtot(2, 2) * q2));
ref_values(j) = abs(rp)^2; % Reflectance
end
% Plot reflectance vs wavelength
figure;
plot(lambda * 1e9, ref_values); % Convert lambda to nm for plotting
xlabel(‘Wavelength (nm)’, ‘FontSize’, 12);
ylabel(‘Reflectance (R)’, ‘FontSize’, 12);
title(‘Reflectance vs Wavelength’, ‘FontSize’, 14);
grid on;In this code Drude model is used to calculate the complex permitivity of metal. After running this 100% reflectivity is coming.Kindly tell what other changes is required? Here is code:
clear all
close all
c = 299792458; % Speed of light (m/s)
lambda = linspace(200e-9, 1000e-9, 200);
%twopic = 1.883651567308853e+09; % twopic=2*pi*c where c is speed of light
%omegalight = twopic*(lambda.^(-1)); % angular frequency of light (rad/s)
invsqrt2 = 0.707106781186547; % 1/sqrt(2)
ehbar = 1.51926751447914e+015; % e/hbar where hbar=h/(2*pi) and e=1.6e-19
omegap = 9.03*ehbar;
gamma=1e10;
n_prism = 1.7786;
theta=37.2;
THETA = theta / 180 * pi;
d_gold = 50e-9;
n_subphase=1.33;
en = [n_prism, n_subphase];
ek = [0, 0];
er=en(1)^2-ek(1)^2;
ei=2*en(1)*ek(1);
e(1)=complex(er,ei);
er=en(2)^2-ek(2)^2;
ei=2*en(2)*ek(2);
e(2)=complex(er,ei);
q1=sqrt(e(1)-en(1)^2*sin(THETA)^2)/e(1);
q2=sqrt(e(2)-en(1)^2*sin(THETA)^2)/e(2);
% Pre-allocate epsilon array
epsilon_values = zeros(1, length(lambda)); % Array to store 200 epsilon values
beta_values = zeros(1, length(lambda)); % Array to store 200 beta values
q_values=zeros(1,length(lambda));
em = zeros(length(lambda), 2, 2);
% Loop over each wavelength
for j = 1:length(lambda)
lambda1 = lambda(j); % Current wavelength
omegal = 2 * pi * c / lambda1; % Angular frequency for the current wavelength
% Calculate epsilon using the Drude model
epsilon_D = 1 – (omegap^2) / (omegal^2 + 1i * gamma * omegal);
epsilon_values(j) = epsilon_D; % Store the epsilon value
% Calculate beta for the current epsilon
beta = (d_gold * 2 * pi / lambda1) * sqrt(epsilon_D – en(1)^2 * sin(THETA)^2);
beta_values(j) = beta; % Store the beta value
q=sqrt(epsilon_D-en(1)^2*sin(THETA)^2)/epsilon_D;
q_values(j)=q;
% Fill the em matrix components
em(j, 1, 1) = cos(beta);
em(j, 1, 2) = -1i * sin(beta) / q;
em(j, 2, 1) = -1i * sin(beta) * q;
em(j, 2, 2) = cos(beta);
end
% Initialize the total transfer matrix
emtot = eye(2); % 2×2 Identity matrix
% Loop to compute the total transfer matrix emtot
for j = 2:(length(epsilon_values) – 1)
emtot1 = squeeze(em(j, :, :)); % Extract em(j, :, 🙂
emtot = emtot * emtot1;
end
for j = 1:length(lambda)
rp = ((emtot(1, 1) + emtot(1, 2) * q2) * q1 – (emtot(2, 1) + emtot(2, 2) * q2)) / …
((emtot(1, 1) + emtot(1, 2) * q2) * q1 + (emtot(2, 1) + emtot(2, 2) * q2));
ref_values(j) = abs(rp)^2; % Reflectance
end
% Plot reflectance vs wavelength
figure;
plot(lambda * 1e9, ref_values); % Convert lambda to nm for plotting
xlabel(‘Wavelength (nm)’, ‘FontSize’, 12);
ylabel(‘Reflectance (R)’, ‘FontSize’, 12);
title(‘Reflectance vs Wavelength’, ‘FontSize’, 14);
grid on; In this code Drude model is used to calculate the complex permitivity of metal. After running this 100% reflectivity is coming.Kindly tell what other changes is required? Here is code:
clear all
close all
c = 299792458; % Speed of light (m/s)
lambda = linspace(200e-9, 1000e-9, 200);
%twopic = 1.883651567308853e+09; % twopic=2*pi*c where c is speed of light
%omegalight = twopic*(lambda.^(-1)); % angular frequency of light (rad/s)
invsqrt2 = 0.707106781186547; % 1/sqrt(2)
ehbar = 1.51926751447914e+015; % e/hbar where hbar=h/(2*pi) and e=1.6e-19
omegap = 9.03*ehbar;
gamma=1e10;
n_prism = 1.7786;
theta=37.2;
THETA = theta / 180 * pi;
d_gold = 50e-9;
n_subphase=1.33;
en = [n_prism, n_subphase];
ek = [0, 0];
er=en(1)^2-ek(1)^2;
ei=2*en(1)*ek(1);
e(1)=complex(er,ei);
er=en(2)^2-ek(2)^2;
ei=2*en(2)*ek(2);
e(2)=complex(er,ei);
q1=sqrt(e(1)-en(1)^2*sin(THETA)^2)/e(1);
q2=sqrt(e(2)-en(1)^2*sin(THETA)^2)/e(2);
% Pre-allocate epsilon array
epsilon_values = zeros(1, length(lambda)); % Array to store 200 epsilon values
beta_values = zeros(1, length(lambda)); % Array to store 200 beta values
q_values=zeros(1,length(lambda));
em = zeros(length(lambda), 2, 2);
% Loop over each wavelength
for j = 1:length(lambda)
lambda1 = lambda(j); % Current wavelength
omegal = 2 * pi * c / lambda1; % Angular frequency for the current wavelength
% Calculate epsilon using the Drude model
epsilon_D = 1 – (omegap^2) / (omegal^2 + 1i * gamma * omegal);
epsilon_values(j) = epsilon_D; % Store the epsilon value
% Calculate beta for the current epsilon
beta = (d_gold * 2 * pi / lambda1) * sqrt(epsilon_D – en(1)^2 * sin(THETA)^2);
beta_values(j) = beta; % Store the beta value
q=sqrt(epsilon_D-en(1)^2*sin(THETA)^2)/epsilon_D;
q_values(j)=q;
% Fill the em matrix components
em(j, 1, 1) = cos(beta);
em(j, 1, 2) = -1i * sin(beta) / q;
em(j, 2, 1) = -1i * sin(beta) * q;
em(j, 2, 2) = cos(beta);
end
% Initialize the total transfer matrix
emtot = eye(2); % 2×2 Identity matrix
% Loop to compute the total transfer matrix emtot
for j = 2:(length(epsilon_values) – 1)
emtot1 = squeeze(em(j, :, :)); % Extract em(j, :, 🙂
emtot = emtot * emtot1;
end
for j = 1:length(lambda)
rp = ((emtot(1, 1) + emtot(1, 2) * q2) * q1 – (emtot(2, 1) + emtot(2, 2) * q2)) / …
((emtot(1, 1) + emtot(1, 2) * q2) * q1 + (emtot(2, 1) + emtot(2, 2) * q2));
ref_values(j) = abs(rp)^2; % Reflectance
end
% Plot reflectance vs wavelength
figure;
plot(lambda * 1e9, ref_values); % Convert lambda to nm for plotting
xlabel(‘Wavelength (nm)’, ‘FontSize’, 12);
ylabel(‘Reflectance (R)’, ‘FontSize’, 12);
title(‘Reflectance vs Wavelength’, ‘FontSize’, 14);
grid on; spr plot MATLAB Answers — New Questions
[Simulink Support Package for Arduino Hardware] CAN Recieve Block issue
Hello,
I am a student currently using the Simulink Support Package for Arduino Hardware to implement CAN communication.
The issue I am facing is that the CAN Receive block does not receive any data when messages are sent using an Extended ID. I am using an Arduino MKR WiFi 1010 along with the MKR CAN Shield. My Simulink model is used to send CAN messages to a motor and receive CAN messages from the motor.
The Simulink model (I attach the file.) I created, along with the configurations for the CAN Transmit and CAN Receive blocks, which are shown below. (The Fixed Step Size is set to 0.002.)
To verify the transmitted values, I used a ‘USB to CAN Analyzer’. (link: https://www.seeedstudio.com/USB-CAN-Analyzer-p-2888.html?srsltid=AfmBOooUz103F-Q3hiV6ocaQKvJwR2POvokjnFucYIHxf77tjr7DDkJe) As a result, I confirmed that messages with Extended IDs 0x302 (=770)and 0x2902 (10498) exist on the bus. (0x302: Arduino transmit, 0x2902 Arduino receive)
However, when checking the results from the To Workspace block, I found that no data is being received, unlike what I observed with the USB CAN Analyzer.
To rule out a hardware issue, I also tested with the MATLAB Support Package for Arduino Hardware, and it worked correctly. The MATLAB code (attached) successfully received messages.
clear arduinoMKRObj;
clear rxObj1;
%% MKR
arduinoMKRObj = arduino(‘COM18′,’MKR1010′,’Libraries’,’CAN’)
rxObj1 = canChannel(arduinoMKRObj, ‘MKR CAN Shield’,"BusSpeed", 1000e3)
runtime = 10; % time to read (s)
tic; % start reading
while toc < runtime
% read data
readMsg = read(rxObj1);
if ~isempty(readMsg)
disp(‘Data received:’);
disp(readMsg);
else
disp(‘No data received’);
end
end
What should I do next? Could this be a Simulink-related issue? Any help would be greatly appreciated.
Thank you.Hello,
I am a student currently using the Simulink Support Package for Arduino Hardware to implement CAN communication.
The issue I am facing is that the CAN Receive block does not receive any data when messages are sent using an Extended ID. I am using an Arduino MKR WiFi 1010 along with the MKR CAN Shield. My Simulink model is used to send CAN messages to a motor and receive CAN messages from the motor.
The Simulink model (I attach the file.) I created, along with the configurations for the CAN Transmit and CAN Receive blocks, which are shown below. (The Fixed Step Size is set to 0.002.)
To verify the transmitted values, I used a ‘USB to CAN Analyzer’. (link: https://www.seeedstudio.com/USB-CAN-Analyzer-p-2888.html?srsltid=AfmBOooUz103F-Q3hiV6ocaQKvJwR2POvokjnFucYIHxf77tjr7DDkJe) As a result, I confirmed that messages with Extended IDs 0x302 (=770)and 0x2902 (10498) exist on the bus. (0x302: Arduino transmit, 0x2902 Arduino receive)
However, when checking the results from the To Workspace block, I found that no data is being received, unlike what I observed with the USB CAN Analyzer.
To rule out a hardware issue, I also tested with the MATLAB Support Package for Arduino Hardware, and it worked correctly. The MATLAB code (attached) successfully received messages.
clear arduinoMKRObj;
clear rxObj1;
%% MKR
arduinoMKRObj = arduino(‘COM18′,’MKR1010′,’Libraries’,’CAN’)
rxObj1 = canChannel(arduinoMKRObj, ‘MKR CAN Shield’,"BusSpeed", 1000e3)
runtime = 10; % time to read (s)
tic; % start reading
while toc < runtime
% read data
readMsg = read(rxObj1);
if ~isempty(readMsg)
disp(‘Data received:’);
disp(readMsg);
else
disp(‘No data received’);
end
end
What should I do next? Could this be a Simulink-related issue? Any help would be greatly appreciated.
Thank you. Hello,
I am a student currently using the Simulink Support Package for Arduino Hardware to implement CAN communication.
The issue I am facing is that the CAN Receive block does not receive any data when messages are sent using an Extended ID. I am using an Arduino MKR WiFi 1010 along with the MKR CAN Shield. My Simulink model is used to send CAN messages to a motor and receive CAN messages from the motor.
The Simulink model (I attach the file.) I created, along with the configurations for the CAN Transmit and CAN Receive blocks, which are shown below. (The Fixed Step Size is set to 0.002.)
To verify the transmitted values, I used a ‘USB to CAN Analyzer’. (link: https://www.seeedstudio.com/USB-CAN-Analyzer-p-2888.html?srsltid=AfmBOooUz103F-Q3hiV6ocaQKvJwR2POvokjnFucYIHxf77tjr7DDkJe) As a result, I confirmed that messages with Extended IDs 0x302 (=770)and 0x2902 (10498) exist on the bus. (0x302: Arduino transmit, 0x2902 Arduino receive)
However, when checking the results from the To Workspace block, I found that no data is being received, unlike what I observed with the USB CAN Analyzer.
To rule out a hardware issue, I also tested with the MATLAB Support Package for Arduino Hardware, and it worked correctly. The MATLAB code (attached) successfully received messages.
clear arduinoMKRObj;
clear rxObj1;
%% MKR
arduinoMKRObj = arduino(‘COM18′,’MKR1010′,’Libraries’,’CAN’)
rxObj1 = canChannel(arduinoMKRObj, ‘MKR CAN Shield’,"BusSpeed", 1000e3)
runtime = 10; % time to read (s)
tic; % start reading
while toc < runtime
% read data
readMsg = read(rxObj1);
if ~isempty(readMsg)
disp(‘Data received:’);
disp(readMsg);
else
disp(‘No data received’);
end
end
What should I do next? Could this be a Simulink-related issue? Any help would be greatly appreciated.
Thank you. simulink, simulink support package for arduino hardware, can, can recieve MATLAB Answers — New Questions
step by step running of matlab
hello, is there a way of running matlab, so I can see each step it does.
I would like to point out that I want to see any action it does.
for example, if there is a row in which it refers to a function, so I want matlab to show me what happens in any row of the function, what the variables are etc.
thankshello, is there a way of running matlab, so I can see each step it does.
I would like to point out that I want to see any action it does.
for example, if there is a row in which it refers to a function, so I want matlab to show me what happens in any row of the function, what the variables are etc.
thanks hello, is there a way of running matlab, so I can see each step it does.
I would like to point out that I want to see any action it does.
for example, if there is a row in which it refers to a function, so I want matlab to show me what happens in any row of the function, what the variables are etc.
thanks step by step running MATLAB Answers — New Questions
How to call a function within a class in legacy code tool structure?
Hello,
I do have a .cpp file that I want to integrate with Matlab through legacy code tool. My original code involves functions defined within a class, what is the proper way to write "def.OutputFcnSpec" command?Hello,
I do have a .cpp file that I want to integrate with Matlab through legacy code tool. My original code involves functions defined within a class, what is the proper way to write "def.OutputFcnSpec" command? Hello,
I do have a .cpp file that I want to integrate with Matlab through legacy code tool. My original code involves functions defined within a class, what is the proper way to write "def.OutputFcnSpec" command? legacy, c++ MATLAB Answers — New Questions
How does one factor a SISO transfer function?
I’d like a function that factors SISO transfer functions to a series of second and first order transfer functions. Is there a Matlab function that accomplishes that?I’d like a function that factors SISO transfer functions to a series of second and first order transfer functions. Is there a Matlab function that accomplishes that? I’d like a function that factors SISO transfer functions to a series of second and first order transfer functions. Is there a Matlab function that accomplishes that? transfer function, siso, factoring MATLAB Answers — New Questions
Exception in thread “AWT-EventQueue-0”: java.lang.RuntimeException: java.lang.NoClassDefFoundError:
Hola, cada vez que trato de abrir un nuevo script en mathlab me aparece este error, no lo puedo usar desde que lo instale. Alguien sabe como arreglarlo?
Hi, every time I try to open a new script it promps this error, I can’t use mathlab at all, does anybody know how to fix it?
Exception in thread "AWT-EventQueue-0": java.lang.RuntimeException: java.lang.NoClassDefFoundError: com/mathworks/toolbox/eml/EmlStorageLocation
at com.mathworks.mde.editor.EditorUtils.invokeAndWait(EditorUtils.java:574)
at com.mathworks.mde.editor.MatlabEditorApplication.newEditor(MatlabEditorApplication.java:119)
at com.mathworks.mde.desk.MLDesktop$NewMFileAction.actionPerformed(MLDesktop.java:2831)
at com.mathworks.mwswing.ChildAction.actionPerformed(ChildAction.java:214)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
at com.mathworks.toolstrip.plaf.RegularButtonUI$RegularToolstripButtonListener.mouseReleasedImpl(RegularButtonUI.java:364)
at com.mathworks.toolstrip.plaf.RegularButtonUI$RegularToolstripButtonListener.mouseReleased(RegularButtonUI.java:354)
at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:289)
at java.awt.Component.processMouseEvent(Component.java:6539)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)
at com.mathworks.mwswing.MJButton.processMouseEvent(MJButton.java:350)
at java.awt.Component.processEvent(Component.java:6304)
at java.awt.Container.processEvent(Container.java:2239)
at java.awt.Component.dispatchEventImpl(Component.java:4889)
at java.awt.Container.dispatchEventImpl(Container.java:2297)
at java.awt.Component.dispatchEvent(Component.java:4711)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4904)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4535)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4476)
at java.awt.Container.dispatchEventImpl(Container.java:2283)
at java.awt.Window.dispatchEventImpl(Window.java:2746)
at java.awt.Component.dispatchEvent(Component.java:4711)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:760)
at java.awt.EventQueue.access$500(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.awt.EventQueue$3.run(EventQueue.java:703)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:84)
at java.awt.EventQueue$4.run(EventQueue.java:733)
at java.awt.EventQueue$4.run(EventQueue.java:731)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:730)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
Caused by: java.lang.NoClassDefFoundError: com/mathworks/toolbox/eml/EmlStorageLocation
at com.mathworks.toolbox.eml.breakpoints.EmlMarginProvider.isApplicable(EmlMarginProvider.java:21)
at com.mathworks.mde.editor.EditorView.getApplicableMarginProviders(EditorView.java:252)
at com.mathworks.mde.editor.EditorView.initSyntaxTextPane(EditorView.java:885)
at com.mathworks.mde.editor.EditorView.<init>(EditorView.java:222)
at com.mathworks.mde.editor.EditorView.<init>(EditorView.java:153)
at com.mathworks.mde.editor.EditorViewClient.init(EditorViewClient.java:234)
at com.mathworks.mde.editor.EditorViewClient.<init>(EditorViewClient.java:178)
at com.mathworks.mde.editor.MatlabEditorApplication.createEditorViewClient(MatlabEditorApplication.java:704)
at com.mathworks.mde.editor.MatlabEditorApplication.createEditorViewClient(MatlabEditorApplication.java:689)
at com.mathworks.mde.editor.MatlabEditorApplication.createBufferEditorViewClient(MatlabEditorApplication.java:611)
at com.mathworks.mde.editor.MatlabEditorApplication.doNewEditor(MatlabEditorApplication.java:381)
at com.mathworks.mde.editor.MatlabEditorApplication.access$000(MatlabEditorApplication.java:77)
at com.mathworks.mde.editor.MatlabEditorApplication$1.runWithOutput(MatlabEditorApplication.java:123)
at com.mathworks.jmi.AWTUtilities$Invoker$2.watchedRun(AWTUtilities.java:475)
at com.mathworks.jmi.AWTUtilities$WatchedRunnable.run(AWTUtilities.java:436)
at com.mathworks.jmi.AWTUtilities$Invoker.invoke(AWTUtilities.java:490)
at com.mathworks.jmi.AWTUtilities.invokeAndWait(AWTUtilities.java:351)
at com.mathworks.mde.editor.EditorUtils.invokeAndWait(EditorUtils.java:570)
… 42 moreHola, cada vez que trato de abrir un nuevo script en mathlab me aparece este error, no lo puedo usar desde que lo instale. Alguien sabe como arreglarlo?
Hi, every time I try to open a new script it promps this error, I can’t use mathlab at all, does anybody know how to fix it?
Exception in thread "AWT-EventQueue-0": java.lang.RuntimeException: java.lang.NoClassDefFoundError: com/mathworks/toolbox/eml/EmlStorageLocation
at com.mathworks.mde.editor.EditorUtils.invokeAndWait(EditorUtils.java:574)
at com.mathworks.mde.editor.MatlabEditorApplication.newEditor(MatlabEditorApplication.java:119)
at com.mathworks.mde.desk.MLDesktop$NewMFileAction.actionPerformed(MLDesktop.java:2831)
at com.mathworks.mwswing.ChildAction.actionPerformed(ChildAction.java:214)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
at com.mathworks.toolstrip.plaf.RegularButtonUI$RegularToolstripButtonListener.mouseReleasedImpl(RegularButtonUI.java:364)
at com.mathworks.toolstrip.plaf.RegularButtonUI$RegularToolstripButtonListener.mouseReleased(RegularButtonUI.java:354)
at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:289)
at java.awt.Component.processMouseEvent(Component.java:6539)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)
at com.mathworks.mwswing.MJButton.processMouseEvent(MJButton.java:350)
at java.awt.Component.processEvent(Component.java:6304)
at java.awt.Container.processEvent(Container.java:2239)
at java.awt.Component.dispatchEventImpl(Component.java:4889)
at java.awt.Container.dispatchEventImpl(Container.java:2297)
at java.awt.Component.dispatchEvent(Component.java:4711)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4904)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4535)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4476)
at java.awt.Container.dispatchEventImpl(Container.java:2283)
at java.awt.Window.dispatchEventImpl(Window.java:2746)
at java.awt.Component.dispatchEvent(Component.java:4711)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:760)
at java.awt.EventQueue.access$500(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.awt.EventQueue$3.run(EventQueue.java:703)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:84)
at java.awt.EventQueue$4.run(EventQueue.java:733)
at java.awt.EventQueue$4.run(EventQueue.java:731)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:730)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
Caused by: java.lang.NoClassDefFoundError: com/mathworks/toolbox/eml/EmlStorageLocation
at com.mathworks.toolbox.eml.breakpoints.EmlMarginProvider.isApplicable(EmlMarginProvider.java:21)
at com.mathworks.mde.editor.EditorView.getApplicableMarginProviders(EditorView.java:252)
at com.mathworks.mde.editor.EditorView.initSyntaxTextPane(EditorView.java:885)
at com.mathworks.mde.editor.EditorView.<init>(EditorView.java:222)
at com.mathworks.mde.editor.EditorView.<init>(EditorView.java:153)
at com.mathworks.mde.editor.EditorViewClient.init(EditorViewClient.java:234)
at com.mathworks.mde.editor.EditorViewClient.<init>(EditorViewClient.java:178)
at com.mathworks.mde.editor.MatlabEditorApplication.createEditorViewClient(MatlabEditorApplication.java:704)
at com.mathworks.mde.editor.MatlabEditorApplication.createEditorViewClient(MatlabEditorApplication.java:689)
at com.mathworks.mde.editor.MatlabEditorApplication.createBufferEditorViewClient(MatlabEditorApplication.java:611)
at com.mathworks.mde.editor.MatlabEditorApplication.doNewEditor(MatlabEditorApplication.java:381)
at com.mathworks.mde.editor.MatlabEditorApplication.access$000(MatlabEditorApplication.java:77)
at com.mathworks.mde.editor.MatlabEditorApplication$1.runWithOutput(MatlabEditorApplication.java:123)
at com.mathworks.jmi.AWTUtilities$Invoker$2.watchedRun(AWTUtilities.java:475)
at com.mathworks.jmi.AWTUtilities$WatchedRunnable.run(AWTUtilities.java:436)
at com.mathworks.jmi.AWTUtilities$Invoker.invoke(AWTUtilities.java:490)
at com.mathworks.jmi.AWTUtilities.invokeAndWait(AWTUtilities.java:351)
at com.mathworks.mde.editor.EditorUtils.invokeAndWait(EditorUtils.java:570)
… 42 more Hola, cada vez que trato de abrir un nuevo script en mathlab me aparece este error, no lo puedo usar desde que lo instale. Alguien sabe como arreglarlo?
Hi, every time I try to open a new script it promps this error, I can’t use mathlab at all, does anybody know how to fix it?
Exception in thread "AWT-EventQueue-0": java.lang.RuntimeException: java.lang.NoClassDefFoundError: com/mathworks/toolbox/eml/EmlStorageLocation
at com.mathworks.mde.editor.EditorUtils.invokeAndWait(EditorUtils.java:574)
at com.mathworks.mde.editor.MatlabEditorApplication.newEditor(MatlabEditorApplication.java:119)
at com.mathworks.mde.desk.MLDesktop$NewMFileAction.actionPerformed(MLDesktop.java:2831)
at com.mathworks.mwswing.ChildAction.actionPerformed(ChildAction.java:214)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
at com.mathworks.toolstrip.plaf.RegularButtonUI$RegularToolstripButtonListener.mouseReleasedImpl(RegularButtonUI.java:364)
at com.mathworks.toolstrip.plaf.RegularButtonUI$RegularToolstripButtonListener.mouseReleased(RegularButtonUI.java:354)
at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:289)
at java.awt.Component.processMouseEvent(Component.java:6539)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)
at com.mathworks.mwswing.MJButton.processMouseEvent(MJButton.java:350)
at java.awt.Component.processEvent(Component.java:6304)
at java.awt.Container.processEvent(Container.java:2239)
at java.awt.Component.dispatchEventImpl(Component.java:4889)
at java.awt.Container.dispatchEventImpl(Container.java:2297)
at java.awt.Component.dispatchEvent(Component.java:4711)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4904)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4535)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4476)
at java.awt.Container.dispatchEventImpl(Container.java:2283)
at java.awt.Window.dispatchEventImpl(Window.java:2746)
at java.awt.Component.dispatchEvent(Component.java:4711)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:760)
at java.awt.EventQueue.access$500(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.awt.EventQueue$3.run(EventQueue.java:703)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:84)
at java.awt.EventQueue$4.run(EventQueue.java:733)
at java.awt.EventQueue$4.run(EventQueue.java:731)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:730)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
Caused by: java.lang.NoClassDefFoundError: com/mathworks/toolbox/eml/EmlStorageLocation
at com.mathworks.toolbox.eml.breakpoints.EmlMarginProvider.isApplicable(EmlMarginProvider.java:21)
at com.mathworks.mde.editor.EditorView.getApplicableMarginProviders(EditorView.java:252)
at com.mathworks.mde.editor.EditorView.initSyntaxTextPane(EditorView.java:885)
at com.mathworks.mde.editor.EditorView.<init>(EditorView.java:222)
at com.mathworks.mde.editor.EditorView.<init>(EditorView.java:153)
at com.mathworks.mde.editor.EditorViewClient.init(EditorViewClient.java:234)
at com.mathworks.mde.editor.EditorViewClient.<init>(EditorViewClient.java:178)
at com.mathworks.mde.editor.MatlabEditorApplication.createEditorViewClient(MatlabEditorApplication.java:704)
at com.mathworks.mde.editor.MatlabEditorApplication.createEditorViewClient(MatlabEditorApplication.java:689)
at com.mathworks.mde.editor.MatlabEditorApplication.createBufferEditorViewClient(MatlabEditorApplication.java:611)
at com.mathworks.mde.editor.MatlabEditorApplication.doNewEditor(MatlabEditorApplication.java:381)
at com.mathworks.mde.editor.MatlabEditorApplication.access$000(MatlabEditorApplication.java:77)
at com.mathworks.mde.editor.MatlabEditorApplication$1.runWithOutput(MatlabEditorApplication.java:123)
at com.mathworks.jmi.AWTUtilities$Invoker$2.watchedRun(AWTUtilities.java:475)
at com.mathworks.jmi.AWTUtilities$WatchedRunnable.run(AWTUtilities.java:436)
at com.mathworks.jmi.AWTUtilities$Invoker.invoke(AWTUtilities.java:490)
at com.mathworks.jmi.AWTUtilities.invokeAndWait(AWTUtilities.java:351)
at com.mathworks.mde.editor.EditorUtils.invokeAndWait(EditorUtils.java:570)
… 42 more awt-eventqueue MATLAB Answers — New Questions
Solving a DAE system: Error using decic function. index greater than 1 despite isLowIndexDAE = TRUE
I am trying to solve a system of DAEs that emerge in a constrained optimal control problem. I cannot find the consistent initial conditions. The error I get when looking for them using decic is that the index may be larger than 1, even though the isLowIndexDAE indicates that index is low. The error message is:
Error using decic>sls (line 170)
Index may be greater than one.
Error in decic (line 77)
[dy,dyp] = sls(res,dfdy,dfdyp,neq,free_y,free_yp);|
The variables psi1 and psi2 are the lagrange multipliers on two constraints: XB(t)>=0 and HW(t)=<1. Equations 6 and 7 are conseqiuently the complementary slackness conditions. I want to find the initial conditions in which both of these constraints bind, hence my guesses XB0=0 and HW0=1. Guesses for a few other variables follow. I tried relaxing the fixed guesses (and fix the relaxed ones) in the decic function in many different ways, but if I do that, then the only result is that I get a different error, for example:
Error using decic>sls (line 168)
Try freeing 7 fixed components.
Error in decic (line 77)
[dy,dyp] = sls(res,dfdy,dfdyp,neq,free_y,free_yp);
Error in ode_mathtoolbox (line 64)
[y0, yp0] = decic(F, 0, y0est, [0,1,1,1,0,1,1], yp0est, [0,0,1,1,0,0,0], opt)
My code is:
clear all
syms XB(t) HW(t) A(t) N(t) mu(t) psi1(t) psi2(t) …
rho nu n alpha alphahat chi lam phi delta s
eqn1 = N(t)/(A(t)*(1-s)*HW(t)*N(t)*alphahat – XB(t)) == (1-HW(t))*(1-nu)*(XB(t))^(-nu)+psi1(t);
eqn2 = (N(t)/(A(t)*(1-s)*HW(t)*N(t)*alphahat – XB(t)))*(A(t)*(1-s)*N(t)*alphahat) == XB(t)^(1-nu) – mu(t)*delta*lam*(A(t)^(phi))*((s*N(t))^lam)*(HW(t)^(lam-1)) + psi2(t);
eqn3 = diff(A(t), 1) == delta*(A(t)^phi)*(s*N(t)*HW(t))^lam;
eqn4 = diff(N(t), 1) == n*N(t);
eqn5 = diff(mu(t),1) == -(1-HW(t))*(1-nu)*(XB(t)^(-nu))*(1-s)*HW(t)*N(t)*alphahat + mu(t)*delta*phi*((A(t))^(phi-1))*(s*HW(t)*N)^lam + rho*mu(t);
eqn6 = XB(t)*psi1(t) == 0;
eqn7 = (1-HW(t))*psi2(t) == 0;
eqns = [eqn1 eqn2 eqn3 eqn4 eqn5 eqn6 eqn7];
vars = [XB(t), HW(t), A(t), N(t), mu(t), psi1(t), psi2(t)];
origVars = length(vars)
M = incidenceMatrix(eqns, vars)
isLowIndexDAE(eqns,vars)
[DAEs,DAEvars] = reduceDAEIndex(eqns,vars);
[DAEs,DAEvars] = reduceRedundancies(DAEs,DAEvars);
isLowIndexDAE(DAEs,DAEvars)
pDAEs = symvar(DAEs);
pDAEvars = symvar(DAEvars);
extraParams = setdiff(pDAEs, pDAEvars);
f = daeFunction(DAEs, DAEvars, alphahat, delta, lam, n, nu, phi, rho, s);
rho = 0.02;
nu = 0.9;
n = 0.01;
alpha = 0.33;
chi = 0.05;
lam = 0.65;
phi = 0.65;
delta = 0.057;
s = 0.2;
alphahat = alpha^(alpha/(1-alpha))-alpha^(1/(1-alpha));
F = @(t,Y,YP) f(t, Y, YP, alphahat, delta, lam, n, nu, phi, rho, s);
DAEvars
XB0 = 0;
HW0 = 1;
A0 = 1;
N0 = 1;
mu0 = 0;
y0est = [XB0; HW0; A0; N0; mu0; 1/(A0*(1-s)*N0*alphahat); 1+mu0*delta*lam*s*((A0)^phi)*(N0^lam)];
yp0est = [0,0,delta*(s^lam),n,0,0,0];
opt = odeset(‘RelTol’, 10.0^(-7), ‘AbsTol’ , 10.0^(-7));
[y0, yp0] = decic(F, 0, y0est, [0,0,0,1,0,0,0], yp0est, [0,0,0,0,0,0,0], opt)I am trying to solve a system of DAEs that emerge in a constrained optimal control problem. I cannot find the consistent initial conditions. The error I get when looking for them using decic is that the index may be larger than 1, even though the isLowIndexDAE indicates that index is low. The error message is:
Error using decic>sls (line 170)
Index may be greater than one.
Error in decic (line 77)
[dy,dyp] = sls(res,dfdy,dfdyp,neq,free_y,free_yp);|
The variables psi1 and psi2 are the lagrange multipliers on two constraints: XB(t)>=0 and HW(t)=<1. Equations 6 and 7 are conseqiuently the complementary slackness conditions. I want to find the initial conditions in which both of these constraints bind, hence my guesses XB0=0 and HW0=1. Guesses for a few other variables follow. I tried relaxing the fixed guesses (and fix the relaxed ones) in the decic function in many different ways, but if I do that, then the only result is that I get a different error, for example:
Error using decic>sls (line 168)
Try freeing 7 fixed components.
Error in decic (line 77)
[dy,dyp] = sls(res,dfdy,dfdyp,neq,free_y,free_yp);
Error in ode_mathtoolbox (line 64)
[y0, yp0] = decic(F, 0, y0est, [0,1,1,1,0,1,1], yp0est, [0,0,1,1,0,0,0], opt)
My code is:
clear all
syms XB(t) HW(t) A(t) N(t) mu(t) psi1(t) psi2(t) …
rho nu n alpha alphahat chi lam phi delta s
eqn1 = N(t)/(A(t)*(1-s)*HW(t)*N(t)*alphahat – XB(t)) == (1-HW(t))*(1-nu)*(XB(t))^(-nu)+psi1(t);
eqn2 = (N(t)/(A(t)*(1-s)*HW(t)*N(t)*alphahat – XB(t)))*(A(t)*(1-s)*N(t)*alphahat) == XB(t)^(1-nu) – mu(t)*delta*lam*(A(t)^(phi))*((s*N(t))^lam)*(HW(t)^(lam-1)) + psi2(t);
eqn3 = diff(A(t), 1) == delta*(A(t)^phi)*(s*N(t)*HW(t))^lam;
eqn4 = diff(N(t), 1) == n*N(t);
eqn5 = diff(mu(t),1) == -(1-HW(t))*(1-nu)*(XB(t)^(-nu))*(1-s)*HW(t)*N(t)*alphahat + mu(t)*delta*phi*((A(t))^(phi-1))*(s*HW(t)*N)^lam + rho*mu(t);
eqn6 = XB(t)*psi1(t) == 0;
eqn7 = (1-HW(t))*psi2(t) == 0;
eqns = [eqn1 eqn2 eqn3 eqn4 eqn5 eqn6 eqn7];
vars = [XB(t), HW(t), A(t), N(t), mu(t), psi1(t), psi2(t)];
origVars = length(vars)
M = incidenceMatrix(eqns, vars)
isLowIndexDAE(eqns,vars)
[DAEs,DAEvars] = reduceDAEIndex(eqns,vars);
[DAEs,DAEvars] = reduceRedundancies(DAEs,DAEvars);
isLowIndexDAE(DAEs,DAEvars)
pDAEs = symvar(DAEs);
pDAEvars = symvar(DAEvars);
extraParams = setdiff(pDAEs, pDAEvars);
f = daeFunction(DAEs, DAEvars, alphahat, delta, lam, n, nu, phi, rho, s);
rho = 0.02;
nu = 0.9;
n = 0.01;
alpha = 0.33;
chi = 0.05;
lam = 0.65;
phi = 0.65;
delta = 0.057;
s = 0.2;
alphahat = alpha^(alpha/(1-alpha))-alpha^(1/(1-alpha));
F = @(t,Y,YP) f(t, Y, YP, alphahat, delta, lam, n, nu, phi, rho, s);
DAEvars
XB0 = 0;
HW0 = 1;
A0 = 1;
N0 = 1;
mu0 = 0;
y0est = [XB0; HW0; A0; N0; mu0; 1/(A0*(1-s)*N0*alphahat); 1+mu0*delta*lam*s*((A0)^phi)*(N0^lam)];
yp0est = [0,0,delta*(s^lam),n,0,0,0];
opt = odeset(‘RelTol’, 10.0^(-7), ‘AbsTol’ , 10.0^(-7));
[y0, yp0] = decic(F, 0, y0est, [0,0,0,1,0,0,0], yp0est, [0,0,0,0,0,0,0], opt) I am trying to solve a system of DAEs that emerge in a constrained optimal control problem. I cannot find the consistent initial conditions. The error I get when looking for them using decic is that the index may be larger than 1, even though the isLowIndexDAE indicates that index is low. The error message is:
Error using decic>sls (line 170)
Index may be greater than one.
Error in decic (line 77)
[dy,dyp] = sls(res,dfdy,dfdyp,neq,free_y,free_yp);|
The variables psi1 and psi2 are the lagrange multipliers on two constraints: XB(t)>=0 and HW(t)=<1. Equations 6 and 7 are conseqiuently the complementary slackness conditions. I want to find the initial conditions in which both of these constraints bind, hence my guesses XB0=0 and HW0=1. Guesses for a few other variables follow. I tried relaxing the fixed guesses (and fix the relaxed ones) in the decic function in many different ways, but if I do that, then the only result is that I get a different error, for example:
Error using decic>sls (line 168)
Try freeing 7 fixed components.
Error in decic (line 77)
[dy,dyp] = sls(res,dfdy,dfdyp,neq,free_y,free_yp);
Error in ode_mathtoolbox (line 64)
[y0, yp0] = decic(F, 0, y0est, [0,1,1,1,0,1,1], yp0est, [0,0,1,1,0,0,0], opt)
My code is:
clear all
syms XB(t) HW(t) A(t) N(t) mu(t) psi1(t) psi2(t) …
rho nu n alpha alphahat chi lam phi delta s
eqn1 = N(t)/(A(t)*(1-s)*HW(t)*N(t)*alphahat – XB(t)) == (1-HW(t))*(1-nu)*(XB(t))^(-nu)+psi1(t);
eqn2 = (N(t)/(A(t)*(1-s)*HW(t)*N(t)*alphahat – XB(t)))*(A(t)*(1-s)*N(t)*alphahat) == XB(t)^(1-nu) – mu(t)*delta*lam*(A(t)^(phi))*((s*N(t))^lam)*(HW(t)^(lam-1)) + psi2(t);
eqn3 = diff(A(t), 1) == delta*(A(t)^phi)*(s*N(t)*HW(t))^lam;
eqn4 = diff(N(t), 1) == n*N(t);
eqn5 = diff(mu(t),1) == -(1-HW(t))*(1-nu)*(XB(t)^(-nu))*(1-s)*HW(t)*N(t)*alphahat + mu(t)*delta*phi*((A(t))^(phi-1))*(s*HW(t)*N)^lam + rho*mu(t);
eqn6 = XB(t)*psi1(t) == 0;
eqn7 = (1-HW(t))*psi2(t) == 0;
eqns = [eqn1 eqn2 eqn3 eqn4 eqn5 eqn6 eqn7];
vars = [XB(t), HW(t), A(t), N(t), mu(t), psi1(t), psi2(t)];
origVars = length(vars)
M = incidenceMatrix(eqns, vars)
isLowIndexDAE(eqns,vars)
[DAEs,DAEvars] = reduceDAEIndex(eqns,vars);
[DAEs,DAEvars] = reduceRedundancies(DAEs,DAEvars);
isLowIndexDAE(DAEs,DAEvars)
pDAEs = symvar(DAEs);
pDAEvars = symvar(DAEvars);
extraParams = setdiff(pDAEs, pDAEvars);
f = daeFunction(DAEs, DAEvars, alphahat, delta, lam, n, nu, phi, rho, s);
rho = 0.02;
nu = 0.9;
n = 0.01;
alpha = 0.33;
chi = 0.05;
lam = 0.65;
phi = 0.65;
delta = 0.057;
s = 0.2;
alphahat = alpha^(alpha/(1-alpha))-alpha^(1/(1-alpha));
F = @(t,Y,YP) f(t, Y, YP, alphahat, delta, lam, n, nu, phi, rho, s);
DAEvars
XB0 = 0;
HW0 = 1;
A0 = 1;
N0 = 1;
mu0 = 0;
y0est = [XB0; HW0; A0; N0; mu0; 1/(A0*(1-s)*N0*alphahat); 1+mu0*delta*lam*s*((A0)^phi)*(N0^lam)];
yp0est = [0,0,delta*(s^lam),n,0,0,0];
opt = odeset(‘RelTol’, 10.0^(-7), ‘AbsTol’ , 10.0^(-7));
[y0, yp0] = decic(F, 0, y0est, [0,0,0,1,0,0,0], yp0est, [0,0,0,0,0,0,0], opt) decic MATLAB Answers — New Questions
question about dely lines
EDITED:
Hey guys, I want to implement an allpass filter but i struggle with the difference equation and its implementation:
heres the structure
and here are the difference equations:
So finally I got the difference equation. I also tried to implemend it into my process function. (d(n) is a delay line in my code before i wanted to implemt the allpass, therefore I commented it out, but can be useful to compare). m(k) and m'(k) are both delays that are calculated. zeta is set to be one and is therefore not in the equation. The plugin sounds wrong and horrible if I try this way. Anyone got an Idea?
function out = process(plugin, in)
out = zeros(size(in));
for i = 1:size(in,1)
% Summieren der L/R – Kanle
inL = in(i,1);
inR = in(i,2);
inSum = (inL + inR)/2;
plugin.buffInput(plugin.pBuffInput + 1) = inSum;
% loop over delay lines
for n=1:plugin.N
% plugin.y_a = 0;
% d_n = gain * delayed v_n
for k=1:plugin.N
% if k == 2 && mod(plugin.pBuffDelayLines,2) == 0
% plugin.gy(k) = 0;
%
% end
plugin.Dg(k) = sqrt(1-plugin.g(k)^2);
%plugin.d(k) = plugin.g(k)*plugin.buffDelayLines(k, mod(plugin.pBuffDelayLines + plugin.m(k), plugin.maxDelay +1) + 1);
% d(k) = (((sqrt(1-plugin.g(k)^2)^2)+ plugin.g(k)^2 + plugin.g(k)^2) * x1_m0p) + (plugin.g(k) * x1_m0) – (plugin.g(k) * y_m0p);
x1_m0p = plugin.buffDelayLines(k, mod(plugin.pBuffDelayLines + plugin.m(k)+plugin.m'(k)+1, plugin.maxDelay +1) + 1);
x1_m1p =plugin.buffDelayLines(k, mod(plugin.pBuffDelayLines+ plugin.m(k) +1, plugin.maxDelay +1) + 1);
plugin.d(k)= (plugin.Dg(k)^2+plugin.g(k)^2)*x1_m0p + plugin.g(k)*x1_m1p- plugin.g(k)*plugin.y_a(k);
plugin.y_a(k) = plugin.d(k);
end
%generate time variant matrix
%generateTIFDNmatrix(plugin,buffA);
% f_n = A(n,:) * d’
plugin.f(n) = plugin.A(n,:) * plugin.d(:);
% v_n with pre delay
plugin.v(n) = plugin.b(n) * plugin.buffInput(mod(plugin.pBuffInput + plugin.preDelayS, (plugin.maxPreDelay * plugin.fs + 1)) + 1) …
+ plugin.f(n); %An pe delay noch arbeiten
plugin.buffDelayLines(n, plugin.pBuffDelayLines + 1) = plugin.v(n);
% output lines
plugin.s(n) = plugin.c(n)* plugin.d(n);
out(i,:) = out(i,:) + real(plugin.s(n));
end
% Assign to output
out(i,1) = plugin.mix/100 * out(i,1) + (1.0 – plugin.mix/100) * in(i,1);
out(i,2) = plugin.mix/100 * out(i,2) + (1.0 – plugin.mix/100) * in(i,2);
calculatePointer(plugin);
end
endEDITED:
Hey guys, I want to implement an allpass filter but i struggle with the difference equation and its implementation:
heres the structure
and here are the difference equations:
So finally I got the difference equation. I also tried to implemend it into my process function. (d(n) is a delay line in my code before i wanted to implemt the allpass, therefore I commented it out, but can be useful to compare). m(k) and m'(k) are both delays that are calculated. zeta is set to be one and is therefore not in the equation. The plugin sounds wrong and horrible if I try this way. Anyone got an Idea?
function out = process(plugin, in)
out = zeros(size(in));
for i = 1:size(in,1)
% Summieren der L/R – Kanle
inL = in(i,1);
inR = in(i,2);
inSum = (inL + inR)/2;
plugin.buffInput(plugin.pBuffInput + 1) = inSum;
% loop over delay lines
for n=1:plugin.N
% plugin.y_a = 0;
% d_n = gain * delayed v_n
for k=1:plugin.N
% if k == 2 && mod(plugin.pBuffDelayLines,2) == 0
% plugin.gy(k) = 0;
%
% end
plugin.Dg(k) = sqrt(1-plugin.g(k)^2);
%plugin.d(k) = plugin.g(k)*plugin.buffDelayLines(k, mod(plugin.pBuffDelayLines + plugin.m(k), plugin.maxDelay +1) + 1);
% d(k) = (((sqrt(1-plugin.g(k)^2)^2)+ plugin.g(k)^2 + plugin.g(k)^2) * x1_m0p) + (plugin.g(k) * x1_m0) – (plugin.g(k) * y_m0p);
x1_m0p = plugin.buffDelayLines(k, mod(plugin.pBuffDelayLines + plugin.m(k)+plugin.m'(k)+1, plugin.maxDelay +1) + 1);
x1_m1p =plugin.buffDelayLines(k, mod(plugin.pBuffDelayLines+ plugin.m(k) +1, plugin.maxDelay +1) + 1);
plugin.d(k)= (plugin.Dg(k)^2+plugin.g(k)^2)*x1_m0p + plugin.g(k)*x1_m1p- plugin.g(k)*plugin.y_a(k);
plugin.y_a(k) = plugin.d(k);
end
%generate time variant matrix
%generateTIFDNmatrix(plugin,buffA);
% f_n = A(n,:) * d’
plugin.f(n) = plugin.A(n,:) * plugin.d(:);
% v_n with pre delay
plugin.v(n) = plugin.b(n) * plugin.buffInput(mod(plugin.pBuffInput + plugin.preDelayS, (plugin.maxPreDelay * plugin.fs + 1)) + 1) …
+ plugin.f(n); %An pe delay noch arbeiten
plugin.buffDelayLines(n, plugin.pBuffDelayLines + 1) = plugin.v(n);
% output lines
plugin.s(n) = plugin.c(n)* plugin.d(n);
out(i,:) = out(i,:) + real(plugin.s(n));
end
% Assign to output
out(i,1) = plugin.mix/100 * out(i,1) + (1.0 – plugin.mix/100) * in(i,1);
out(i,2) = plugin.mix/100 * out(i,2) + (1.0 – plugin.mix/100) * in(i,2);
calculatePointer(plugin);
end
end EDITED:
Hey guys, I want to implement an allpass filter but i struggle with the difference equation and its implementation:
heres the structure
and here are the difference equations:
So finally I got the difference equation. I also tried to implemend it into my process function. (d(n) is a delay line in my code before i wanted to implemt the allpass, therefore I commented it out, but can be useful to compare). m(k) and m'(k) are both delays that are calculated. zeta is set to be one and is therefore not in the equation. The plugin sounds wrong and horrible if I try this way. Anyone got an Idea?
function out = process(plugin, in)
out = zeros(size(in));
for i = 1:size(in,1)
% Summieren der L/R – Kanle
inL = in(i,1);
inR = in(i,2);
inSum = (inL + inR)/2;
plugin.buffInput(plugin.pBuffInput + 1) = inSum;
% loop over delay lines
for n=1:plugin.N
% plugin.y_a = 0;
% d_n = gain * delayed v_n
for k=1:plugin.N
% if k == 2 && mod(plugin.pBuffDelayLines,2) == 0
% plugin.gy(k) = 0;
%
% end
plugin.Dg(k) = sqrt(1-plugin.g(k)^2);
%plugin.d(k) = plugin.g(k)*plugin.buffDelayLines(k, mod(plugin.pBuffDelayLines + plugin.m(k), plugin.maxDelay +1) + 1);
% d(k) = (((sqrt(1-plugin.g(k)^2)^2)+ plugin.g(k)^2 + plugin.g(k)^2) * x1_m0p) + (plugin.g(k) * x1_m0) – (plugin.g(k) * y_m0p);
x1_m0p = plugin.buffDelayLines(k, mod(plugin.pBuffDelayLines + plugin.m(k)+plugin.m'(k)+1, plugin.maxDelay +1) + 1);
x1_m1p =plugin.buffDelayLines(k, mod(plugin.pBuffDelayLines+ plugin.m(k) +1, plugin.maxDelay +1) + 1);
plugin.d(k)= (plugin.Dg(k)^2+plugin.g(k)^2)*x1_m0p + plugin.g(k)*x1_m1p- plugin.g(k)*plugin.y_a(k);
plugin.y_a(k) = plugin.d(k);
end
%generate time variant matrix
%generateTIFDNmatrix(plugin,buffA);
% f_n = A(n,:) * d’
plugin.f(n) = plugin.A(n,:) * plugin.d(:);
% v_n with pre delay
plugin.v(n) = plugin.b(n) * plugin.buffInput(mod(plugin.pBuffInput + plugin.preDelayS, (plugin.maxPreDelay * plugin.fs + 1)) + 1) …
+ plugin.f(n); %An pe delay noch arbeiten
plugin.buffDelayLines(n, plugin.pBuffDelayLines + 1) = plugin.v(n);
% output lines
plugin.s(n) = plugin.c(n)* plugin.d(n);
out(i,:) = out(i,:) + real(plugin.s(n));
end
% Assign to output
out(i,1) = plugin.mix/100 * out(i,1) + (1.0 – plugin.mix/100) * in(i,1);
out(i,2) = plugin.mix/100 * out(i,2) + (1.0 – plugin.mix/100) * in(i,2);
calculatePointer(plugin);
end
end equation, digital signal processing MATLAB Answers — New Questions
Linear induction motor in simscape
Hello,
based on the examples in the ThreePhaseExamples_lib provided by mathworks, I wanted to customize the model for a linear induction motor. So far I’ve changed the library code to
component lim_custom
% Linear induction motor
%
parameters
nPolePairs = {1, ‘1’}; % Number of pole pairs
t_p = {0.05, ‘m’}; % pole pitch
pm_flux_linkage = {0.03, ‘Wb’}; % Permanent magnet flux linkage
stator_param = {1,’1′}; % Stator parameterization
Ld = {0.00025, ‘H’}; % Stator d-axis inductance, Ld
Lq = {0.00019, ‘H’}; % Stator q-axis inductance, Lq
Rs = {0.013, ‘Ohm’}; % Stator resistance per phase, Rs
end
parameters (Access=protected)
shift_3ph = { [0,-2*pi/3,2*pi/3], ‘rad’ };
end
nodes
L1 = foundation.electrical.electrical; % L1:left
L2 = foundation.electrical.electrical; % L2:left
L3 = foundation.electrical.electrical; % L3:left
R = foundation.mechanical.translational.translational; % R:right
C = foundation.mechanical.translational.translational; % C:right
end
variables
% Mechanical
translational_position = {0, ‘m’}; % Rotor angle
% Stator currents
i_d = {0, ‘A’}; % d-axis current
i_q = {0, ‘A’}; % q-axis current
end
variables (Access=protected)
% Mechanical
force = {0, ‘N’ }; % Mechanical torque
% Stator currents
i1 = { 0 , ‘A’ }; % Phase currents
i2 = { 0 , ‘A’ }; % Phase currents
i3 = { 0 , ‘A’ }; % Phase currents
end
branches
i1 : L1.i -> *;
i2 : L2.i -> *;
i3 : L3.i -> *;
force : R.f -> C.f;
end
equations
let
translational_velocity = R.v – C.v;
electrical_angle = nPolePairs*translational_position*2*pi/t_p;
% Set up Park’s transform
abc2dq = 2/3*[…
cos( electrical_angle + shift_3ph );…
-sin( electrical_angle + shift_3ph )];
% Voltages a,b,c -> d,q
U = [L1.v L2.v L3.v];
vdq = abc2dq*U’;
vd = vdq(1);
vq = vdq(2);
% Flux linkages
psi_d = i_d*Ld + pm_flux_linkage;
psi_q = i_q*Lq;
I = [i1 i2 i3];
in
% Electric to mechanical rotation
translational_velocity == translational_position.der;
% Electrical equations
vd == i_d*Rs + i_d.der*Ld – nPolePairs*translational_velocity*2*pi/t_p*psi_q;
vq == i_q*Rs + i_q.der*Lq + nPolePairs*translational_velocity*2*pi/t_p*psi_d;
[ i_d; i_q ] == abc2dq*I’;
I(1)+I(2)+I(3) == 0;
% Mechanical force
force == -3/2*nPolePairs/2/t_p*(i_q*psi_d – i_d*psi_q);
end
end
The error message I receive says
<</matlabcentral/answers/uploaded_files/31707/error_msg.jpg>>
My guess is, that the error is related to the domain change from rotational to translational, but due to limited knowledge to simscape I don’t know how to solve this. Does anyone have an advice for me?
Thank you,
TobiasHello,
based on the examples in the ThreePhaseExamples_lib provided by mathworks, I wanted to customize the model for a linear induction motor. So far I’ve changed the library code to
component lim_custom
% Linear induction motor
%
parameters
nPolePairs = {1, ‘1’}; % Number of pole pairs
t_p = {0.05, ‘m’}; % pole pitch
pm_flux_linkage = {0.03, ‘Wb’}; % Permanent magnet flux linkage
stator_param = {1,’1′}; % Stator parameterization
Ld = {0.00025, ‘H’}; % Stator d-axis inductance, Ld
Lq = {0.00019, ‘H’}; % Stator q-axis inductance, Lq
Rs = {0.013, ‘Ohm’}; % Stator resistance per phase, Rs
end
parameters (Access=protected)
shift_3ph = { [0,-2*pi/3,2*pi/3], ‘rad’ };
end
nodes
L1 = foundation.electrical.electrical; % L1:left
L2 = foundation.electrical.electrical; % L2:left
L3 = foundation.electrical.electrical; % L3:left
R = foundation.mechanical.translational.translational; % R:right
C = foundation.mechanical.translational.translational; % C:right
end
variables
% Mechanical
translational_position = {0, ‘m’}; % Rotor angle
% Stator currents
i_d = {0, ‘A’}; % d-axis current
i_q = {0, ‘A’}; % q-axis current
end
variables (Access=protected)
% Mechanical
force = {0, ‘N’ }; % Mechanical torque
% Stator currents
i1 = { 0 , ‘A’ }; % Phase currents
i2 = { 0 , ‘A’ }; % Phase currents
i3 = { 0 , ‘A’ }; % Phase currents
end
branches
i1 : L1.i -> *;
i2 : L2.i -> *;
i3 : L3.i -> *;
force : R.f -> C.f;
end
equations
let
translational_velocity = R.v – C.v;
electrical_angle = nPolePairs*translational_position*2*pi/t_p;
% Set up Park’s transform
abc2dq = 2/3*[…
cos( electrical_angle + shift_3ph );…
-sin( electrical_angle + shift_3ph )];
% Voltages a,b,c -> d,q
U = [L1.v L2.v L3.v];
vdq = abc2dq*U’;
vd = vdq(1);
vq = vdq(2);
% Flux linkages
psi_d = i_d*Ld + pm_flux_linkage;
psi_q = i_q*Lq;
I = [i1 i2 i3];
in
% Electric to mechanical rotation
translational_velocity == translational_position.der;
% Electrical equations
vd == i_d*Rs + i_d.der*Ld – nPolePairs*translational_velocity*2*pi/t_p*psi_q;
vq == i_q*Rs + i_q.der*Lq + nPolePairs*translational_velocity*2*pi/t_p*psi_d;
[ i_d; i_q ] == abc2dq*I’;
I(1)+I(2)+I(3) == 0;
% Mechanical force
force == -3/2*nPolePairs/2/t_p*(i_q*psi_d – i_d*psi_q);
end
end
The error message I receive says
<</matlabcentral/answers/uploaded_files/31707/error_msg.jpg>>
My guess is, that the error is related to the domain change from rotational to translational, but due to limited knowledge to simscape I don’t know how to solve this. Does anyone have an advice for me?
Thank you,
Tobias Hello,
based on the examples in the ThreePhaseExamples_lib provided by mathworks, I wanted to customize the model for a linear induction motor. So far I’ve changed the library code to
component lim_custom
% Linear induction motor
%
parameters
nPolePairs = {1, ‘1’}; % Number of pole pairs
t_p = {0.05, ‘m’}; % pole pitch
pm_flux_linkage = {0.03, ‘Wb’}; % Permanent magnet flux linkage
stator_param = {1,’1′}; % Stator parameterization
Ld = {0.00025, ‘H’}; % Stator d-axis inductance, Ld
Lq = {0.00019, ‘H’}; % Stator q-axis inductance, Lq
Rs = {0.013, ‘Ohm’}; % Stator resistance per phase, Rs
end
parameters (Access=protected)
shift_3ph = { [0,-2*pi/3,2*pi/3], ‘rad’ };
end
nodes
L1 = foundation.electrical.electrical; % L1:left
L2 = foundation.electrical.electrical; % L2:left
L3 = foundation.electrical.electrical; % L3:left
R = foundation.mechanical.translational.translational; % R:right
C = foundation.mechanical.translational.translational; % C:right
end
variables
% Mechanical
translational_position = {0, ‘m’}; % Rotor angle
% Stator currents
i_d = {0, ‘A’}; % d-axis current
i_q = {0, ‘A’}; % q-axis current
end
variables (Access=protected)
% Mechanical
force = {0, ‘N’ }; % Mechanical torque
% Stator currents
i1 = { 0 , ‘A’ }; % Phase currents
i2 = { 0 , ‘A’ }; % Phase currents
i3 = { 0 , ‘A’ }; % Phase currents
end
branches
i1 : L1.i -> *;
i2 : L2.i -> *;
i3 : L3.i -> *;
force : R.f -> C.f;
end
equations
let
translational_velocity = R.v – C.v;
electrical_angle = nPolePairs*translational_position*2*pi/t_p;
% Set up Park’s transform
abc2dq = 2/3*[…
cos( electrical_angle + shift_3ph );…
-sin( electrical_angle + shift_3ph )];
% Voltages a,b,c -> d,q
U = [L1.v L2.v L3.v];
vdq = abc2dq*U’;
vd = vdq(1);
vq = vdq(2);
% Flux linkages
psi_d = i_d*Ld + pm_flux_linkage;
psi_q = i_q*Lq;
I = [i1 i2 i3];
in
% Electric to mechanical rotation
translational_velocity == translational_position.der;
% Electrical equations
vd == i_d*Rs + i_d.der*Ld – nPolePairs*translational_velocity*2*pi/t_p*psi_q;
vq == i_q*Rs + i_q.der*Lq + nPolePairs*translational_velocity*2*pi/t_p*psi_d;
[ i_d; i_q ] == abc2dq*I’;
I(1)+I(2)+I(3) == 0;
% Mechanical force
force == -3/2*nPolePairs/2/t_p*(i_q*psi_d – i_d*psi_q);
end
end
The error message I receive says
<</matlabcentral/answers/uploaded_files/31707/error_msg.jpg>>
My guess is, that the error is related to the domain change from rotational to translational, but due to limited knowledge to simscape I don’t know how to solve this. Does anyone have an advice for me?
Thank you,
Tobias simscape, linear induction motor, power_electronics_control, electric_motor_control MATLAB Answers — New Questions
How to save the best agent during the training of RL?
During the training of a reinforcement learning algorithm, I only want to save the agent that gets the biggest episode reward. what should I do?During the training of a reinforcement learning algorithm, I only want to save the agent that gets the biggest episode reward. what should I do? During the training of a reinforcement learning algorithm, I only want to save the agent that gets the biggest episode reward. what should I do? reinforcement learning, training MATLAB Answers — New Questions
How to create a .mat file of the following example?
I have a data in the following format: (i, j, k, val) where i, j, k are variables and val is the corresponding data at i, j, k values. I want to save the .mat file in the (i, j, k, val) format, so that my .mat files looks like:
(0, 0, 0, 1.5E-02)
(0, 0, 1, 2.5E-05)
………………………
(5, 5, 5, 4.5 E-05)
How can I create this type of .mat file? I would appreciate any help on this.
Actually these data are the octant of a 11 by 11 by 11 matrix (isotropic cubic matrix). I would like to have a full-size matrix using the symmetry property of the octant. I want to save the octant data in a .mat file so that I could iterate over the 8 possibilities to make a full size matrix.I have a data in the following format: (i, j, k, val) where i, j, k are variables and val is the corresponding data at i, j, k values. I want to save the .mat file in the (i, j, k, val) format, so that my .mat files looks like:
(0, 0, 0, 1.5E-02)
(0, 0, 1, 2.5E-05)
………………………
(5, 5, 5, 4.5 E-05)
How can I create this type of .mat file? I would appreciate any help on this.
Actually these data are the octant of a 11 by 11 by 11 matrix (isotropic cubic matrix). I would like to have a full-size matrix using the symmetry property of the octant. I want to save the octant data in a .mat file so that I could iterate over the 8 possibilities to make a full size matrix. I have a data in the following format: (i, j, k, val) where i, j, k are variables and val is the corresponding data at i, j, k values. I want to save the .mat file in the (i, j, k, val) format, so that my .mat files looks like:
(0, 0, 0, 1.5E-02)
(0, 0, 1, 2.5E-05)
………………………
(5, 5, 5, 4.5 E-05)
How can I create this type of .mat file? I would appreciate any help on this.
Actually these data are the octant of a 11 by 11 by 11 matrix (isotropic cubic matrix). I would like to have a full-size matrix using the symmetry property of the octant. I want to save the octant data in a .mat file so that I could iterate over the 8 possibilities to make a full size matrix. matrix, matfile, mat, matrix manipulation, image processing MATLAB Answers — New Questions
what is the difference between FPGA Turnkey and IP Core Generation?
In HDL Workflow advisor one could choose between different target workflows such as Generic ASICS/FPGA, FPGA Turnkey, IP Core Generation, FPGA-in-the-loop, Simulink real-time FPGA I/O. I have researched for almost half a day and I couldn’t find a clear explanation of differences between these modes. In particular, I would like to know about difference between FPGA Turnkey and IP Core Generation. It is highly appreciated if someone briefly explain this, or cite references where this topic is discussed.
Best regards,
YasharIn HDL Workflow advisor one could choose between different target workflows such as Generic ASICS/FPGA, FPGA Turnkey, IP Core Generation, FPGA-in-the-loop, Simulink real-time FPGA I/O. I have researched for almost half a day and I couldn’t find a clear explanation of differences between these modes. In particular, I would like to know about difference between FPGA Turnkey and IP Core Generation. It is highly appreciated if someone briefly explain this, or cite references where this topic is discussed.
Best regards,
Yashar In HDL Workflow advisor one could choose between different target workflows such as Generic ASICS/FPGA, FPGA Turnkey, IP Core Generation, FPGA-in-the-loop, Simulink real-time FPGA I/O. I have researched for almost half a day and I couldn’t find a clear explanation of differences between these modes. In particular, I would like to know about difference between FPGA Turnkey and IP Core Generation. It is highly appreciated if someone briefly explain this, or cite references where this topic is discussed.
Best regards,
Yashar hdl coder, hdl workflow advisor, ip core generation, fpga turnkey MATLAB Answers — New Questions
What is wrong with my timer function? (Too many input arguments?)
Hi all, amateur Matlab user here, so I apologize if this question seems silly.
I have a constantly changing variable called ‘a’, and I want to create an array called ‘asamplevalues’ that contains the value of ‘a’ sampled at 4 second intervals.
Here is the part of the script that describes and calls up the timer function:
handles.samplingtimer = timer(‘Period’, 4.0, ‘ExecutionMode’,’fixedRate’,’TasksToExecute’, 10e6);
handles.samplingtimer.TimerFcn = { @samplinga, handles };
start (handles.samplingtimer);
Here is the timer function itself:
function [asamplevalues] = samplinga(a)
if isempty(asamplevalues) == 1
asamplevalues = [100];
else asamplevalues = [asamplevalues, a];
end
end
When the program gets to the timer function I get this error message:
??? Error while evaluating TimerFcn for timer ‘timer-3’
Too many input arguments.
Any help or suggestions are greatly appreciated! Thanks!Hi all, amateur Matlab user here, so I apologize if this question seems silly.
I have a constantly changing variable called ‘a’, and I want to create an array called ‘asamplevalues’ that contains the value of ‘a’ sampled at 4 second intervals.
Here is the part of the script that describes and calls up the timer function:
handles.samplingtimer = timer(‘Period’, 4.0, ‘ExecutionMode’,’fixedRate’,’TasksToExecute’, 10e6);
handles.samplingtimer.TimerFcn = { @samplinga, handles };
start (handles.samplingtimer);
Here is the timer function itself:
function [asamplevalues] = samplinga(a)
if isempty(asamplevalues) == 1
asamplevalues = [100];
else asamplevalues = [asamplevalues, a];
end
end
When the program gets to the timer function I get this error message:
??? Error while evaluating TimerFcn for timer ‘timer-3’
Too many input arguments.
Any help or suggestions are greatly appreciated! Thanks! Hi all, amateur Matlab user here, so I apologize if this question seems silly.
I have a constantly changing variable called ‘a’, and I want to create an array called ‘asamplevalues’ that contains the value of ‘a’ sampled at 4 second intervals.
Here is the part of the script that describes and calls up the timer function:
handles.samplingtimer = timer(‘Period’, 4.0, ‘ExecutionMode’,’fixedRate’,’TasksToExecute’, 10e6);
handles.samplingtimer.TimerFcn = { @samplinga, handles };
start (handles.samplingtimer);
Here is the timer function itself:
function [asamplevalues] = samplinga(a)
if isempty(asamplevalues) == 1
asamplevalues = [100];
else asamplevalues = [asamplevalues, a];
end
end
When the program gets to the timer function I get this error message:
??? Error while evaluating TimerFcn for timer ‘timer-3’
Too many input arguments.
Any help or suggestions are greatly appreciated! Thanks! sampling, timer, too many input arguments MATLAB Answers — New Questions
Help doing array to display values on map
Hi I am trying to do an array that will calculate the mean value of the high composite minus the low composite divided by two. After that I am trying to do a t-test of each observation to be able to display it in a map. I started my array like this but matlab is giving me multiple error messages. My dataset is x=141,y=71 and t=38. I have to make this array work for the 38 years. the average of my high composite is 1.69 and the low -1.29 .Any help will be appreciated.
rain(141,71,38);
for j1=71
for i1=141
zm1=(i,j)=precip(i,j,1;);
end
endHi I am trying to do an array that will calculate the mean value of the high composite minus the low composite divided by two. After that I am trying to do a t-test of each observation to be able to display it in a map. I started my array like this but matlab is giving me multiple error messages. My dataset is x=141,y=71 and t=38. I have to make this array work for the 38 years. the average of my high composite is 1.69 and the low -1.29 .Any help will be appreciated.
rain(141,71,38);
for j1=71
for i1=141
zm1=(i,j)=precip(i,j,1;);
end
end Hi I am trying to do an array that will calculate the mean value of the high composite minus the low composite divided by two. After that I am trying to do a t-test of each observation to be able to display it in a map. I started my array like this but matlab is giving me multiple error messages. My dataset is x=141,y=71 and t=38. I have to make this array work for the 38 years. the average of my high composite is 1.69 and the low -1.29 .Any help will be appreciated.
rain(141,71,38);
for j1=71
for i1=141
zm1=(i,j)=precip(i,j,1;);
end
end matrix, array, map MATLAB Answers — New Questions
Plotting and OpenGL error on Linux. How to resolve?
Hi I am unable to plot with Matlab. I have been getting this message:
MATLAB has experienced a low-level graphics error, and may not have drawn correctly.
Read about what you can do to prevent this issue at Resolving Low-Level Graphics Issues then restart MATLAB.
When I followed the instructions to resolve this issue, I got this message:
Error using opengl
Switching to software OpenGL rendering at runtime on unix is not supported.
I am running debian wheezy on a lenovo T440s. Please let me know what I can do to resolve this issue.Hi I am unable to plot with Matlab. I have been getting this message:
MATLAB has experienced a low-level graphics error, and may not have drawn correctly.
Read about what you can do to prevent this issue at Resolving Low-Level Graphics Issues then restart MATLAB.
When I followed the instructions to resolve this issue, I got this message:
Error using opengl
Switching to software OpenGL rendering at runtime on unix is not supported.
I am running debian wheezy on a lenovo T440s. Please let me know what I can do to resolve this issue. Hi I am unable to plot with Matlab. I have been getting this message:
MATLAB has experienced a low-level graphics error, and may not have drawn correctly.
Read about what you can do to prevent this issue at Resolving Low-Level Graphics Issues then restart MATLAB.
When I followed the instructions to resolve this issue, I got this message:
Error using opengl
Switching to software OpenGL rendering at runtime on unix is not supported.
I am running debian wheezy on a lenovo T440s. Please let me know what I can do to resolve this issue. opengl, plotting, linux, graphics MATLAB Answers — New Questions
When Open GUI, I counter an error
“`
java.lang.ExceptionInInitializerError
at com.mathworks.mde.cmdwin.CmdWin.<init>(CmdWin.java:111)
at com.mathworks.mde.cmdwin.CmdWin.<clinit>(CmdWin.java:107)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at com.mathworks.jmi.ClassLoaderManager.loadClass(ClassLoaderManager.java:442)
at com.mathworks.jmi.ClassLoaderManager.findClass(ClassLoaderManager.java:422)
at com.mathworks.jmi.Matlab$2.findClass(Matlab.java:518)
at com.mathworks.util.ClassLoaderBridge.findClass(ClassLoaderBridge.java:23)
at com.mathworks.widgets.desk.DTClient.createComponent(DTClient.java:275)
at com.mathworks.widgets.desk.Desktop.createClientComponent(Desktop.java:6482)
at com.mathworks.mde.desk.MLDesktop.createClientComponent(MLDesktop.java:1070)
at com.mathworks.widgets.desk.Desktop.createClientComponentWrapper(Desktop.java:6496)
at com.mathworks.widgets.desk.Desktop.setClientShowing(Desktop.java:7195)
at com.mathworks.widgets.desk.Desktop.setClientShowing(Desktop.java:7182)
at com.mathworks.widgets.desk.DTNestingContainer$ViewState.restore(DTNestingContainer.java:2910)
at com.mathworks.widgets.desk.DTNestingContainer$SplitState.restore(DTNestingContainer.java:2536)
at com.mathworks.widgets.desk.DTNestingContainer$SplitState.restore(DTNestingContainer.java:2537)
at com.mathworks.widgets.desk.DTNestingContainer$RootState.restore(DTNestingContainer.java:2422)
at com.mathworks.widgets.desk.DTNestingContainer$RootState.restore(DTNestingContainer.java:2417)
at com.mathworks.widgets.desk.DTNestingContainer.restoreState(DTNestingContainer.java:2291)
at com.mathworks.widgets.desk.DTMultipleClientFrame.restoreState(DTMultipleClientFrame.java:2791)
at com.mathworks.widgets.desk.Desktop.restoreLayout(Desktop.java:5961)
at com.mathworks.mde.desk.MLDesktop.restoreLayout(MLDesktop.java:1698)
at com.mathworks.widgets.desk.Desktop.restoreLayout(Desktop.java:5724)
at com.mathworks.mde.desk.MLDesktop.setDefaultDesktop(MLDesktop.java:1585)
at com.mathworks.widgets.desk.Desktop.initMainFrame(Desktop.java:296)
at com.mathworks.mde.desk.MLDesktop.initMainFrameFromThread(MLDesktop.java:874)
at com.mathworks.mde.desk.MLDesktop.access$600(MLDesktop.java:227)
at com.mathworks.mde.desk.MLDesktop$Initializer.run(MLDesktop.java:1261)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
at java.awt.EventQueue.access$500(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.awt.EventQueue$3.run(EventQueue.java:703)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
Caused by: java.lang.ArithmeticException: / by zero
at com.mathworks.mde.cmdwin.XCmdWndView.getPotentialRows(XCmdWndView.java:1084)
at com.mathworks.mde.cmdwin.XCmdWndView.setCWFont(XCmdWndView.java:1651)
at com.mathworks.mde.cmdwin.XCmdWndView.initPrefs(XCmdWndView.java:907)
at com.mathworks.mde.cmdwin.XCmdWndView.<init>(XCmdWndView.java:401)
at com.mathworks.mde.cmdwin.XCmdWndView.<clinit>(XCmdWndView.java:329)
… 43 more
“““
java.lang.ExceptionInInitializerError
at com.mathworks.mde.cmdwin.CmdWin.<init>(CmdWin.java:111)
at com.mathworks.mde.cmdwin.CmdWin.<clinit>(CmdWin.java:107)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at com.mathworks.jmi.ClassLoaderManager.loadClass(ClassLoaderManager.java:442)
at com.mathworks.jmi.ClassLoaderManager.findClass(ClassLoaderManager.java:422)
at com.mathworks.jmi.Matlab$2.findClass(Matlab.java:518)
at com.mathworks.util.ClassLoaderBridge.findClass(ClassLoaderBridge.java:23)
at com.mathworks.widgets.desk.DTClient.createComponent(DTClient.java:275)
at com.mathworks.widgets.desk.Desktop.createClientComponent(Desktop.java:6482)
at com.mathworks.mde.desk.MLDesktop.createClientComponent(MLDesktop.java:1070)
at com.mathworks.widgets.desk.Desktop.createClientComponentWrapper(Desktop.java:6496)
at com.mathworks.widgets.desk.Desktop.setClientShowing(Desktop.java:7195)
at com.mathworks.widgets.desk.Desktop.setClientShowing(Desktop.java:7182)
at com.mathworks.widgets.desk.DTNestingContainer$ViewState.restore(DTNestingContainer.java:2910)
at com.mathworks.widgets.desk.DTNestingContainer$SplitState.restore(DTNestingContainer.java:2536)
at com.mathworks.widgets.desk.DTNestingContainer$SplitState.restore(DTNestingContainer.java:2537)
at com.mathworks.widgets.desk.DTNestingContainer$RootState.restore(DTNestingContainer.java:2422)
at com.mathworks.widgets.desk.DTNestingContainer$RootState.restore(DTNestingContainer.java:2417)
at com.mathworks.widgets.desk.DTNestingContainer.restoreState(DTNestingContainer.java:2291)
at com.mathworks.widgets.desk.DTMultipleClientFrame.restoreState(DTMultipleClientFrame.java:2791)
at com.mathworks.widgets.desk.Desktop.restoreLayout(Desktop.java:5961)
at com.mathworks.mde.desk.MLDesktop.restoreLayout(MLDesktop.java:1698)
at com.mathworks.widgets.desk.Desktop.restoreLayout(Desktop.java:5724)
at com.mathworks.mde.desk.MLDesktop.setDefaultDesktop(MLDesktop.java:1585)
at com.mathworks.widgets.desk.Desktop.initMainFrame(Desktop.java:296)
at com.mathworks.mde.desk.MLDesktop.initMainFrameFromThread(MLDesktop.java:874)
at com.mathworks.mde.desk.MLDesktop.access$600(MLDesktop.java:227)
at com.mathworks.mde.desk.MLDesktop$Initializer.run(MLDesktop.java:1261)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
at java.awt.EventQueue.access$500(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.awt.EventQueue$3.run(EventQueue.java:703)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
Caused by: java.lang.ArithmeticException: / by zero
at com.mathworks.mde.cmdwin.XCmdWndView.getPotentialRows(XCmdWndView.java:1084)
at com.mathworks.mde.cmdwin.XCmdWndView.setCWFont(XCmdWndView.java:1651)
at com.mathworks.mde.cmdwin.XCmdWndView.initPrefs(XCmdWndView.java:907)
at com.mathworks.mde.cmdwin.XCmdWndView.<init>(XCmdWndView.java:401)
at com.mathworks.mde.cmdwin.XCmdWndView.<clinit>(XCmdWndView.java:329)
… 43 more
“` “`
java.lang.ExceptionInInitializerError
at com.mathworks.mde.cmdwin.CmdWin.<init>(CmdWin.java:111)
at com.mathworks.mde.cmdwin.CmdWin.<clinit>(CmdWin.java:107)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at com.mathworks.jmi.ClassLoaderManager.loadClass(ClassLoaderManager.java:442)
at com.mathworks.jmi.ClassLoaderManager.findClass(ClassLoaderManager.java:422)
at com.mathworks.jmi.Matlab$2.findClass(Matlab.java:518)
at com.mathworks.util.ClassLoaderBridge.findClass(ClassLoaderBridge.java:23)
at com.mathworks.widgets.desk.DTClient.createComponent(DTClient.java:275)
at com.mathworks.widgets.desk.Desktop.createClientComponent(Desktop.java:6482)
at com.mathworks.mde.desk.MLDesktop.createClientComponent(MLDesktop.java:1070)
at com.mathworks.widgets.desk.Desktop.createClientComponentWrapper(Desktop.java:6496)
at com.mathworks.widgets.desk.Desktop.setClientShowing(Desktop.java:7195)
at com.mathworks.widgets.desk.Desktop.setClientShowing(Desktop.java:7182)
at com.mathworks.widgets.desk.DTNestingContainer$ViewState.restore(DTNestingContainer.java:2910)
at com.mathworks.widgets.desk.DTNestingContainer$SplitState.restore(DTNestingContainer.java:2536)
at com.mathworks.widgets.desk.DTNestingContainer$SplitState.restore(DTNestingContainer.java:2537)
at com.mathworks.widgets.desk.DTNestingContainer$RootState.restore(DTNestingContainer.java:2422)
at com.mathworks.widgets.desk.DTNestingContainer$RootState.restore(DTNestingContainer.java:2417)
at com.mathworks.widgets.desk.DTNestingContainer.restoreState(DTNestingContainer.java:2291)
at com.mathworks.widgets.desk.DTMultipleClientFrame.restoreState(DTMultipleClientFrame.java:2791)
at com.mathworks.widgets.desk.Desktop.restoreLayout(Desktop.java:5961)
at com.mathworks.mde.desk.MLDesktop.restoreLayout(MLDesktop.java:1698)
at com.mathworks.widgets.desk.Desktop.restoreLayout(Desktop.java:5724)
at com.mathworks.mde.desk.MLDesktop.setDefaultDesktop(MLDesktop.java:1585)
at com.mathworks.widgets.desk.Desktop.initMainFrame(Desktop.java:296)
at com.mathworks.mde.desk.MLDesktop.initMainFrameFromThread(MLDesktop.java:874)
at com.mathworks.mde.desk.MLDesktop.access$600(MLDesktop.java:227)
at com.mathworks.mde.desk.MLDesktop$Initializer.run(MLDesktop.java:1261)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
at java.awt.EventQueue.access$500(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.awt.EventQueue$3.run(EventQueue.java:703)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
Caused by: java.lang.ArithmeticException: / by zero
at com.mathworks.mde.cmdwin.XCmdWndView.getPotentialRows(XCmdWndView.java:1084)
at com.mathworks.mde.cmdwin.XCmdWndView.setCWFont(XCmdWndView.java:1651)
at com.mathworks.mde.cmdwin.XCmdWndView.initPrefs(XCmdWndView.java:907)
at com.mathworks.mde.cmdwin.XCmdWndView.<init>(XCmdWndView.java:401)
at com.mathworks.mde.cmdwin.XCmdWndView.<clinit>(XCmdWndView.java:329)
… 43 more
“` matlab gui MATLAB Answers — New Questions
trackOSPAMetric for my data
Hello. I want to use trackOSPAMetric to evaluate tracking result with artificial data. but it does not match my data. I attached the code and the error. any ideas? thank you very much for your time and attention.
clc; clear; close;
% 2DPF+3DOSPA
% Parameters
num_trajectories = 4;
num_paths = 2;
points_per_trajectory = 100;
num_clusters = 60;
% Define base paths as nearly horizontal lines
base_paths = { [linspace(0, 10, points_per_trajectory)’, 2 * ones(points_per_trajectory, 1)];
[linspace(0, 10, points_per_trajectory)’, 4 * ones(points_per_trajectory, 1)];
[linspace(0, 10, points_per_trajectory)’, 6 * ones(points_per_trajectory, 1)];
[linspace(0, 10, points_per_trajectory)’, 8 * ones(points_per_trajectory, 1)] };
% Initialize trajectories
trajectories = cell(1, num_trajectories);
% Generate trajectories with random deviations from base paths
for ii = 1:num_trajectories
path = base_paths{mod(ii, num_paths) + 1};
deviation = [0.01 * randn(points_per_trajectory, 1), …
0.01 * randn(points_per_trajectory, 1)];
trajectories{ii} = path + deviation;
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Select trajectory for tracking
selected_traj = trajectories{1};
numParticles = 1000;
stateDimension = 4;
init_state = [selected_traj(1, 1); 0;…
selected_traj(1, 2); 0];
pf = trackingPF(@constvel, @cvmeas, init_state, …
‘StateCovariance’, 0.5 * eye(stateDimension), …
‘NumParticles’, numParticles, …
‘HasAdditiveProcessNoise’, true);
% Particle filter tracking
estimated_positions_pf = …
zeros(size(selected_traj, 1), stateDimension);
pf_tot = cell(size(selected_traj, 1),1);
estimated_positions_pf(1, 🙂 = init_state’;
pf_no_km = clone(pf);
for t = 2:size(selected_traj, 1)
[xPred_pf, PPred_pf] = predict(pf_no_km, 1);
observation = …
[selected_traj(t, 1); selected_traj(t, 2); 0];
[xCorr_km, Pcorr_km] = correct(pf, observation);
[xCorr_pf, Pcorr_pf] = correct(pf_no_km, observation);
estimated_positions_pf(t, 🙂 = xCorr_pf;
pf_tot{t} = Pcorr_pf;
end
% Plot tracking results
figure (101);
plot(selected_traj(:, 1), selected_traj(:, 2), ‘g’, …
‘DisplayName’, ‘True Trajectory’);
hold on;
plot(estimated_positions_pf(:, 1), …
estimated_positions_pf(:, 3), ‘bo-.’, …
‘DisplayName’, ‘Estimated (No KM)’);
title(‘Tracking Map’);
legend;
xlabel(‘X’);
ylabel(‘Y’);
hold off;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% OSPA metric computation
truths_mine = …
[selected_traj zeros(size(selected_traj,1),1)];
%%
% Construct the truth and tracks structs
num_timesteps = size(selected_traj, 1);
truths_cell = cell(1,num_timesteps);
tracks_PF_cell = cell(1,num_timesteps);
% Compute velocities for truth data
velocities_truth = diff(truths_mine); % Approximate velocity (forward difference)
velocities_truth = [0 0 0;velocities_truth];
for t = 1:num_timesteps
% Truth struct
truth_struct = struct();
truth_struct.PlatformID = 1;
truth_struct.Time = t; % Time step
truth_struct.Position = …
[selected_traj(t, 1); selected_traj(t, 2);0]’; % Position [x; y]
% if t < num_timesteps
truth_struct.Velocity = velocities_truth(t, :); % Velocity [vx; vy]
truths_cell{t} = truth_struct;
% Tracks struct
tracks_struct_PF = struct();
tracks_struct_PF.UpdateTime = t; % Time step
tracks_struct_PF.State = …
[estimated_positions_pf(t, :),0,0]’;%; estimated_positions_pf(t, 3);0]; % Estimated position [x; y]
tracks_struct_PF.TrackID = 1;
if t==1
tracks_struct_PF.StateCovariance = [1 0 0 0 0 0; 0 1 0 0 0 0; 0 0 1 0 0 0; 0 0 0 1 0 0; 0 0 0 0 0 0 ; 0 0 0 0 0 0 ];
else
pf_cov = [pf_tot{t};zeros(2,4)];
pf_cov2 = [pf_cov, zeros(6,2)];
tracks_struct_KM.StateCovariance = pf_cov2;
end
tracks_PF_cell{t} = tracks_struct_PF;
end
%%
tom = trackOSPAMetric;
ospa = zeros(numel(tracks_PF_cell),1);
cardOspa = zeros(numel(tracks_PF_cell),1);
locOspa = zeros(numel(tracks_PF_cell),1);
for ik = 1:numel(tracks_PF_cell)
ik
tracks_mi = tracks_PF_cell{ik}
truths_mi = truths_cell{ik}
[ospa(ik), locOspa(ik), cardOspa(ik)] = tom(tracks_mi, truths_mi);
end
%%
% Compute square error between truth and track locations
error_pf = (selected_traj(:, 1) – estimated_positions_pf(:, 1)).^2 + …
(selected_traj(:, 2) – estimated_positions_pf(:, 3)).^2;
Here is the error:
Error using assignjv
Expected COSTMATRIX to be non-NaN.
Error in fusion.internal.assignment.lapCheckCostMatrix (line 10)
validateattributes(costMatrix, {‘single’,’double’}, …
Error in assignjv (line 110)
fusion.internal.assignment.lapCheckCostMatrix(costMatrix, mfilename);
Error in fusion.internal.metrics.OSPABase/stepImpl (line 219)
optimalAssignment = assignjv(dMatrix, 2*cN);
Error in trackOSPAMetric/stepImpl (line 305)
[locOspa, cardOspa, optimalAssignment] = stepImpl@fusion.internal.metrics.OSPABase(obj, tracks, truths);
Error in OnlyPF (line 139)
[ospa(ik), locOspa(ik), cardOspa(ik)] = tom(tracks_mi, truths_mi);
>>Hello. I want to use trackOSPAMetric to evaluate tracking result with artificial data. but it does not match my data. I attached the code and the error. any ideas? thank you very much for your time and attention.
clc; clear; close;
% 2DPF+3DOSPA
% Parameters
num_trajectories = 4;
num_paths = 2;
points_per_trajectory = 100;
num_clusters = 60;
% Define base paths as nearly horizontal lines
base_paths = { [linspace(0, 10, points_per_trajectory)’, 2 * ones(points_per_trajectory, 1)];
[linspace(0, 10, points_per_trajectory)’, 4 * ones(points_per_trajectory, 1)];
[linspace(0, 10, points_per_trajectory)’, 6 * ones(points_per_trajectory, 1)];
[linspace(0, 10, points_per_trajectory)’, 8 * ones(points_per_trajectory, 1)] };
% Initialize trajectories
trajectories = cell(1, num_trajectories);
% Generate trajectories with random deviations from base paths
for ii = 1:num_trajectories
path = base_paths{mod(ii, num_paths) + 1};
deviation = [0.01 * randn(points_per_trajectory, 1), …
0.01 * randn(points_per_trajectory, 1)];
trajectories{ii} = path + deviation;
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Select trajectory for tracking
selected_traj = trajectories{1};
numParticles = 1000;
stateDimension = 4;
init_state = [selected_traj(1, 1); 0;…
selected_traj(1, 2); 0];
pf = trackingPF(@constvel, @cvmeas, init_state, …
‘StateCovariance’, 0.5 * eye(stateDimension), …
‘NumParticles’, numParticles, …
‘HasAdditiveProcessNoise’, true);
% Particle filter tracking
estimated_positions_pf = …
zeros(size(selected_traj, 1), stateDimension);
pf_tot = cell(size(selected_traj, 1),1);
estimated_positions_pf(1, 🙂 = init_state’;
pf_no_km = clone(pf);
for t = 2:size(selected_traj, 1)
[xPred_pf, PPred_pf] = predict(pf_no_km, 1);
observation = …
[selected_traj(t, 1); selected_traj(t, 2); 0];
[xCorr_km, Pcorr_km] = correct(pf, observation);
[xCorr_pf, Pcorr_pf] = correct(pf_no_km, observation);
estimated_positions_pf(t, 🙂 = xCorr_pf;
pf_tot{t} = Pcorr_pf;
end
% Plot tracking results
figure (101);
plot(selected_traj(:, 1), selected_traj(:, 2), ‘g’, …
‘DisplayName’, ‘True Trajectory’);
hold on;
plot(estimated_positions_pf(:, 1), …
estimated_positions_pf(:, 3), ‘bo-.’, …
‘DisplayName’, ‘Estimated (No KM)’);
title(‘Tracking Map’);
legend;
xlabel(‘X’);
ylabel(‘Y’);
hold off;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% OSPA metric computation
truths_mine = …
[selected_traj zeros(size(selected_traj,1),1)];
%%
% Construct the truth and tracks structs
num_timesteps = size(selected_traj, 1);
truths_cell = cell(1,num_timesteps);
tracks_PF_cell = cell(1,num_timesteps);
% Compute velocities for truth data
velocities_truth = diff(truths_mine); % Approximate velocity (forward difference)
velocities_truth = [0 0 0;velocities_truth];
for t = 1:num_timesteps
% Truth struct
truth_struct = struct();
truth_struct.PlatformID = 1;
truth_struct.Time = t; % Time step
truth_struct.Position = …
[selected_traj(t, 1); selected_traj(t, 2);0]’; % Position [x; y]
% if t < num_timesteps
truth_struct.Velocity = velocities_truth(t, :); % Velocity [vx; vy]
truths_cell{t} = truth_struct;
% Tracks struct
tracks_struct_PF = struct();
tracks_struct_PF.UpdateTime = t; % Time step
tracks_struct_PF.State = …
[estimated_positions_pf(t, :),0,0]’;%; estimated_positions_pf(t, 3);0]; % Estimated position [x; y]
tracks_struct_PF.TrackID = 1;
if t==1
tracks_struct_PF.StateCovariance = [1 0 0 0 0 0; 0 1 0 0 0 0; 0 0 1 0 0 0; 0 0 0 1 0 0; 0 0 0 0 0 0 ; 0 0 0 0 0 0 ];
else
pf_cov = [pf_tot{t};zeros(2,4)];
pf_cov2 = [pf_cov, zeros(6,2)];
tracks_struct_KM.StateCovariance = pf_cov2;
end
tracks_PF_cell{t} = tracks_struct_PF;
end
%%
tom = trackOSPAMetric;
ospa = zeros(numel(tracks_PF_cell),1);
cardOspa = zeros(numel(tracks_PF_cell),1);
locOspa = zeros(numel(tracks_PF_cell),1);
for ik = 1:numel(tracks_PF_cell)
ik
tracks_mi = tracks_PF_cell{ik}
truths_mi = truths_cell{ik}
[ospa(ik), locOspa(ik), cardOspa(ik)] = tom(tracks_mi, truths_mi);
end
%%
% Compute square error between truth and track locations
error_pf = (selected_traj(:, 1) – estimated_positions_pf(:, 1)).^2 + …
(selected_traj(:, 2) – estimated_positions_pf(:, 3)).^2;
Here is the error:
Error using assignjv
Expected COSTMATRIX to be non-NaN.
Error in fusion.internal.assignment.lapCheckCostMatrix (line 10)
validateattributes(costMatrix, {‘single’,’double’}, …
Error in assignjv (line 110)
fusion.internal.assignment.lapCheckCostMatrix(costMatrix, mfilename);
Error in fusion.internal.metrics.OSPABase/stepImpl (line 219)
optimalAssignment = assignjv(dMatrix, 2*cN);
Error in trackOSPAMetric/stepImpl (line 305)
[locOspa, cardOspa, optimalAssignment] = stepImpl@fusion.internal.metrics.OSPABase(obj, tracks, truths);
Error in OnlyPF (line 139)
[ospa(ik), locOspa(ik), cardOspa(ik)] = tom(tracks_mi, truths_mi);
>> Hello. I want to use trackOSPAMetric to evaluate tracking result with artificial data. but it does not match my data. I attached the code and the error. any ideas? thank you very much for your time and attention.
clc; clear; close;
% 2DPF+3DOSPA
% Parameters
num_trajectories = 4;
num_paths = 2;
points_per_trajectory = 100;
num_clusters = 60;
% Define base paths as nearly horizontal lines
base_paths = { [linspace(0, 10, points_per_trajectory)’, 2 * ones(points_per_trajectory, 1)];
[linspace(0, 10, points_per_trajectory)’, 4 * ones(points_per_trajectory, 1)];
[linspace(0, 10, points_per_trajectory)’, 6 * ones(points_per_trajectory, 1)];
[linspace(0, 10, points_per_trajectory)’, 8 * ones(points_per_trajectory, 1)] };
% Initialize trajectories
trajectories = cell(1, num_trajectories);
% Generate trajectories with random deviations from base paths
for ii = 1:num_trajectories
path = base_paths{mod(ii, num_paths) + 1};
deviation = [0.01 * randn(points_per_trajectory, 1), …
0.01 * randn(points_per_trajectory, 1)];
trajectories{ii} = path + deviation;
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Select trajectory for tracking
selected_traj = trajectories{1};
numParticles = 1000;
stateDimension = 4;
init_state = [selected_traj(1, 1); 0;…
selected_traj(1, 2); 0];
pf = trackingPF(@constvel, @cvmeas, init_state, …
‘StateCovariance’, 0.5 * eye(stateDimension), …
‘NumParticles’, numParticles, …
‘HasAdditiveProcessNoise’, true);
% Particle filter tracking
estimated_positions_pf = …
zeros(size(selected_traj, 1), stateDimension);
pf_tot = cell(size(selected_traj, 1),1);
estimated_positions_pf(1, 🙂 = init_state’;
pf_no_km = clone(pf);
for t = 2:size(selected_traj, 1)
[xPred_pf, PPred_pf] = predict(pf_no_km, 1);
observation = …
[selected_traj(t, 1); selected_traj(t, 2); 0];
[xCorr_km, Pcorr_km] = correct(pf, observation);
[xCorr_pf, Pcorr_pf] = correct(pf_no_km, observation);
estimated_positions_pf(t, 🙂 = xCorr_pf;
pf_tot{t} = Pcorr_pf;
end
% Plot tracking results
figure (101);
plot(selected_traj(:, 1), selected_traj(:, 2), ‘g’, …
‘DisplayName’, ‘True Trajectory’);
hold on;
plot(estimated_positions_pf(:, 1), …
estimated_positions_pf(:, 3), ‘bo-.’, …
‘DisplayName’, ‘Estimated (No KM)’);
title(‘Tracking Map’);
legend;
xlabel(‘X’);
ylabel(‘Y’);
hold off;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% OSPA metric computation
truths_mine = …
[selected_traj zeros(size(selected_traj,1),1)];
%%
% Construct the truth and tracks structs
num_timesteps = size(selected_traj, 1);
truths_cell = cell(1,num_timesteps);
tracks_PF_cell = cell(1,num_timesteps);
% Compute velocities for truth data
velocities_truth = diff(truths_mine); % Approximate velocity (forward difference)
velocities_truth = [0 0 0;velocities_truth];
for t = 1:num_timesteps
% Truth struct
truth_struct = struct();
truth_struct.PlatformID = 1;
truth_struct.Time = t; % Time step
truth_struct.Position = …
[selected_traj(t, 1); selected_traj(t, 2);0]’; % Position [x; y]
% if t < num_timesteps
truth_struct.Velocity = velocities_truth(t, :); % Velocity [vx; vy]
truths_cell{t} = truth_struct;
% Tracks struct
tracks_struct_PF = struct();
tracks_struct_PF.UpdateTime = t; % Time step
tracks_struct_PF.State = …
[estimated_positions_pf(t, :),0,0]’;%; estimated_positions_pf(t, 3);0]; % Estimated position [x; y]
tracks_struct_PF.TrackID = 1;
if t==1
tracks_struct_PF.StateCovariance = [1 0 0 0 0 0; 0 1 0 0 0 0; 0 0 1 0 0 0; 0 0 0 1 0 0; 0 0 0 0 0 0 ; 0 0 0 0 0 0 ];
else
pf_cov = [pf_tot{t};zeros(2,4)];
pf_cov2 = [pf_cov, zeros(6,2)];
tracks_struct_KM.StateCovariance = pf_cov2;
end
tracks_PF_cell{t} = tracks_struct_PF;
end
%%
tom = trackOSPAMetric;
ospa = zeros(numel(tracks_PF_cell),1);
cardOspa = zeros(numel(tracks_PF_cell),1);
locOspa = zeros(numel(tracks_PF_cell),1);
for ik = 1:numel(tracks_PF_cell)
ik
tracks_mi = tracks_PF_cell{ik}
truths_mi = truths_cell{ik}
[ospa(ik), locOspa(ik), cardOspa(ik)] = tom(tracks_mi, truths_mi);
end
%%
% Compute square error between truth and track locations
error_pf = (selected_traj(:, 1) – estimated_positions_pf(:, 1)).^2 + …
(selected_traj(:, 2) – estimated_positions_pf(:, 3)).^2;
Here is the error:
Error using assignjv
Expected COSTMATRIX to be non-NaN.
Error in fusion.internal.assignment.lapCheckCostMatrix (line 10)
validateattributes(costMatrix, {‘single’,’double’}, …
Error in assignjv (line 110)
fusion.internal.assignment.lapCheckCostMatrix(costMatrix, mfilename);
Error in fusion.internal.metrics.OSPABase/stepImpl (line 219)
optimalAssignment = assignjv(dMatrix, 2*cN);
Error in trackOSPAMetric/stepImpl (line 305)
[locOspa, cardOspa, optimalAssignment] = stepImpl@fusion.internal.metrics.OSPABase(obj, tracks, truths);
Error in OnlyPF (line 139)
[ospa(ik), locOspa(ik), cardOspa(ik)] = tom(tracks_mi, truths_mi);
>> ospa, tracking, particle filter, sensor fusion and tracking toolbox MATLAB Answers — New Questions