Category: Matlab
Category Archives: Matlab
How to compare two measurement datas from 2 different devices?
Hallo,
I have two different csv measurements(xyz) from 2 different devices. One is a device doing spiral scanning and other is an interferometer. Since both of the devices will give different xyz. I am scanning the same workpiece in both devices. In order to do better comparison, i believe i need xyz almost close to each other for the devices,so how can i do it? Is the interpolation over common grid (x,y) works or is there any other better options?Hallo,
I have two different csv measurements(xyz) from 2 different devices. One is a device doing spiral scanning and other is an interferometer. Since both of the devices will give different xyz. I am scanning the same workpiece in both devices. In order to do better comparison, i believe i need xyz almost close to each other for the devices,so how can i do it? Is the interpolation over common grid (x,y) works or is there any other better options? Hallo,
I have two different csv measurements(xyz) from 2 different devices. One is a device doing spiral scanning and other is an interferometer. Since both of the devices will give different xyz. I am scanning the same workpiece in both devices. In order to do better comparison, i believe i need xyz almost close to each other for the devices,so how can i do it? Is the interpolation over common grid (x,y) works or is there any other better options? interpolation, averaging MATLAB Answers — New Questions
How do I prevent motor from entering reverse generating region, and stay in forward motoring region?
I am trying to simulate an electric motor for an aircraft, but when I input my reference speed and torque demand, the motor seems to enter reverse generating instead of forward motoring.
The motor parameters are as such:
The motor’s torque output vs torque demand as shown:
However, the motor’s rpm output vs reference rpm is as shown:
Is there a way to "force" the motor to stay in quadrant 1 as opposed to entering quadrant 4?I am trying to simulate an electric motor for an aircraft, but when I input my reference speed and torque demand, the motor seems to enter reverse generating instead of forward motoring.
The motor parameters are as such:
The motor’s torque output vs torque demand as shown:
However, the motor’s rpm output vs reference rpm is as shown:
Is there a way to "force" the motor to stay in quadrant 1 as opposed to entering quadrant 4? I am trying to simulate an electric motor for an aircraft, but when I input my reference speed and torque demand, the motor seems to enter reverse generating instead of forward motoring.
The motor parameters are as such:
The motor’s torque output vs torque demand as shown:
However, the motor’s rpm output vs reference rpm is as shown:
Is there a way to "force" the motor to stay in quadrant 1 as opposed to entering quadrant 4? simulink, simscape MATLAB Answers — New Questions
Por favor el pzmap código
-que símbolos y nomencaltura usa-que símbolos y nomencaltura usa -que símbolos y nomencaltura usa diagrama pz MATLAB Answers — New Questions
Issue Related to Interfacing simulink with arduino hardware
Hi. This is the error I am getting. I had installed the simulink for arduino add on for hardware support
And also sort for the COM port issue as mentioned in your web site
### Starting build procedure for: Lab_1_2 "### Generating static library." "F:/waqas/bin/win64/gmake" -j5 -C "C:/PROGRA~3/MATLAB/SUPPOR~1/R2023b/toolbox/target/SUPPOR~1/ARDUIN~2/STATIC~1" SHELL="%SystemRoot%/system32/cmd.exe" -f avrcore.mk all gmake[1]: Entering directory C:/PROGRA~3/MATLAB/SUPPOR~1/R2023b/toolbox/target/SUPPOR~1/ARDUIN~2/STATIC~1′ "### Successfully generated libcore.a library." gmake[1]: Leaving directory C:/PROGRA~3/MATLAB/SUPPOR~1/R2023b/toolbox/target/SUPPOR~1/ARDUIN~2/STATIC~1′ "F:/waqas/bin/win64/gmake" -j5 SHELL="%SystemRoot%/system32/cmd.exe" -f "Lab_1_2.mk" all gmake[1]: Entering directory F:/ACE Box/Lab 1.2/Lab_1_2_ert_rtw’ "C:/ProgramData/MATLAB/SupportPackages/R2023b/aIDE/hardware/tools/avr/bin/avr-g++" -std=gnu++11 -fpermissive -fno-exceptions -fno-threadsafe-statics -c -w -ffunction-sections -fdata-sections -MMD -DARDUINO=10801 -MMD -MP -MF"MW_arduino_digitalio.dep" -MT"MW_arduino_digitalio.o" -Os -g -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -D_RUNONTARGETHARDWARE_BUILD_ -DXCP_ADDRESS_GRANULARITY=XCP_ADDRESS_GRANULARITY_BYTE -DCODERTARGET_XCP_DAQ_PACKED_MODE -DCODERTARGET_XCP_MAX_CONTIGUOUS_SAMPLES=2 -D__MW_TARGET_USE_HARDWARE_RESOURCES_H__ -DMW_TIMERID=1 -DMW_PRESCALAR=256 -DMW_TIMERCOUNT=59286 -DMW_SCHEDULERCOUNTER=1 -DARDUINO_NUM_SERIAL_PORTS=1 -D_RTT_BAUDRATE_SERIAL0_=9600 -D_RTT_CONFIG_SERIAL0_=SERIAL_8N1 -D_RTT_ANALOG_REF_=0 -DMW_RTIO_SERIAL0 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DEXT_MODE=1 -DONESTEPFCN=1 -DTERMFCN=1 -DMULTI_INSTANCE_CODE=0 -DINTEGER_CODE=0 -DMT=0 -DXCP_EXTMODE_SIMULATION_TIME_IN_TICKS -DXCP_DAQ_SUPPORT -DXCP_CALIBRATION_SUPPORT -DXCP_TIMESTAMP_SUPPORT -DXCP_TIMESTAMP_BASED_ON_SIMULATION_TIME -DXCP_SET_MTA_SUPPORT -DEXTMODE_XCP_TRIGGER_SUPPORT -DXCP_MEM_BLOCK_1_SIZE=32 -DXCP_MEM_BLOCK_1_NUMBER=1 -DXCP_MEM_BLOCK_2_SIZE=56 -DXCP_MEM_BLOCK_2_NUMBER=1 -DXCP_MEM_BLOCK_3_SIZE=8 -DXCP_MEM_BLOCK_3_NUMBER=1 -DXCP_MEM_RESERVED_POOLS_TOTAL_SIZE=212 -DXCP_MEM_RESERVED_POOLS_NUMBER=2 -DXCP_MEM_DAQ_RESERVED_POOL_BLOCKS_NUMBER=2 -DXCP_MEM_DAQ_RESERVED_POOLS_NUMBER=1 -DXCP_MIN_EVENT_NO_RESERVED_POOL=1 -DXCP_MAX_CTO_SIZE=32 -DXCP_MAX_DTO_SIZE=65532 -DXCP_MAX_ODT_ENTRY_SIZE=255 -DEXTMODE_STATIC -DEXTMODE_STATIC_SIZE=250 -DON_TARGET_WAIT_FOR_START=1 -DTID01EQ=0 -DXCP_CUSTOM_PLATFORM -DEXIT_FAILURE=1 -DEXTMODE_DISABLEPRINTF -DEXTMODE_DISABLETESTING -DEXTMODE_DISABLE_ARGS_PROCESSING=1 -DSTACK_SIZE=64 -DRT -DMODEL=Lab_1_2 -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -DMODEL_HAS_DYNAMICALLY_LOADED_SFCNS=0 -IF:/ACE Box/Lab 1.2 -IC:/PROGRA~3/MATLAB/SUPPOR~1/R2023b/toolbox/target/SUPPOR~1/ARDUIN~2/include -IF:/ACE Box/Lab 1.2/Lab_1_2_ert_rtw -IF:/waqas/extern/include -IF:/waqas/simulink/include -IF:/waqas/rtw/c/src -IF:/waqas/rtw/c/src/ext_mode/common -IF:/waqas/rtw/c/ert -IF:/waqas/toolbox/coder/xcp/src/target/server/include -IF:/waqas/toolbox/coder/xcp/src/target/server/common -IF:/waqas/toolbox/coder/xcp/src/target/server/protocol/src -IF:/waqas/toolbox/coder/xcp/src/target/server/protocol/include -IF:/waqas/toolbox/coder/xcp/src/target/server/transport/include -IF:/waqas/toolbox/coder/xcp/src/target/server/transport/src -IF:/waqas/toolbox/coder/xcp/src/target/server/platform/include -IF:/waqas/toolbox/coder/xcp/src/target/server/platform/default -IF:/waqas/toolbox/coder/xcp/src/target/ext_mode/include -IF:/waqas/toolbox/coder/xcp/src/target/ext_mode/src -IF:/waqas/toolbox/coder/rtiostream/src -IC:/ProgramData/MATLAB/SupportPackages/R2023b/aIDE/hardware/arduino/avr/cores/arduino -IC:/ProgramData/MATLAB/SupportPackages/R2023b/aIDE/hardware/arduino/avr/variants/standard -IC:/ProgramData/MATLAB/SupportPackages/R2023b/aIDE/libraries/Servo/src -IC:/PROGRA~3/MATLAB/SUPPOR~1/R2023b/toolbox/target/SUPPOR~1/ARDUIN~1/include -IC:/PROGRA~3/MATLAB/SUPPOR~1/R2023b/toolbox/target/SUPPOR~1/ARDUIN~1/SCHEDU~1/include –
IC:/ProgramData/MATLAB/SupportPackages/R2023b/aIDE/hardware/tools/avr/avr/include/avr -o "MW_arduino_digitalio.o" "C:/ProgramData/MATLAB/SupportPackages/R2023b/toolbox/target/supportpackages/arduinobase/src/MW_arduino_digitalio.cpp" "C:/ProgramData/MATLAB/SupportPackages/R2023b/aIDE/hardware/tools/avr/bin/avr-gcc" -std=gnu11 -c -w -ffunction-sections -fdata-sections -MMD -DARDUINO=10801 -MMD -MP -MF"xcp_ext_mode.dep" -MT"xcp_ext_mode.o" -Os -g -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -D_RUNONTARGETHARDWARE_BUILD_ -DXCP_ADDRESS_GRANULARITY=XCP_ADDRESS_GRANULARITY_BYTE -DCODERTARGET_XCP_DAQ_PACKED_MODE -DCODERTARGET_XCP_MAX_CONTIGUOUS_SAMPLES=2 -D__MW_TARGET_USE_HARDWARE_RESOURCES_H__ -DMW_TIMERID=1 -DMW_PRESCALAR=256 -DMW_TIMERCOUNT=59286 -DMW_SCHEDULERCOUNTER=1 -DARDUINO_NUM_SERIAL_PORTS=1 -D_RTT_BAUDRATE_SERIAL0_=9600 -D_RTT_CONFIG_SERIAL0_=SERIAL_8N1 -D_RTT_ANALOG_REF_=0 -DMW_RTIO_SERIAL0 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DEXT_MODE=1 -DONESTEPFCN=1 -DTERMFCN=1 -DMULTI_INSTANCE_CODE=0 -DINTEGER_CODE=0 -DMT=0 -DXCP_EXTMODE_SIMULATION_TIME_IN_TICKS -DXCP_DAQ_SUPPORT -DXCP_CALIBRATION_SUPPORT -DXCP_TIMESTAMP_SUPPORT -DXCP_TIMESTAMP_BASED_ON_SIMULATION_TIME -DXCP_SET_MTA_SUPPORT -DEXTMODE_XCP_TRIGGavr-g++: error: Box/Lab: No such file or directory ER_SUPPORT -DXCP_MEM_BLOCK_1_SIZE=32 -DXCP_MEM_BLOCK_1_NUMBER=1 -DXCP_MEM_BLOCK_2_SIZE=56 -DXCP_MEM_BLOCK_2_NUMBER=1 -DXCP_MEM_BLOCK_3_SIZE=8 -DXCP_MEM_BLOCK_3_NUMBER=1 -DXCP_MEM_RESERVED_POOLS_TOTAL_SIZE=212 -DXCP_MEM_RESERVED_POOLS_NUMBER=2 -DXCP_MEM_DAQ_RESERVED_POOL_BLOCKS_NUMBER=2 -DXCP_MEM_DAQ_RESERVED_POOLS_NUMBER=1 -DXCP_MIN_EVENT_NO_RESERVED_POOL=1 -DXCP_MAX_CTO_SIZE=32 -DXCP_MAX_DTO_SIZE=65532 -DXCP_MAX_ODT_ENTRY_SIZE=255 -DEXTMODE_STATIC -DEXTMODE_STATIC_SIZE=250 -DON_TARGET_WAIT_FOR_START=1 -DTID01EQ=0 -DXCP_CUSTOM_PLATFORM -DEXIT_FAILURE=1 -DEXTMODE_DISABLEPRINTF -DEXTMODE_DISABLETESTING -DEXTMODE_DISABLE_ARGS_PROCESSING=1 -DSTACK_SIZE=64 -DRT -DMODEL=Lab_1_2 -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -DMODEL_HAS_DYNAMICALLY_LOADED_SFCNS=0 -IF:/ACE Box/Lab 1.2 -IC:/PROGRA~3/MATLAB/SUPPOR~1/R2023b/toolbox/target/SUPPOR~1/ARDUIN~2/include -IF:/ACE Box/Lab 1.2/Lab_1_2_ert_rtw -IF:/waqas/extern/include -IF:/waqas/simulink/include -IF:/waqas/rtw/c/src -IF:/waqas/rtw/c/src/ext_mode/common -IF:/waqas/rtw/c/ert -IF:/waqas/toolbox/coder/xcp/src/target/server/include -IF:/waqas/toolbox/coder/xcp/src/target/server/common -IF:/waqas/toolbox/coder/xcp/src/target/server/protocol/src -IF:/waqas/toolbox/coder/xcp/src/target/server/protocol/include -IF:/waqas/toolbox/coder/xcp/src/target/server/transport/include -IF:/waqas/toolbox/coder/xcp/src/target/server/transport/src -IF:/waqas/toolbox/coder/xcp/src/target/server/platform/include -IF:/waqas/toolbox/coder/xcp/src/target/server/platform/default -IF:/waqas/toolbox/coder/xcp/src/target/ext_mode/include -IF:/waqas/toolbox/coder/xcp/src/target/ext_mode/src -IF:/waqas/toolbox/coder/rtiostream/src -IC:/ProgramData/MATLAB/SupportPackages/R2023b/aIDE/hardware/arduino/avr/cores/arduino -IC:/ProgramData/MATLAB/SupportPackages/R2023b/aIDE/hardware/arduino/avr/variants/standard -IC:/ProgramData/MATLAB/SupportPackages/R2023b/aIDE/libraries/Servo/src -IC:/PROGRA~3/MATLAB/SUPPOR~1/R2023b/toolbox/target/SUPPOR~1/ARDUIN~1/include -IC:/PROGRA~3/MATLAB/SUPPOR~1/R2023b/toolbox/target/SUPPOR~1/ARDUIN~1/SCHEDU~1/include -IC:/ProgramData/MATLAB/SupportPackages/R2023b/aIDE/hardware/tools/avr/avr/include/avr -o "xcp_ext_mode.o" "F:/waqas/toolbox/coder/xcp/src/target/ext_mode/src/xcp_ext_mode.c" avr-g++: error: 1.2: No such file or directory avr-g++: error: Box/Lab: No such file or directory avr-g++: error: 1.2/Lab_1_2_ert_rtw: No such file or directory gmake[1]: *** No rule to make target F:/ACE’, needed by Lab_1_2.o’. Stop. gmake[1]: *** Waiting for unfinished jobs…. gmake[1]: *** [MW_arduino_digitalio.o] Error 1 avr-gcc: error: Box/Lab: No such file or directory avr-gcc: error: 1.2: No such file or directory avr-gcc: error: Box/Lab: No such file or directory avr-gcc: error: 1.2/Lab_1_2_ert_rtw: No such file or directory gmake[1]: *** [xcp_ext_mode.o] Error 1 gmake[1]: Leaving directory F:/ACE Box/Lab 1.2/Lab_1_2_ert_rtw’ gmake: *** [all] Error 2 The make command returned an error of 2 ### Build procedure for Lab_1_2 aborted due to an error. Build Summary Top model targets built: Model Action Rebuild Reason =================================================================== Lab_1_2 Failed Code generation information file does not exist. 0 of 1 models built (0 models already up to date) Build duration: 0h 2m 8.7477sHi. This is the error I am getting. I had installed the simulink for arduino add on for hardware support
And also sort for the COM port issue as mentioned in your web site
### Starting build procedure for: Lab_1_2 "### Generating static library." "F:/waqas/bin/win64/gmake" -j5 -C "C:/PROGRA~3/MATLAB/SUPPOR~1/R2023b/toolbox/target/SUPPOR~1/ARDUIN~2/STATIC~1" SHELL="%SystemRoot%/system32/cmd.exe" -f avrcore.mk all gmake[1]: Entering directory C:/PROGRA~3/MATLAB/SUPPOR~1/R2023b/toolbox/target/SUPPOR~1/ARDUIN~2/STATIC~1′ "### Successfully generated libcore.a library." gmake[1]: Leaving directory C:/PROGRA~3/MATLAB/SUPPOR~1/R2023b/toolbox/target/SUPPOR~1/ARDUIN~2/STATIC~1′ "F:/waqas/bin/win64/gmake" -j5 SHELL="%SystemRoot%/system32/cmd.exe" -f "Lab_1_2.mk" all gmake[1]: Entering directory F:/ACE Box/Lab 1.2/Lab_1_2_ert_rtw’ "C:/ProgramData/MATLAB/SupportPackages/R2023b/aIDE/hardware/tools/avr/bin/avr-g++" -std=gnu++11 -fpermissive -fno-exceptions -fno-threadsafe-statics -c -w -ffunction-sections -fdata-sections -MMD -DARDUINO=10801 -MMD -MP -MF"MW_arduino_digitalio.dep" -MT"MW_arduino_digitalio.o" -Os -g -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -D_RUNONTARGETHARDWARE_BUILD_ -DXCP_ADDRESS_GRANULARITY=XCP_ADDRESS_GRANULARITY_BYTE -DCODERTARGET_XCP_DAQ_PACKED_MODE -DCODERTARGET_XCP_MAX_CONTIGUOUS_SAMPLES=2 -D__MW_TARGET_USE_HARDWARE_RESOURCES_H__ -DMW_TIMERID=1 -DMW_PRESCALAR=256 -DMW_TIMERCOUNT=59286 -DMW_SCHEDULERCOUNTER=1 -DARDUINO_NUM_SERIAL_PORTS=1 -D_RTT_BAUDRATE_SERIAL0_=9600 -D_RTT_CONFIG_SERIAL0_=SERIAL_8N1 -D_RTT_ANALOG_REF_=0 -DMW_RTIO_SERIAL0 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DEXT_MODE=1 -DONESTEPFCN=1 -DTERMFCN=1 -DMULTI_INSTANCE_CODE=0 -DINTEGER_CODE=0 -DMT=0 -DXCP_EXTMODE_SIMULATION_TIME_IN_TICKS -DXCP_DAQ_SUPPORT -DXCP_CALIBRATION_SUPPORT -DXCP_TIMESTAMP_SUPPORT -DXCP_TIMESTAMP_BASED_ON_SIMULATION_TIME -DXCP_SET_MTA_SUPPORT -DEXTMODE_XCP_TRIGGER_SUPPORT -DXCP_MEM_BLOCK_1_SIZE=32 -DXCP_MEM_BLOCK_1_NUMBER=1 -DXCP_MEM_BLOCK_2_SIZE=56 -DXCP_MEM_BLOCK_2_NUMBER=1 -DXCP_MEM_BLOCK_3_SIZE=8 -DXCP_MEM_BLOCK_3_NUMBER=1 -DXCP_MEM_RESERVED_POOLS_TOTAL_SIZE=212 -DXCP_MEM_RESERVED_POOLS_NUMBER=2 -DXCP_MEM_DAQ_RESERVED_POOL_BLOCKS_NUMBER=2 -DXCP_MEM_DAQ_RESERVED_POOLS_NUMBER=1 -DXCP_MIN_EVENT_NO_RESERVED_POOL=1 -DXCP_MAX_CTO_SIZE=32 -DXCP_MAX_DTO_SIZE=65532 -DXCP_MAX_ODT_ENTRY_SIZE=255 -DEXTMODE_STATIC -DEXTMODE_STATIC_SIZE=250 -DON_TARGET_WAIT_FOR_START=1 -DTID01EQ=0 -DXCP_CUSTOM_PLATFORM -DEXIT_FAILURE=1 -DEXTMODE_DISABLEPRINTF -DEXTMODE_DISABLETESTING -DEXTMODE_DISABLE_ARGS_PROCESSING=1 -DSTACK_SIZE=64 -DRT -DMODEL=Lab_1_2 -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -DMODEL_HAS_DYNAMICALLY_LOADED_SFCNS=0 -IF:/ACE Box/Lab 1.2 -IC:/PROGRA~3/MATLAB/SUPPOR~1/R2023b/toolbox/target/SUPPOR~1/ARDUIN~2/include -IF:/ACE Box/Lab 1.2/Lab_1_2_ert_rtw -IF:/waqas/extern/include -IF:/waqas/simulink/include -IF:/waqas/rtw/c/src -IF:/waqas/rtw/c/src/ext_mode/common -IF:/waqas/rtw/c/ert -IF:/waqas/toolbox/coder/xcp/src/target/server/include -IF:/waqas/toolbox/coder/xcp/src/target/server/common -IF:/waqas/toolbox/coder/xcp/src/target/server/protocol/src -IF:/waqas/toolbox/coder/xcp/src/target/server/protocol/include -IF:/waqas/toolbox/coder/xcp/src/target/server/transport/include -IF:/waqas/toolbox/coder/xcp/src/target/server/transport/src -IF:/waqas/toolbox/coder/xcp/src/target/server/platform/include -IF:/waqas/toolbox/coder/xcp/src/target/server/platform/default -IF:/waqas/toolbox/coder/xcp/src/target/ext_mode/include -IF:/waqas/toolbox/coder/xcp/src/target/ext_mode/src -IF:/waqas/toolbox/coder/rtiostream/src -IC:/ProgramData/MATLAB/SupportPackages/R2023b/aIDE/hardware/arduino/avr/cores/arduino -IC:/ProgramData/MATLAB/SupportPackages/R2023b/aIDE/hardware/arduino/avr/variants/standard -IC:/ProgramData/MATLAB/SupportPackages/R2023b/aIDE/libraries/Servo/src -IC:/PROGRA~3/MATLAB/SUPPOR~1/R2023b/toolbox/target/SUPPOR~1/ARDUIN~1/include -IC:/PROGRA~3/MATLAB/SUPPOR~1/R2023b/toolbox/target/SUPPOR~1/ARDUIN~1/SCHEDU~1/include –
IC:/ProgramData/MATLAB/SupportPackages/R2023b/aIDE/hardware/tools/avr/avr/include/avr -o "MW_arduino_digitalio.o" "C:/ProgramData/MATLAB/SupportPackages/R2023b/toolbox/target/supportpackages/arduinobase/src/MW_arduino_digitalio.cpp" "C:/ProgramData/MATLAB/SupportPackages/R2023b/aIDE/hardware/tools/avr/bin/avr-gcc" -std=gnu11 -c -w -ffunction-sections -fdata-sections -MMD -DARDUINO=10801 -MMD -MP -MF"xcp_ext_mode.dep" -MT"xcp_ext_mode.o" -Os -g -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -D_RUNONTARGETHARDWARE_BUILD_ -DXCP_ADDRESS_GRANULARITY=XCP_ADDRESS_GRANULARITY_BYTE -DCODERTARGET_XCP_DAQ_PACKED_MODE -DCODERTARGET_XCP_MAX_CONTIGUOUS_SAMPLES=2 -D__MW_TARGET_USE_HARDWARE_RESOURCES_H__ -DMW_TIMERID=1 -DMW_PRESCALAR=256 -DMW_TIMERCOUNT=59286 -DMW_SCHEDULERCOUNTER=1 -DARDUINO_NUM_SERIAL_PORTS=1 -D_RTT_BAUDRATE_SERIAL0_=9600 -D_RTT_CONFIG_SERIAL0_=SERIAL_8N1 -D_RTT_ANALOG_REF_=0 -DMW_RTIO_SERIAL0 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DEXT_MODE=1 -DONESTEPFCN=1 -DTERMFCN=1 -DMULTI_INSTANCE_CODE=0 -DINTEGER_CODE=0 -DMT=0 -DXCP_EXTMODE_SIMULATION_TIME_IN_TICKS -DXCP_DAQ_SUPPORT -DXCP_CALIBRATION_SUPPORT -DXCP_TIMESTAMP_SUPPORT -DXCP_TIMESTAMP_BASED_ON_SIMULATION_TIME -DXCP_SET_MTA_SUPPORT -DEXTMODE_XCP_TRIGGavr-g++: error: Box/Lab: No such file or directory ER_SUPPORT -DXCP_MEM_BLOCK_1_SIZE=32 -DXCP_MEM_BLOCK_1_NUMBER=1 -DXCP_MEM_BLOCK_2_SIZE=56 -DXCP_MEM_BLOCK_2_NUMBER=1 -DXCP_MEM_BLOCK_3_SIZE=8 -DXCP_MEM_BLOCK_3_NUMBER=1 -DXCP_MEM_RESERVED_POOLS_TOTAL_SIZE=212 -DXCP_MEM_RESERVED_POOLS_NUMBER=2 -DXCP_MEM_DAQ_RESERVED_POOL_BLOCKS_NUMBER=2 -DXCP_MEM_DAQ_RESERVED_POOLS_NUMBER=1 -DXCP_MIN_EVENT_NO_RESERVED_POOL=1 -DXCP_MAX_CTO_SIZE=32 -DXCP_MAX_DTO_SIZE=65532 -DXCP_MAX_ODT_ENTRY_SIZE=255 -DEXTMODE_STATIC -DEXTMODE_STATIC_SIZE=250 -DON_TARGET_WAIT_FOR_START=1 -DTID01EQ=0 -DXCP_CUSTOM_PLATFORM -DEXIT_FAILURE=1 -DEXTMODE_DISABLEPRINTF -DEXTMODE_DISABLETESTING -DEXTMODE_DISABLE_ARGS_PROCESSING=1 -DSTACK_SIZE=64 -DRT -DMODEL=Lab_1_2 -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -DMODEL_HAS_DYNAMICALLY_LOADED_SFCNS=0 -IF:/ACE Box/Lab 1.2 -IC:/PROGRA~3/MATLAB/SUPPOR~1/R2023b/toolbox/target/SUPPOR~1/ARDUIN~2/include -IF:/ACE Box/Lab 1.2/Lab_1_2_ert_rtw -IF:/waqas/extern/include -IF:/waqas/simulink/include -IF:/waqas/rtw/c/src -IF:/waqas/rtw/c/src/ext_mode/common -IF:/waqas/rtw/c/ert -IF:/waqas/toolbox/coder/xcp/src/target/server/include -IF:/waqas/toolbox/coder/xcp/src/target/server/common -IF:/waqas/toolbox/coder/xcp/src/target/server/protocol/src -IF:/waqas/toolbox/coder/xcp/src/target/server/protocol/include -IF:/waqas/toolbox/coder/xcp/src/target/server/transport/include -IF:/waqas/toolbox/coder/xcp/src/target/server/transport/src -IF:/waqas/toolbox/coder/xcp/src/target/server/platform/include -IF:/waqas/toolbox/coder/xcp/src/target/server/platform/default -IF:/waqas/toolbox/coder/xcp/src/target/ext_mode/include -IF:/waqas/toolbox/coder/xcp/src/target/ext_mode/src -IF:/waqas/toolbox/coder/rtiostream/src -IC:/ProgramData/MATLAB/SupportPackages/R2023b/aIDE/hardware/arduino/avr/cores/arduino -IC:/ProgramData/MATLAB/SupportPackages/R2023b/aIDE/hardware/arduino/avr/variants/standard -IC:/ProgramData/MATLAB/SupportPackages/R2023b/aIDE/libraries/Servo/src -IC:/PROGRA~3/MATLAB/SUPPOR~1/R2023b/toolbox/target/SUPPOR~1/ARDUIN~1/include -IC:/PROGRA~3/MATLAB/SUPPOR~1/R2023b/toolbox/target/SUPPOR~1/ARDUIN~1/SCHEDU~1/include -IC:/ProgramData/MATLAB/SupportPackages/R2023b/aIDE/hardware/tools/avr/avr/include/avr -o "xcp_ext_mode.o" "F:/waqas/toolbox/coder/xcp/src/target/ext_mode/src/xcp_ext_mode.c" avr-g++: error: 1.2: No such file or directory avr-g++: error: Box/Lab: No such file or directory avr-g++: error: 1.2/Lab_1_2_ert_rtw: No such file or directory gmake[1]: *** No rule to make target F:/ACE’, needed by Lab_1_2.o’. Stop. gmake[1]: *** Waiting for unfinished jobs…. gmake[1]: *** [MW_arduino_digitalio.o] Error 1 avr-gcc: error: Box/Lab: No such file or directory avr-gcc: error: 1.2: No such file or directory avr-gcc: error: Box/Lab: No such file or directory avr-gcc: error: 1.2/Lab_1_2_ert_rtw: No such file or directory gmake[1]: *** [xcp_ext_mode.o] Error 1 gmake[1]: Leaving directory F:/ACE Box/Lab 1.2/Lab_1_2_ert_rtw’ gmake: *** [all] Error 2 The make command returned an error of 2 ### Build procedure for Lab_1_2 aborted due to an error. Build Summary Top model targets built: Model Action Rebuild Reason =================================================================== Lab_1_2 Failed Code generation information file does not exist. 0 of 1 models built (0 models already up to date) Build duration: 0h 2m 8.7477s Hi. This is the error I am getting. I had installed the simulink for arduino add on for hardware support
And also sort for the COM port issue as mentioned in your web site
### Starting build procedure for: Lab_1_2 "### Generating static library." "F:/waqas/bin/win64/gmake" -j5 -C "C:/PROGRA~3/MATLAB/SUPPOR~1/R2023b/toolbox/target/SUPPOR~1/ARDUIN~2/STATIC~1" SHELL="%SystemRoot%/system32/cmd.exe" -f avrcore.mk all gmake[1]: Entering directory C:/PROGRA~3/MATLAB/SUPPOR~1/R2023b/toolbox/target/SUPPOR~1/ARDUIN~2/STATIC~1′ "### Successfully generated libcore.a library." gmake[1]: Leaving directory C:/PROGRA~3/MATLAB/SUPPOR~1/R2023b/toolbox/target/SUPPOR~1/ARDUIN~2/STATIC~1′ "F:/waqas/bin/win64/gmake" -j5 SHELL="%SystemRoot%/system32/cmd.exe" -f "Lab_1_2.mk" all gmake[1]: Entering directory F:/ACE Box/Lab 1.2/Lab_1_2_ert_rtw’ "C:/ProgramData/MATLAB/SupportPackages/R2023b/aIDE/hardware/tools/avr/bin/avr-g++" -std=gnu++11 -fpermissive -fno-exceptions -fno-threadsafe-statics -c -w -ffunction-sections -fdata-sections -MMD -DARDUINO=10801 -MMD -MP -MF"MW_arduino_digitalio.dep" -MT"MW_arduino_digitalio.o" -Os -g -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -D_RUNONTARGETHARDWARE_BUILD_ -DXCP_ADDRESS_GRANULARITY=XCP_ADDRESS_GRANULARITY_BYTE -DCODERTARGET_XCP_DAQ_PACKED_MODE -DCODERTARGET_XCP_MAX_CONTIGUOUS_SAMPLES=2 -D__MW_TARGET_USE_HARDWARE_RESOURCES_H__ -DMW_TIMERID=1 -DMW_PRESCALAR=256 -DMW_TIMERCOUNT=59286 -DMW_SCHEDULERCOUNTER=1 -DARDUINO_NUM_SERIAL_PORTS=1 -D_RTT_BAUDRATE_SERIAL0_=9600 -D_RTT_CONFIG_SERIAL0_=SERIAL_8N1 -D_RTT_ANALOG_REF_=0 -DMW_RTIO_SERIAL0 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DEXT_MODE=1 -DONESTEPFCN=1 -DTERMFCN=1 -DMULTI_INSTANCE_CODE=0 -DINTEGER_CODE=0 -DMT=0 -DXCP_EXTMODE_SIMULATION_TIME_IN_TICKS -DXCP_DAQ_SUPPORT -DXCP_CALIBRATION_SUPPORT -DXCP_TIMESTAMP_SUPPORT -DXCP_TIMESTAMP_BASED_ON_SIMULATION_TIME -DXCP_SET_MTA_SUPPORT -DEXTMODE_XCP_TRIGGER_SUPPORT -DXCP_MEM_BLOCK_1_SIZE=32 -DXCP_MEM_BLOCK_1_NUMBER=1 -DXCP_MEM_BLOCK_2_SIZE=56 -DXCP_MEM_BLOCK_2_NUMBER=1 -DXCP_MEM_BLOCK_3_SIZE=8 -DXCP_MEM_BLOCK_3_NUMBER=1 -DXCP_MEM_RESERVED_POOLS_TOTAL_SIZE=212 -DXCP_MEM_RESERVED_POOLS_NUMBER=2 -DXCP_MEM_DAQ_RESERVED_POOL_BLOCKS_NUMBER=2 -DXCP_MEM_DAQ_RESERVED_POOLS_NUMBER=1 -DXCP_MIN_EVENT_NO_RESERVED_POOL=1 -DXCP_MAX_CTO_SIZE=32 -DXCP_MAX_DTO_SIZE=65532 -DXCP_MAX_ODT_ENTRY_SIZE=255 -DEXTMODE_STATIC -DEXTMODE_STATIC_SIZE=250 -DON_TARGET_WAIT_FOR_START=1 -DTID01EQ=0 -DXCP_CUSTOM_PLATFORM -DEXIT_FAILURE=1 -DEXTMODE_DISABLEPRINTF -DEXTMODE_DISABLETESTING -DEXTMODE_DISABLE_ARGS_PROCESSING=1 -DSTACK_SIZE=64 -DRT -DMODEL=Lab_1_2 -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -DMODEL_HAS_DYNAMICALLY_LOADED_SFCNS=0 -IF:/ACE Box/Lab 1.2 -IC:/PROGRA~3/MATLAB/SUPPOR~1/R2023b/toolbox/target/SUPPOR~1/ARDUIN~2/include -IF:/ACE Box/Lab 1.2/Lab_1_2_ert_rtw -IF:/waqas/extern/include -IF:/waqas/simulink/include -IF:/waqas/rtw/c/src -IF:/waqas/rtw/c/src/ext_mode/common -IF:/waqas/rtw/c/ert -IF:/waqas/toolbox/coder/xcp/src/target/server/include -IF:/waqas/toolbox/coder/xcp/src/target/server/common -IF:/waqas/toolbox/coder/xcp/src/target/server/protocol/src -IF:/waqas/toolbox/coder/xcp/src/target/server/protocol/include -IF:/waqas/toolbox/coder/xcp/src/target/server/transport/include -IF:/waqas/toolbox/coder/xcp/src/target/server/transport/src -IF:/waqas/toolbox/coder/xcp/src/target/server/platform/include -IF:/waqas/toolbox/coder/xcp/src/target/server/platform/default -IF:/waqas/toolbox/coder/xcp/src/target/ext_mode/include -IF:/waqas/toolbox/coder/xcp/src/target/ext_mode/src -IF:/waqas/toolbox/coder/rtiostream/src -IC:/ProgramData/MATLAB/SupportPackages/R2023b/aIDE/hardware/arduino/avr/cores/arduino -IC:/ProgramData/MATLAB/SupportPackages/R2023b/aIDE/hardware/arduino/avr/variants/standard -IC:/ProgramData/MATLAB/SupportPackages/R2023b/aIDE/libraries/Servo/src -IC:/PROGRA~3/MATLAB/SUPPOR~1/R2023b/toolbox/target/SUPPOR~1/ARDUIN~1/include -IC:/PROGRA~3/MATLAB/SUPPOR~1/R2023b/toolbox/target/SUPPOR~1/ARDUIN~1/SCHEDU~1/include –
IC:/ProgramData/MATLAB/SupportPackages/R2023b/aIDE/hardware/tools/avr/avr/include/avr -o "MW_arduino_digitalio.o" "C:/ProgramData/MATLAB/SupportPackages/R2023b/toolbox/target/supportpackages/arduinobase/src/MW_arduino_digitalio.cpp" "C:/ProgramData/MATLAB/SupportPackages/R2023b/aIDE/hardware/tools/avr/bin/avr-gcc" -std=gnu11 -c -w -ffunction-sections -fdata-sections -MMD -DARDUINO=10801 -MMD -MP -MF"xcp_ext_mode.dep" -MT"xcp_ext_mode.o" -Os -g -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -D_RUNONTARGETHARDWARE_BUILD_ -DXCP_ADDRESS_GRANULARITY=XCP_ADDRESS_GRANULARITY_BYTE -DCODERTARGET_XCP_DAQ_PACKED_MODE -DCODERTARGET_XCP_MAX_CONTIGUOUS_SAMPLES=2 -D__MW_TARGET_USE_HARDWARE_RESOURCES_H__ -DMW_TIMERID=1 -DMW_PRESCALAR=256 -DMW_TIMERCOUNT=59286 -DMW_SCHEDULERCOUNTER=1 -DARDUINO_NUM_SERIAL_PORTS=1 -D_RTT_BAUDRATE_SERIAL0_=9600 -D_RTT_CONFIG_SERIAL0_=SERIAL_8N1 -D_RTT_ANALOG_REF_=0 -DMW_RTIO_SERIAL0 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DEXT_MODE=1 -DONESTEPFCN=1 -DTERMFCN=1 -DMULTI_INSTANCE_CODE=0 -DINTEGER_CODE=0 -DMT=0 -DXCP_EXTMODE_SIMULATION_TIME_IN_TICKS -DXCP_DAQ_SUPPORT -DXCP_CALIBRATION_SUPPORT -DXCP_TIMESTAMP_SUPPORT -DXCP_TIMESTAMP_BASED_ON_SIMULATION_TIME -DXCP_SET_MTA_SUPPORT -DEXTMODE_XCP_TRIGGavr-g++: error: Box/Lab: No such file or directory ER_SUPPORT -DXCP_MEM_BLOCK_1_SIZE=32 -DXCP_MEM_BLOCK_1_NUMBER=1 -DXCP_MEM_BLOCK_2_SIZE=56 -DXCP_MEM_BLOCK_2_NUMBER=1 -DXCP_MEM_BLOCK_3_SIZE=8 -DXCP_MEM_BLOCK_3_NUMBER=1 -DXCP_MEM_RESERVED_POOLS_TOTAL_SIZE=212 -DXCP_MEM_RESERVED_POOLS_NUMBER=2 -DXCP_MEM_DAQ_RESERVED_POOL_BLOCKS_NUMBER=2 -DXCP_MEM_DAQ_RESERVED_POOLS_NUMBER=1 -DXCP_MIN_EVENT_NO_RESERVED_POOL=1 -DXCP_MAX_CTO_SIZE=32 -DXCP_MAX_DTO_SIZE=65532 -DXCP_MAX_ODT_ENTRY_SIZE=255 -DEXTMODE_STATIC -DEXTMODE_STATIC_SIZE=250 -DON_TARGET_WAIT_FOR_START=1 -DTID01EQ=0 -DXCP_CUSTOM_PLATFORM -DEXIT_FAILURE=1 -DEXTMODE_DISABLEPRINTF -DEXTMODE_DISABLETESTING -DEXTMODE_DISABLE_ARGS_PROCESSING=1 -DSTACK_SIZE=64 -DRT -DMODEL=Lab_1_2 -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -DMODEL_HAS_DYNAMICALLY_LOADED_SFCNS=0 -IF:/ACE Box/Lab 1.2 -IC:/PROGRA~3/MATLAB/SUPPOR~1/R2023b/toolbox/target/SUPPOR~1/ARDUIN~2/include -IF:/ACE Box/Lab 1.2/Lab_1_2_ert_rtw -IF:/waqas/extern/include -IF:/waqas/simulink/include -IF:/waqas/rtw/c/src -IF:/waqas/rtw/c/src/ext_mode/common -IF:/waqas/rtw/c/ert -IF:/waqas/toolbox/coder/xcp/src/target/server/include -IF:/waqas/toolbox/coder/xcp/src/target/server/common -IF:/waqas/toolbox/coder/xcp/src/target/server/protocol/src -IF:/waqas/toolbox/coder/xcp/src/target/server/protocol/include -IF:/waqas/toolbox/coder/xcp/src/target/server/transport/include -IF:/waqas/toolbox/coder/xcp/src/target/server/transport/src -IF:/waqas/toolbox/coder/xcp/src/target/server/platform/include -IF:/waqas/toolbox/coder/xcp/src/target/server/platform/default -IF:/waqas/toolbox/coder/xcp/src/target/ext_mode/include -IF:/waqas/toolbox/coder/xcp/src/target/ext_mode/src -IF:/waqas/toolbox/coder/rtiostream/src -IC:/ProgramData/MATLAB/SupportPackages/R2023b/aIDE/hardware/arduino/avr/cores/arduino -IC:/ProgramData/MATLAB/SupportPackages/R2023b/aIDE/hardware/arduino/avr/variants/standard -IC:/ProgramData/MATLAB/SupportPackages/R2023b/aIDE/libraries/Servo/src -IC:/PROGRA~3/MATLAB/SUPPOR~1/R2023b/toolbox/target/SUPPOR~1/ARDUIN~1/include -IC:/PROGRA~3/MATLAB/SUPPOR~1/R2023b/toolbox/target/SUPPOR~1/ARDUIN~1/SCHEDU~1/include -IC:/ProgramData/MATLAB/SupportPackages/R2023b/aIDE/hardware/tools/avr/avr/include/avr -o "xcp_ext_mode.o" "F:/waqas/toolbox/coder/xcp/src/target/ext_mode/src/xcp_ext_mode.c" avr-g++: error: 1.2: No such file or directory avr-g++: error: Box/Lab: No such file or directory avr-g++: error: 1.2/Lab_1_2_ert_rtw: No such file or directory gmake[1]: *** No rule to make target F:/ACE’, needed by Lab_1_2.o’. Stop. gmake[1]: *** Waiting for unfinished jobs…. gmake[1]: *** [MW_arduino_digitalio.o] Error 1 avr-gcc: error: Box/Lab: No such file or directory avr-gcc: error: 1.2: No such file or directory avr-gcc: error: Box/Lab: No such file or directory avr-gcc: error: 1.2/Lab_1_2_ert_rtw: No such file or directory gmake[1]: *** [xcp_ext_mode.o] Error 1 gmake[1]: Leaving directory F:/ACE Box/Lab 1.2/Lab_1_2_ert_rtw’ gmake: *** [all] Error 2 The make command returned an error of 2 ### Build procedure for Lab_1_2 aborted due to an error. Build Summary Top model targets built: Model Action Rebuild Reason =================================================================== Lab_1_2 Failed Code generation information file does not exist. 0 of 1 models built (0 models already up to date) Build duration: 0h 2m 8.7477s arduino MATLAB Answers — New Questions
importing a table from a file with multiple tables
I want to specifically import data from Table 3 but I’m unsure how to write that in my script.
If anyone could help I’d appreciate it:)I want to specifically import data from Table 3 but I’m unsure how to write that in my script.
If anyone could help I’d appreciate it:) I want to specifically import data from Table 3 but I’m unsure how to write that in my script.
If anyone could help I’d appreciate it:) tables, importing excel data MATLAB Answers — New Questions
Error using countOnes = sum(num); when trying to count how many zeros and ones are randomly generated.
I have never used MATLAB before, and am trying to randomly generate 0s and 1s to calculate the probability of getting heads or tails on a coin. I used the code below, but keep getting an error on the line showing countOnes = sum(num); saying ‘array indices must be positive integers or logical values.’. Anyone know what might be wrong? I clicked the explain error and it wasn’t clear.
rng(‘shuffle’); %Generates a random number each time, instead of the same sequence
N = 1000; %Sets value of N to 1000 to simulate 1000 flips of the coin
num = randi([0,1], N, 1); %Generates a number 0 or 1
countOnes = sum(num);
countZeros = N – countOnes;
disp([‘Number of 1s: ‘, num2str(countOnes)]);
disp([‘Number of 0s: ‘, num2str(countZeros)]);I have never used MATLAB before, and am trying to randomly generate 0s and 1s to calculate the probability of getting heads or tails on a coin. I used the code below, but keep getting an error on the line showing countOnes = sum(num); saying ‘array indices must be positive integers or logical values.’. Anyone know what might be wrong? I clicked the explain error and it wasn’t clear.
rng(‘shuffle’); %Generates a random number each time, instead of the same sequence
N = 1000; %Sets value of N to 1000 to simulate 1000 flips of the coin
num = randi([0,1], N, 1); %Generates a number 0 or 1
countOnes = sum(num);
countZeros = N – countOnes;
disp([‘Number of 1s: ‘, num2str(countOnes)]);
disp([‘Number of 0s: ‘, num2str(countZeros)]); I have never used MATLAB before, and am trying to randomly generate 0s and 1s to calculate the probability of getting heads or tails on a coin. I used the code below, but keep getting an error on the line showing countOnes = sum(num); saying ‘array indices must be positive integers or logical values.’. Anyone know what might be wrong? I clicked the explain error and it wasn’t clear.
rng(‘shuffle’); %Generates a random number each time, instead of the same sequence
N = 1000; %Sets value of N to 1000 to simulate 1000 flips of the coin
num = randi([0,1], N, 1); %Generates a number 0 or 1
countOnes = sum(num);
countZeros = N – countOnes;
disp([‘Number of 1s: ‘, num2str(countOnes)]);
disp([‘Number of 0s: ‘, num2str(countZeros)]); random number generator, probability MATLAB Answers — New Questions
ode23 clarity and examples
clc; clearvars; close all; format short g; format compact;
global Qss Q Qjss Qj V Vj Tinss Tin Tjinss Tjin cp cpj rho rhoj UA
% Q in m^3/s, V in m^3, T in oC, cp in J/kg K, rho in kg/m^3
% Physical properties
rho = 1000; rhoj = 1000; cp = 1269; cpj = 1269; UA = 1796; % J/K s
% Geometric parameters
V = 0.2832; Vj = 0.02832;
% Steady state process parameters
Qss = 4.719e-4; Qjss = 7.078e-4; Tinss = 10; Tjinss = 93.33;
% Actual process parameters
Q = 4.719e-4; Qj = 7.078e-4; Tin = 10; Tjin = 93.33;
% Tss = 51.67; Tjss = 65.56; % in oC (steady-state values from book)
% Linear stability analysis
A11 = -(Qss/V)-(UA/(rho*V*cp));
A12 = (UA/(rho*V*cp));
A21 = (UA/(rhoj*Vj*cpj));
A22 = -(Qjss/Vj)-(UA/(rhoj*Vj*cpj));
A = [A11 A12; A21 A22];
[ev, eval] = eig(A);
exitTs = fsolve(@tankheaterss,[10 101]);
Tss = exitTs(1); Tjss = exitTs(2);
tfinal = 2000;
T0 = Tss; Tj0 = Tjss;
% Slow response – perturbation in slow direction
% T0 = Tss + 5*ev(1,1); Tj0 = Tjss + 5*ev(2,1);
% Fast response – perturbation in fast direction
% T0 = Tss + 5*ev(1,2); Tj0 = Tjss + 5*ev(2,2);
perturbedT = [T0 Tj0];
[t,TTj] = ode45(@(t,TTj) tankheater(t,TTj), [0 tfinal], perturbedT);
Tvec = TTj(:,1); Tjvec = TTj(:,2);
heattransferred = UA * (Tjvec(numel(t)) – Tvec(numel(t)));
figure;
plot(t,TTj,’o-‘)
xlabel(‘time, s’);
legend(‘Tank Temperature, oC’, ‘Jacket Temperature, oC’)
% Steady-state function
function f = tankheaterss(TTjss)
global Qss Qjss V Vj Tinss Tin Tjinss Tjin cp cpj rho rhoj UA
T = TTjss(1);
Tj = TTjss(2);
f(1) = (Qss/V)*(Tinss-T) + (UA/(rho*V*cp))*(Tj-T);
f(2) = (Qjss/Vj)*(Tjinss-Tj) – (UA/(rhoj*Vj*cpj))*(Tj-T);
end
% Dynamic function
function f = tankheater(t,TTj)
global Q Qj V Vj Tin Tjin cp cpj rho rhoj UA
T = TTj(1);
Tj = TTj(2);
f = zeros(2,1);
f(1) = (Q/V)*(Tin-T) + (UA/(rho*V*cp))*(Tj-T);
f(2) = (Qj/Vj)*(Tjin-Tj) – (UA/(rhoj*Vj*cpj))*(Tj-T);
endclc; clearvars; close all; format short g; format compact;
global Qss Q Qjss Qj V Vj Tinss Tin Tjinss Tjin cp cpj rho rhoj UA
% Q in m^3/s, V in m^3, T in oC, cp in J/kg K, rho in kg/m^3
% Physical properties
rho = 1000; rhoj = 1000; cp = 1269; cpj = 1269; UA = 1796; % J/K s
% Geometric parameters
V = 0.2832; Vj = 0.02832;
% Steady state process parameters
Qss = 4.719e-4; Qjss = 7.078e-4; Tinss = 10; Tjinss = 93.33;
% Actual process parameters
Q = 4.719e-4; Qj = 7.078e-4; Tin = 10; Tjin = 93.33;
% Tss = 51.67; Tjss = 65.56; % in oC (steady-state values from book)
% Linear stability analysis
A11 = -(Qss/V)-(UA/(rho*V*cp));
A12 = (UA/(rho*V*cp));
A21 = (UA/(rhoj*Vj*cpj));
A22 = -(Qjss/Vj)-(UA/(rhoj*Vj*cpj));
A = [A11 A12; A21 A22];
[ev, eval] = eig(A);
exitTs = fsolve(@tankheaterss,[10 101]);
Tss = exitTs(1); Tjss = exitTs(2);
tfinal = 2000;
T0 = Tss; Tj0 = Tjss;
% Slow response – perturbation in slow direction
% T0 = Tss + 5*ev(1,1); Tj0 = Tjss + 5*ev(2,1);
% Fast response – perturbation in fast direction
% T0 = Tss + 5*ev(1,2); Tj0 = Tjss + 5*ev(2,2);
perturbedT = [T0 Tj0];
[t,TTj] = ode45(@(t,TTj) tankheater(t,TTj), [0 tfinal], perturbedT);
Tvec = TTj(:,1); Tjvec = TTj(:,2);
heattransferred = UA * (Tjvec(numel(t)) – Tvec(numel(t)));
figure;
plot(t,TTj,’o-‘)
xlabel(‘time, s’);
legend(‘Tank Temperature, oC’, ‘Jacket Temperature, oC’)
% Steady-state function
function f = tankheaterss(TTjss)
global Qss Qjss V Vj Tinss Tin Tjinss Tjin cp cpj rho rhoj UA
T = TTjss(1);
Tj = TTjss(2);
f(1) = (Qss/V)*(Tinss-T) + (UA/(rho*V*cp))*(Tj-T);
f(2) = (Qjss/Vj)*(Tjinss-Tj) – (UA/(rhoj*Vj*cpj))*(Tj-T);
end
% Dynamic function
function f = tankheater(t,TTj)
global Q Qj V Vj Tin Tjin cp cpj rho rhoj UA
T = TTj(1);
Tj = TTj(2);
f = zeros(2,1);
f(1) = (Q/V)*(Tin-T) + (UA/(rho*V*cp))*(Tj-T);
f(2) = (Qj/Vj)*(Tjin-Tj) – (UA/(rhoj*Vj*cpj))*(Tj-T);
end clc; clearvars; close all; format short g; format compact;
global Qss Q Qjss Qj V Vj Tinss Tin Tjinss Tjin cp cpj rho rhoj UA
% Q in m^3/s, V in m^3, T in oC, cp in J/kg K, rho in kg/m^3
% Physical properties
rho = 1000; rhoj = 1000; cp = 1269; cpj = 1269; UA = 1796; % J/K s
% Geometric parameters
V = 0.2832; Vj = 0.02832;
% Steady state process parameters
Qss = 4.719e-4; Qjss = 7.078e-4; Tinss = 10; Tjinss = 93.33;
% Actual process parameters
Q = 4.719e-4; Qj = 7.078e-4; Tin = 10; Tjin = 93.33;
% Tss = 51.67; Tjss = 65.56; % in oC (steady-state values from book)
% Linear stability analysis
A11 = -(Qss/V)-(UA/(rho*V*cp));
A12 = (UA/(rho*V*cp));
A21 = (UA/(rhoj*Vj*cpj));
A22 = -(Qjss/Vj)-(UA/(rhoj*Vj*cpj));
A = [A11 A12; A21 A22];
[ev, eval] = eig(A);
exitTs = fsolve(@tankheaterss,[10 101]);
Tss = exitTs(1); Tjss = exitTs(2);
tfinal = 2000;
T0 = Tss; Tj0 = Tjss;
% Slow response – perturbation in slow direction
% T0 = Tss + 5*ev(1,1); Tj0 = Tjss + 5*ev(2,1);
% Fast response – perturbation in fast direction
% T0 = Tss + 5*ev(1,2); Tj0 = Tjss + 5*ev(2,2);
perturbedT = [T0 Tj0];
[t,TTj] = ode45(@(t,TTj) tankheater(t,TTj), [0 tfinal], perturbedT);
Tvec = TTj(:,1); Tjvec = TTj(:,2);
heattransferred = UA * (Tjvec(numel(t)) – Tvec(numel(t)));
figure;
plot(t,TTj,’o-‘)
xlabel(‘time, s’);
legend(‘Tank Temperature, oC’, ‘Jacket Temperature, oC’)
% Steady-state function
function f = tankheaterss(TTjss)
global Qss Qjss V Vj Tinss Tin Tjinss Tjin cp cpj rho rhoj UA
T = TTjss(1);
Tj = TTjss(2);
f(1) = (Qss/V)*(Tinss-T) + (UA/(rho*V*cp))*(Tj-T);
f(2) = (Qjss/Vj)*(Tjinss-Tj) – (UA/(rhoj*Vj*cpj))*(Tj-T);
end
% Dynamic function
function f = tankheater(t,TTj)
global Q Qj V Vj Tin Tjin cp cpj rho rhoj UA
T = TTj(1);
Tj = TTj(2);
f = zeros(2,1);
f(1) = (Q/V)*(Tin-T) + (UA/(rho*V*cp))*(Tj-T);
f(2) = (Qj/Vj)*(Tjin-Tj) – (UA/(rhoj*Vj*cpj))*(Tj-T);
end ode23 MATLAB Answers — New Questions
How to interpolate 10 csv files with different x,y,z into a common grid and average them in MATLAB?
Hello,
I have 12 CSV files from a chromatic confocal sensor.
Each file has three columns: x, y, z.
The problem:
Each measurement has different x,y and z positions, since it is spirally scanning. I found x is more deviating than y and z.
I want to create a virtual reference surface by averaging these 12 measurements.
To do that, I need to interpolate each dataset onto the same (x,y) grid before averaging.
My questions:
How can I load all 10 CSVs and interpolate them onto a common regular grid in MATLAB?
2. What is the best function for interpolation in this case (griddata, scatteredInterpolant, or something else)?
3. Once all are on the same grid, how do I average the z-values to get one final reference surface and save it as a CSV?
Any example code or workflow would be greatly appreciated.
Thanks in advance!Hello,
I have 12 CSV files from a chromatic confocal sensor.
Each file has three columns: x, y, z.
The problem:
Each measurement has different x,y and z positions, since it is spirally scanning. I found x is more deviating than y and z.
I want to create a virtual reference surface by averaging these 12 measurements.
To do that, I need to interpolate each dataset onto the same (x,y) grid before averaging.
My questions:
How can I load all 10 CSVs and interpolate them onto a common regular grid in MATLAB?
2. What is the best function for interpolation in this case (griddata, scatteredInterpolant, or something else)?
3. Once all are on the same grid, how do I average the z-values to get one final reference surface and save it as a CSV?
Any example code or workflow would be greatly appreciated.
Thanks in advance! Hello,
I have 12 CSV files from a chromatic confocal sensor.
Each file has three columns: x, y, z.
The problem:
Each measurement has different x,y and z positions, since it is spirally scanning. I found x is more deviating than y and z.
I want to create a virtual reference surface by averaging these 12 measurements.
To do that, I need to interpolate each dataset onto the same (x,y) grid before averaging.
My questions:
How can I load all 10 CSVs and interpolate them onto a common regular grid in MATLAB?
2. What is the best function for interpolation in this case (griddata, scatteredInterpolant, or something else)?
3. Once all are on the same grid, how do I average the z-values to get one final reference surface and save it as a CSV?
Any example code or workflow would be greatly appreciated.
Thanks in advance! interpolation, averaging, csv, combine MATLAB Answers — New Questions
Error when checking data points in plot
I have been running into this issue for some time. I can not hover my mouse over a plot and have the time-value information displayed. I am using ‘plot’ function to display the figure.
I get this warning in the command window:
Error in matlab.graphics.interaction.actions.Linger
Warning: Error occurred while executing the listener callback for event WindowMouseMotion defined for class matlab.ui.Figure:
Undefined function ‘convertDataToPickSpace’ for input arguments of type ‘matlab.graphics.chart.primitive.Line’.
Error in matlab.graphics.chart.interaction.dataannotatable.picking.AnnotatablePicker/convertToPickSpace (line 40)
pickLocations = convertDataToPickSpace(hContext, iter, request3D);
Error in matlab.graphics.chart.interaction.dataannotatable.picking.AnnotatablePicker/nearestSegment (line 39)
pixelLocations = obj.convertToPickSpace(hContext, varargin, valid);
Error in matlab.graphics.chart.interaction.dataannotatable.LineHelper>localGetNearestSegment (line 252)
[index1, index2, t] = utils.nearestSegment(hLine, position, isPixelPoint, data{:});
Error in matlab.graphics.chart.interaction.dataannotatable.LineHelper.getNearestPoint (line 77)
[index1, index2, t] = localGetNearestSegment(hLine, position, true);
Error in matlab.graphics.interaction.uiaxes.DataTipsBase
Error in matlab.graphics.interaction.actions.Linger/motionCallback
Error in matlab.graphics.interaction.actions.Linger
Warning says I have a missing function ‘convertDataToPickSpace’.
Am I missing a toolbox?
I am using MATLAB R2022b, but have the same issue in R2024b.
Thanks in advance!I have been running into this issue for some time. I can not hover my mouse over a plot and have the time-value information displayed. I am using ‘plot’ function to display the figure.
I get this warning in the command window:
Error in matlab.graphics.interaction.actions.Linger
Warning: Error occurred while executing the listener callback for event WindowMouseMotion defined for class matlab.ui.Figure:
Undefined function ‘convertDataToPickSpace’ for input arguments of type ‘matlab.graphics.chart.primitive.Line’.
Error in matlab.graphics.chart.interaction.dataannotatable.picking.AnnotatablePicker/convertToPickSpace (line 40)
pickLocations = convertDataToPickSpace(hContext, iter, request3D);
Error in matlab.graphics.chart.interaction.dataannotatable.picking.AnnotatablePicker/nearestSegment (line 39)
pixelLocations = obj.convertToPickSpace(hContext, varargin, valid);
Error in matlab.graphics.chart.interaction.dataannotatable.LineHelper>localGetNearestSegment (line 252)
[index1, index2, t] = utils.nearestSegment(hLine, position, isPixelPoint, data{:});
Error in matlab.graphics.chart.interaction.dataannotatable.LineHelper.getNearestPoint (line 77)
[index1, index2, t] = localGetNearestSegment(hLine, position, true);
Error in matlab.graphics.interaction.uiaxes.DataTipsBase
Error in matlab.graphics.interaction.actions.Linger/motionCallback
Error in matlab.graphics.interaction.actions.Linger
Warning says I have a missing function ‘convertDataToPickSpace’.
Am I missing a toolbox?
I am using MATLAB R2022b, but have the same issue in R2024b.
Thanks in advance! I have been running into this issue for some time. I can not hover my mouse over a plot and have the time-value information displayed. I am using ‘plot’ function to display the figure.
I get this warning in the command window:
Error in matlab.graphics.interaction.actions.Linger
Warning: Error occurred while executing the listener callback for event WindowMouseMotion defined for class matlab.ui.Figure:
Undefined function ‘convertDataToPickSpace’ for input arguments of type ‘matlab.graphics.chart.primitive.Line’.
Error in matlab.graphics.chart.interaction.dataannotatable.picking.AnnotatablePicker/convertToPickSpace (line 40)
pickLocations = convertDataToPickSpace(hContext, iter, request3D);
Error in matlab.graphics.chart.interaction.dataannotatable.picking.AnnotatablePicker/nearestSegment (line 39)
pixelLocations = obj.convertToPickSpace(hContext, varargin, valid);
Error in matlab.graphics.chart.interaction.dataannotatable.LineHelper>localGetNearestSegment (line 252)
[index1, index2, t] = utils.nearestSegment(hLine, position, isPixelPoint, data{:});
Error in matlab.graphics.chart.interaction.dataannotatable.LineHelper.getNearestPoint (line 77)
[index1, index2, t] = localGetNearestSegment(hLine, position, true);
Error in matlab.graphics.interaction.uiaxes.DataTipsBase
Error in matlab.graphics.interaction.actions.Linger/motionCallback
Error in matlab.graphics.interaction.actions.Linger
Warning says I have a missing function ‘convertDataToPickSpace’.
Am I missing a toolbox?
I am using MATLAB R2022b, but have the same issue in R2024b.
Thanks in advance! plot MATLAB Answers — New Questions
Semi-truck diesel engine modelling with Generic Engine
I used tabulated torque data, and the engine cannot seem to function normally. Trying to model the torque-rpm curve of the engine in the included PDF. Also looked at lookup tables, but with less success. Any ideas how could i replicate the curve with the most realism? Or whats actually wrong with my generic engine block? The linked system is just for trying out, and making the engine itself work. It will be part of a bigger multibody system eventually. Thanks for the help!I used tabulated torque data, and the engine cannot seem to function normally. Trying to model the torque-rpm curve of the engine in the included PDF. Also looked at lookup tables, but with less success. Any ideas how could i replicate the curve with the most realism? Or whats actually wrong with my generic engine block? The linked system is just for trying out, and making the engine itself work. It will be part of a bigger multibody system eventually. Thanks for the help! I used tabulated torque data, and the engine cannot seem to function normally. Trying to model the torque-rpm curve of the engine in the included PDF. Also looked at lookup tables, but with less success. Any ideas how could i replicate the curve with the most realism? Or whats actually wrong with my generic engine block? The linked system is just for trying out, and making the engine itself work. It will be part of a bigger multibody system eventually. Thanks for the help! generic engine MATLAB Answers — New Questions
Six-Phase PMSM FEA Block Working as Motor
Hello,
I work on dual three-phase PMSM simulation. Now, I have exported flux linkage LUTs as function of current and angle from Ansys Maxwell, and loaded them to my MATLAB workspace.
I would like to take benefit from this ready Mathworks example, which connects Motor-CAD data of 6-phase machine to Simscape simulation with the help of a customized Simscape block: https://www.mathworks.com/help/sps/ug/import-fem-motorcad-six_phase.html
But the problem is, that this customized block is implemented as a generator in this example! Can I still use it directly as a motor, just by applying voltages as input and reading mechanical quantities on outputs (i.e. by cchanging the energy flow)?? Or should I make changes on the core equations inside the block?? Maybe people who developed this example can answer me in the best way possible.
I appreciate any effort to help.
Thank you in advance,
Ali BashabshehHello,
I work on dual three-phase PMSM simulation. Now, I have exported flux linkage LUTs as function of current and angle from Ansys Maxwell, and loaded them to my MATLAB workspace.
I would like to take benefit from this ready Mathworks example, which connects Motor-CAD data of 6-phase machine to Simscape simulation with the help of a customized Simscape block: https://www.mathworks.com/help/sps/ug/import-fem-motorcad-six_phase.html
But the problem is, that this customized block is implemented as a generator in this example! Can I still use it directly as a motor, just by applying voltages as input and reading mechanical quantities on outputs (i.e. by cchanging the energy flow)?? Or should I make changes on the core equations inside the block?? Maybe people who developed this example can answer me in the best way possible.
I appreciate any effort to help.
Thank you in advance,
Ali Bashabsheh Hello,
I work on dual three-phase PMSM simulation. Now, I have exported flux linkage LUTs as function of current and angle from Ansys Maxwell, and loaded them to my MATLAB workspace.
I would like to take benefit from this ready Mathworks example, which connects Motor-CAD data of 6-phase machine to Simscape simulation with the help of a customized Simscape block: https://www.mathworks.com/help/sps/ug/import-fem-motorcad-six_phase.html
But the problem is, that this customized block is implemented as a generator in this example! Can I still use it directly as a motor, just by applying voltages as input and reading mechanical quantities on outputs (i.e. by cchanging the energy flow)?? Or should I make changes on the core equations inside the block?? Maybe people who developed this example can answer me in the best way possible.
I appreciate any effort to help.
Thank you in advance,
Ali Bashabsheh six-phase pmsm, fem-parametrized MATLAB Answers — New Questions
Is it possible to generate C code with Embedded Coder (ERT TLC) following the Google C style guide?
Hello,
I am using Embedded Coder with the ERT TLC file to generate C code from Simulink models.
I would like to know if it is possible to configure the code generator so that the generated functions and source files comply with the Google C Style Guide.
In particular, I am interested in:
Function naming conventions
Indentation and formatting rules
File structure and organization
Is there any built-in support for this, or would it require customizing TLC files and code generation templates?
Any references or examples would be very helpful.
Thank you in advance!Hello,
I am using Embedded Coder with the ERT TLC file to generate C code from Simulink models.
I would like to know if it is possible to configure the code generator so that the generated functions and source files comply with the Google C Style Guide.
In particular, I am interested in:
Function naming conventions
Indentation and formatting rules
File structure and organization
Is there any built-in support for this, or would it require customizing TLC files and code generation templates?
Any references or examples would be very helpful.
Thank you in advance! Hello,
I am using Embedded Coder with the ERT TLC file to generate C code from Simulink models.
I would like to know if it is possible to configure the code generator so that the generated functions and source files comply with the Google C Style Guide.
In particular, I am interested in:
Function naming conventions
Indentation and formatting rules
File structure and organization
Is there any built-in support for this, or would it require customizing TLC files and code generation templates?
Any references or examples would be very helpful.
Thank you in advance! embedded coder, google style, standard MATLAB Answers — New Questions
Implement data type propagation for custom block
After some discussion and playing around, I got some ways in defining a block mask that sets the Simulink (fixed point) data type of an output. i have a mask parameter called "quotype" that is a Data Type parameter, and I can pass a related parameter into my MATLAB Function block that has that data type which can then be acted upon. However, I’d like to support rules such as "Inherit: Inherit via internal rule" and "Inherit: Inherit via back propagation". To do so, I need to be able to retrieve information on the signals/ports as they’re compiling in Mask call back function. To wit: I have the current code that for instance works correctly when a specific data type is invoked:
% Initialization code section
function initialization()
if ~isa(quotype,’Simulink.NumericType’)
ports = get_param(gcb,"PortHandles");
out1 = ports.Outport(1);
in1 = ports.Inport(1);
in2 = ports.Inport(2);
disp(ports)
switch quotype
case ‘Inherit: Inherit via internal rule’
ttmp = fixdt(0,10,2);
case ‘Inherit: Inherit via back propagation’
ttmp = fixdt(0,10,2);
case ‘Inherit: Same as first input’
ttmp = fixdt(0,10,2);
otherwise
disp(quotype)
ttmp = fixdt(0,10,2);
end
qtype = fi(0,ttmp);
else
qtype = fi(0,quotype);
end
end
So, if a specific numeric type is provided in the dialog, I see I get a Simulink.NumericType object and life is good. If one of the other rules is selected, I get a string. As you can see, I can access stuff like the block port handles, but they’re doubles not objects so I have no idea what to do next. I can’t run this in the debugger apparently so I’m limited to my disp() statements that put stuff in the Diagnostic Viewer. The qtype is passed as a parameter into the underlying MATLAB function and the numeric type can be re-fetched by the call fixed.extractNumericType().
Help!After some discussion and playing around, I got some ways in defining a block mask that sets the Simulink (fixed point) data type of an output. i have a mask parameter called "quotype" that is a Data Type parameter, and I can pass a related parameter into my MATLAB Function block that has that data type which can then be acted upon. However, I’d like to support rules such as "Inherit: Inherit via internal rule" and "Inherit: Inherit via back propagation". To do so, I need to be able to retrieve information on the signals/ports as they’re compiling in Mask call back function. To wit: I have the current code that for instance works correctly when a specific data type is invoked:
% Initialization code section
function initialization()
if ~isa(quotype,’Simulink.NumericType’)
ports = get_param(gcb,"PortHandles");
out1 = ports.Outport(1);
in1 = ports.Inport(1);
in2 = ports.Inport(2);
disp(ports)
switch quotype
case ‘Inherit: Inherit via internal rule’
ttmp = fixdt(0,10,2);
case ‘Inherit: Inherit via back propagation’
ttmp = fixdt(0,10,2);
case ‘Inherit: Same as first input’
ttmp = fixdt(0,10,2);
otherwise
disp(quotype)
ttmp = fixdt(0,10,2);
end
qtype = fi(0,ttmp);
else
qtype = fi(0,quotype);
end
end
So, if a specific numeric type is provided in the dialog, I see I get a Simulink.NumericType object and life is good. If one of the other rules is selected, I get a string. As you can see, I can access stuff like the block port handles, but they’re doubles not objects so I have no idea what to do next. I can’t run this in the debugger apparently so I’m limited to my disp() statements that put stuff in the Diagnostic Viewer. The qtype is passed as a parameter into the underlying MATLAB function and the numeric type can be re-fetched by the call fixed.extractNumericType().
Help! After some discussion and playing around, I got some ways in defining a block mask that sets the Simulink (fixed point) data type of an output. i have a mask parameter called "quotype" that is a Data Type parameter, and I can pass a related parameter into my MATLAB Function block that has that data type which can then be acted upon. However, I’d like to support rules such as "Inherit: Inherit via internal rule" and "Inherit: Inherit via back propagation". To do so, I need to be able to retrieve information on the signals/ports as they’re compiling in Mask call back function. To wit: I have the current code that for instance works correctly when a specific data type is invoked:
% Initialization code section
function initialization()
if ~isa(quotype,’Simulink.NumericType’)
ports = get_param(gcb,"PortHandles");
out1 = ports.Outport(1);
in1 = ports.Inport(1);
in2 = ports.Inport(2);
disp(ports)
switch quotype
case ‘Inherit: Inherit via internal rule’
ttmp = fixdt(0,10,2);
case ‘Inherit: Inherit via back propagation’
ttmp = fixdt(0,10,2);
case ‘Inherit: Same as first input’
ttmp = fixdt(0,10,2);
otherwise
disp(quotype)
ttmp = fixdt(0,10,2);
end
qtype = fi(0,ttmp);
else
qtype = fi(0,quotype);
end
end
So, if a specific numeric type is provided in the dialog, I see I get a Simulink.NumericType object and life is good. If one of the other rules is selected, I get a string. As you can see, I can access stuff like the block port handles, but they’re doubles not objects so I have no idea what to do next. I can’t run this in the debugger apparently so I’m limited to my disp() statements that put stuff in the Diagnostic Viewer. The qtype is passed as a parameter into the underlying MATLAB function and the numeric type can be re-fetched by the call fixed.extractNumericType().
Help! mask parameters, port signals MATLAB Answers — New Questions
Matlab calculations randomly take forever to run, not represented in tic toc
Hello all, I have a weird issue I was wondering if someone might have some idea on how to fix. I’m running Matlab 2024b on a Dell XPS 14 laptop. My issue is that seemingly randomly (perhaps 1 out every 6-10 operations) Matlab takes forever to run selected lines of code (or anything at all). For instance, I just ran this line of code:
tic
ECR_PBO_Support_1 = [];
ECR_PBO_Support_2 = [norm_2_32_PBO_Support01.ECR, norm_2_32_PBO_Support02.ECR, norm_2_32_PBO_Support03.ECR, norm_2_32_PBO_Support04.ECR, norm_2_32_PBO_Support05.ECR,…
norm_2_32_PBO_Support06.ECR, norm_2_32_PBO_Support07.ECR, norm_2_32_PBO_Support08.ECR];
ECR_PBO_Support_Total = [ECR_PBO_Support_1,ECR_PBO_Support_2];
toc
What the data is is irrelevant (its ultimately 8 vectors of 100 numbers long). But when I ran these lines, Matlab took about 5-8 seconds to run (i.e. it displays ‘Busy". Even though the output of tic toc was:
Elapsed time is 0.015314 seconds.
For the life of me, I cannot figure out why Matlab is doing this, but its causing me to really slow down since even the most basic operations will randomly take 5-8 seconds to run. When it happens, the delay affects everything, calculations, plots etc.
Has anyone experienced this before or have any suggestions for settings to check?Hello all, I have a weird issue I was wondering if someone might have some idea on how to fix. I’m running Matlab 2024b on a Dell XPS 14 laptop. My issue is that seemingly randomly (perhaps 1 out every 6-10 operations) Matlab takes forever to run selected lines of code (or anything at all). For instance, I just ran this line of code:
tic
ECR_PBO_Support_1 = [];
ECR_PBO_Support_2 = [norm_2_32_PBO_Support01.ECR, norm_2_32_PBO_Support02.ECR, norm_2_32_PBO_Support03.ECR, norm_2_32_PBO_Support04.ECR, norm_2_32_PBO_Support05.ECR,…
norm_2_32_PBO_Support06.ECR, norm_2_32_PBO_Support07.ECR, norm_2_32_PBO_Support08.ECR];
ECR_PBO_Support_Total = [ECR_PBO_Support_1,ECR_PBO_Support_2];
toc
What the data is is irrelevant (its ultimately 8 vectors of 100 numbers long). But when I ran these lines, Matlab took about 5-8 seconds to run (i.e. it displays ‘Busy". Even though the output of tic toc was:
Elapsed time is 0.015314 seconds.
For the life of me, I cannot figure out why Matlab is doing this, but its causing me to really slow down since even the most basic operations will randomly take 5-8 seconds to run. When it happens, the delay affects everything, calculations, plots etc.
Has anyone experienced this before or have any suggestions for settings to check? Hello all, I have a weird issue I was wondering if someone might have some idea on how to fix. I’m running Matlab 2024b on a Dell XPS 14 laptop. My issue is that seemingly randomly (perhaps 1 out every 6-10 operations) Matlab takes forever to run selected lines of code (or anything at all). For instance, I just ran this line of code:
tic
ECR_PBO_Support_1 = [];
ECR_PBO_Support_2 = [norm_2_32_PBO_Support01.ECR, norm_2_32_PBO_Support02.ECR, norm_2_32_PBO_Support03.ECR, norm_2_32_PBO_Support04.ECR, norm_2_32_PBO_Support05.ECR,…
norm_2_32_PBO_Support06.ECR, norm_2_32_PBO_Support07.ECR, norm_2_32_PBO_Support08.ECR];
ECR_PBO_Support_Total = [ECR_PBO_Support_1,ECR_PBO_Support_2];
toc
What the data is is irrelevant (its ultimately 8 vectors of 100 numbers long). But when I ran these lines, Matlab took about 5-8 seconds to run (i.e. it displays ‘Busy". Even though the output of tic toc was:
Elapsed time is 0.015314 seconds.
For the life of me, I cannot figure out why Matlab is doing this, but its causing me to really slow down since even the most basic operations will randomly take 5-8 seconds to run. When it happens, the delay affects everything, calculations, plots etc.
Has anyone experienced this before or have any suggestions for settings to check? processing time, matlab, script, speed, optimization MATLAB Answers — New Questions
Distinguish installed MATLAB from Online/Mobile versions
MATLAB has commands such as ispc/ismac/isunix and computer to determine the local computing environment. Is there a way to distinguish MATLAB Online and MATLAB Mobile from a local install? Both the online and mobile versions report themselves as 64-bit Linux, which is presumably the Mathworks server running behind the scenes. Both also have an enviroment variable MW_DDUX_APP_NAME that does not appear on Mac or Windows installs, with the very telling value MATLAB_ONLINE. My assumption is that a local Linux install would not have that variable, and if a local server did, the value would be different (unless one was running MATLAB Online behind a firewall).
So far I haven’t found a simple way of separating online and mobile versions, apart from a try/catch block containing a command that does not work on the latter (such as uifigure). That’s not very robust–is there a better way?MATLAB has commands such as ispc/ismac/isunix and computer to determine the local computing environment. Is there a way to distinguish MATLAB Online and MATLAB Mobile from a local install? Both the online and mobile versions report themselves as 64-bit Linux, which is presumably the Mathworks server running behind the scenes. Both also have an enviroment variable MW_DDUX_APP_NAME that does not appear on Mac or Windows installs, with the very telling value MATLAB_ONLINE. My assumption is that a local Linux install would not have that variable, and if a local server did, the value would be different (unless one was running MATLAB Online behind a firewall).
So far I haven’t found a simple way of separating online and mobile versions, apart from a try/catch block containing a command that does not work on the latter (such as uifigure). That’s not very robust–is there a better way? MATLAB has commands such as ispc/ismac/isunix and computer to determine the local computing environment. Is there a way to distinguish MATLAB Online and MATLAB Mobile from a local install? Both the online and mobile versions report themselves as 64-bit Linux, which is presumably the Mathworks server running behind the scenes. Both also have an enviroment variable MW_DDUX_APP_NAME that does not appear on Mac or Windows installs, with the very telling value MATLAB_ONLINE. My assumption is that a local Linux install would not have that variable, and if a local server did, the value would be different (unless one was running MATLAB Online behind a firewall).
So far I haven’t found a simple way of separating online and mobile versions, apart from a try/catch block containing a command that does not work on the latter (such as uifigure). That’s not very robust–is there a better way? online, mobile MATLAB Answers — New Questions
RF PCB toolbox analysis inconsistency.
Hi,
I’ve been developing an application using the RF PCB Toolbox for quite some time. Essentially, the application creates a microstrip resonator based on parameters provided by the user and then analyzes its scattering parameters using the Method of Moments (MOM) algorithm. However, my results vary depending on the frequency range of the analysis. The resonator’s frequency response changes in completely unrelated ways, and I can’t figure out why this is happening. My code is intentionally kept simple, without any custom mesh settings or advanced solver configurations.
function SingleLoadedAnalyzeButtonPushed(app, event)
app.FBegin = (app.FBeginField.Value)*1e9;
app.FEnd = (app.FEndField.Value)*1e9;
app.FPoints = (app.FPointsField.Value);
fsweep = linspace(app.FBegin,app.FEnd,app.FPoints);
if app.InterpOptionCheck.Value == 1
interpOption = "interp";
else
interpOption = "direct";
end
spar = sparameters(app.singleResonator,fsweep,…
"SweepOption",interpOption);
rfplot(app.EMResponsePlot,spar);
end
Has anyone experienced similar issues with RF PCB Toolbox for microstrip resonators?Hi,
I’ve been developing an application using the RF PCB Toolbox for quite some time. Essentially, the application creates a microstrip resonator based on parameters provided by the user and then analyzes its scattering parameters using the Method of Moments (MOM) algorithm. However, my results vary depending on the frequency range of the analysis. The resonator’s frequency response changes in completely unrelated ways, and I can’t figure out why this is happening. My code is intentionally kept simple, without any custom mesh settings or advanced solver configurations.
function SingleLoadedAnalyzeButtonPushed(app, event)
app.FBegin = (app.FBeginField.Value)*1e9;
app.FEnd = (app.FEndField.Value)*1e9;
app.FPoints = (app.FPointsField.Value);
fsweep = linspace(app.FBegin,app.FEnd,app.FPoints);
if app.InterpOptionCheck.Value == 1
interpOption = "interp";
else
interpOption = "direct";
end
spar = sparameters(app.singleResonator,fsweep,…
"SweepOption",interpOption);
rfplot(app.EMResponsePlot,spar);
end
Has anyone experienced similar issues with RF PCB Toolbox for microstrip resonators? Hi,
I’ve been developing an application using the RF PCB Toolbox for quite some time. Essentially, the application creates a microstrip resonator based on parameters provided by the user and then analyzes its scattering parameters using the Method of Moments (MOM) algorithm. However, my results vary depending on the frequency range of the analysis. The resonator’s frequency response changes in completely unrelated ways, and I can’t figure out why this is happening. My code is intentionally kept simple, without any custom mesh settings or advanced solver configurations.
function SingleLoadedAnalyzeButtonPushed(app, event)
app.FBegin = (app.FBeginField.Value)*1e9;
app.FEnd = (app.FEndField.Value)*1e9;
app.FPoints = (app.FPointsField.Value);
fsweep = linspace(app.FBegin,app.FEnd,app.FPoints);
if app.InterpOptionCheck.Value == 1
interpOption = "interp";
else
interpOption = "direct";
end
spar = sparameters(app.singleResonator,fsweep,…
"SweepOption",interpOption);
rfplot(app.EMResponsePlot,spar);
end
Has anyone experienced similar issues with RF PCB Toolbox for microstrip resonators? rf pcb toolbox, microstrip, method of moments MATLAB Answers — New Questions
UniqueTol Exclusion of Similar Points
I am trying to remove detected circles that are too close to one another. My original plan involved indexing through all of the centers (X Y stored in separate columns), determining the distances, and then using those to remove points within a tolerance.
for nn=1:height(location_table)
distances=sqrt(((location_table(nn,1) – location_table(:,1)).^2)+((location_table(nn,2) – location_table(:,2)).^2))
too_close=(0<distances & distances<tolerance);
location_table(too_close,:)=[]
end
I was never able to get the removal to work. It would end up breaking if spots were removed because the index nn would eventually get larger than the current table height.
I discovered the uniquetol command when searching for answers. However, in my use of it, it filters out spots that are not unique (ie, within the tolerance). However, I would want it to remove spots that all spots that are too similar (rather than leaving a representative one behind).
location_table=uniquetol(location_table, closeness_tolerance, ‘ByRows’, true, ‘OutputAllIndices’, true, ‘DataScale’,1);
I plan to do radial intensity line scans starting at the center of all circles (and proceeding past their perimeter by a variable) that make it through this filtering process. If spots are too close, then the scan (improfile) will cross over the border of the intended scan as well as a spot that is too close to it (which will skew the data). For example, circle 4 should be excluded because it is too close to other circles and its scans could be skewed. Uniquetold allowed me to exclude the nearby circles but 4 would ideally not be included either.I am trying to remove detected circles that are too close to one another. My original plan involved indexing through all of the centers (X Y stored in separate columns), determining the distances, and then using those to remove points within a tolerance.
for nn=1:height(location_table)
distances=sqrt(((location_table(nn,1) – location_table(:,1)).^2)+((location_table(nn,2) – location_table(:,2)).^2))
too_close=(0<distances & distances<tolerance);
location_table(too_close,:)=[]
end
I was never able to get the removal to work. It would end up breaking if spots were removed because the index nn would eventually get larger than the current table height.
I discovered the uniquetol command when searching for answers. However, in my use of it, it filters out spots that are not unique (ie, within the tolerance). However, I would want it to remove spots that all spots that are too similar (rather than leaving a representative one behind).
location_table=uniquetol(location_table, closeness_tolerance, ‘ByRows’, true, ‘OutputAllIndices’, true, ‘DataScale’,1);
I plan to do radial intensity line scans starting at the center of all circles (and proceeding past their perimeter by a variable) that make it through this filtering process. If spots are too close, then the scan (improfile) will cross over the border of the intended scan as well as a spot that is too close to it (which will skew the data). For example, circle 4 should be excluded because it is too close to other circles and its scans could be skewed. Uniquetold allowed me to exclude the nearby circles but 4 would ideally not be included either. I am trying to remove detected circles that are too close to one another. My original plan involved indexing through all of the centers (X Y stored in separate columns), determining the distances, and then using those to remove points within a tolerance.
for nn=1:height(location_table)
distances=sqrt(((location_table(nn,1) – location_table(:,1)).^2)+((location_table(nn,2) – location_table(:,2)).^2))
too_close=(0<distances & distances<tolerance);
location_table(too_close,:)=[]
end
I was never able to get the removal to work. It would end up breaking if spots were removed because the index nn would eventually get larger than the current table height.
I discovered the uniquetol command when searching for answers. However, in my use of it, it filters out spots that are not unique (ie, within the tolerance). However, I would want it to remove spots that all spots that are too similar (rather than leaving a representative one behind).
location_table=uniquetol(location_table, closeness_tolerance, ‘ByRows’, true, ‘OutputAllIndices’, true, ‘DataScale’,1);
I plan to do radial intensity line scans starting at the center of all circles (and proceeding past their perimeter by a variable) that make it through this filtering process. If spots are too close, then the scan (improfile) will cross over the border of the intended scan as well as a spot that is too close to it (which will skew the data). For example, circle 4 should be excluded because it is too close to other circles and its scans could be skewed. Uniquetold allowed me to exclude the nearby circles but 4 would ideally not be included either. uniquetol, image analysis, image processing MATLAB Answers — New Questions
configure Java path for MATLAB, MATLAB Runtime and deployed applications
MATLAB ships with one specific version of the JRE. This version is validated and fully supported with MATLAB.
However, you can configure MATLAB to use other version of JRE by following this article. Since R2021b, jenv and matlab_jenv commands are introduced to set Java path for MATLAB, which makes this configuration process much easier.
If I used either command and configured MATLAB to use a non-default JRE, how will it impact deployed applications that this MATLAB compiles?
Can I configure JRE for MATLAB Runtime?MATLAB ships with one specific version of the JRE. This version is validated and fully supported with MATLAB.
However, you can configure MATLAB to use other version of JRE by following this article. Since R2021b, jenv and matlab_jenv commands are introduced to set Java path for MATLAB, which makes this configuration process much easier.
If I used either command and configured MATLAB to use a non-default JRE, how will it impact deployed applications that this MATLAB compiles?
Can I configure JRE for MATLAB Runtime? MATLAB ships with one specific version of the JRE. This version is validated and fully supported with MATLAB.
However, you can configure MATLAB to use other version of JRE by following this article. Since R2021b, jenv and matlab_jenv commands are introduced to set Java path for MATLAB, which makes this configuration process much easier.
If I used either command and configured MATLAB to use a non-default JRE, how will it impact deployed applications that this MATLAB compiles?
Can I configure JRE for MATLAB Runtime? MATLAB Answers — New Questions
suprisingly complicated optimization problem
I have the following constrained (global) optimization problem:
For a user defined sorted real values vector:
xi = [xi(1), … , xi(N+1)]
I need to find unknown vector:
x = [x(1), …, x(L)]
where the integer L is the unknown length of the vector x (L>=0, L = 0 is the trivial case)
and the unknown vector x = [x(1), …, x(L)] must satisfy the following specific conditions:
===============================================================
0. The new "refined" sorted vector xo = union(xi,x), where length(xo) = L+N+1
should to fulfil the following set of conditions:
1. min(xo) = xo(1) = xi(1), max(xo) = xo(L+N+1) = xi(N+1)
2a. max(z(j)/z(j+1),z(j+1)/z(j)) < q_max, for j = 1, 2, … L+N
2b. max(z(j-1)/z(j),z(j)/z(j-1)) < q_max, for j = 2, 2, … L+N+1
where
z(j) = xo(j+1) – xo(j) , z = diff(xo), length(z) = L+N
and
q_max is user defined max ratio, where q_max > 1 (typically q_max ~ 1.05 – 1.2)
3. min(z) -> maximal, minimal distance between xo vector elements should be maximized.
It is obvious that for small L the constraint conditions (2) is not possible to satisfy.
===============================================================
The motivation of this problem is the creation of the so called, "homogenized" 1-D grid, where consecutive distances between elements of vector xo are relatively "slowly" changing.
I will be very happy for any recommendation how to effectively solve this problem using MATLAB + (global) optimization toolbox.I have the following constrained (global) optimization problem:
For a user defined sorted real values vector:
xi = [xi(1), … , xi(N+1)]
I need to find unknown vector:
x = [x(1), …, x(L)]
where the integer L is the unknown length of the vector x (L>=0, L = 0 is the trivial case)
and the unknown vector x = [x(1), …, x(L)] must satisfy the following specific conditions:
===============================================================
0. The new "refined" sorted vector xo = union(xi,x), where length(xo) = L+N+1
should to fulfil the following set of conditions:
1. min(xo) = xo(1) = xi(1), max(xo) = xo(L+N+1) = xi(N+1)
2a. max(z(j)/z(j+1),z(j+1)/z(j)) < q_max, for j = 1, 2, … L+N
2b. max(z(j-1)/z(j),z(j)/z(j-1)) < q_max, for j = 2, 2, … L+N+1
where
z(j) = xo(j+1) – xo(j) , z = diff(xo), length(z) = L+N
and
q_max is user defined max ratio, where q_max > 1 (typically q_max ~ 1.05 – 1.2)
3. min(z) -> maximal, minimal distance between xo vector elements should be maximized.
It is obvious that for small L the constraint conditions (2) is not possible to satisfy.
===============================================================
The motivation of this problem is the creation of the so called, "homogenized" 1-D grid, where consecutive distances between elements of vector xo are relatively "slowly" changing.
I will be very happy for any recommendation how to effectively solve this problem using MATLAB + (global) optimization toolbox. I have the following constrained (global) optimization problem:
For a user defined sorted real values vector:
xi = [xi(1), … , xi(N+1)]
I need to find unknown vector:
x = [x(1), …, x(L)]
where the integer L is the unknown length of the vector x (L>=0, L = 0 is the trivial case)
and the unknown vector x = [x(1), …, x(L)] must satisfy the following specific conditions:
===============================================================
0. The new "refined" sorted vector xo = union(xi,x), where length(xo) = L+N+1
should to fulfil the following set of conditions:
1. min(xo) = xo(1) = xi(1), max(xo) = xo(L+N+1) = xi(N+1)
2a. max(z(j)/z(j+1),z(j+1)/z(j)) < q_max, for j = 1, 2, … L+N
2b. max(z(j-1)/z(j),z(j)/z(j-1)) < q_max, for j = 2, 2, … L+N+1
where
z(j) = xo(j+1) – xo(j) , z = diff(xo), length(z) = L+N
and
q_max is user defined max ratio, where q_max > 1 (typically q_max ~ 1.05 – 1.2)
3. min(z) -> maximal, minimal distance between xo vector elements should be maximized.
It is obvious that for small L the constraint conditions (2) is not possible to satisfy.
===============================================================
The motivation of this problem is the creation of the so called, "homogenized" 1-D grid, where consecutive distances between elements of vector xo are relatively "slowly" changing.
I will be very happy for any recommendation how to effectively solve this problem using MATLAB + (global) optimization toolbox. optmization, constrained MATLAB Answers — New Questions
Identify and refill dark spots on the leopard with neighboring pixels
Remove the dark spots on the leopard.
i tried converting the color image into grayscale.Applied ostu thresholding to create binary image.
using the morophological operations i was able to create a mask, used mask to refilll the black spots on the color image. i did not get the desired result.
what other steps i can implement to achieve an image with no black spotsRemove the dark spots on the leopard.
i tried converting the color image into grayscale.Applied ostu thresholding to create binary image.
using the morophological operations i was able to create a mask, used mask to refilll the black spots on the color image. i did not get the desired result.
what other steps i can implement to achieve an image with no black spots Remove the dark spots on the leopard.
i tried converting the color image into grayscale.Applied ostu thresholding to create binary image.
using the morophological operations i was able to create a mask, used mask to refilll the black spots on the color image. i did not get the desired result.
what other steps i can implement to achieve an image with no black spots image processing, image segmentation, hole filling MATLAB Answers — New Questions