Author: PuTI
Exception in thread “IPC Process Thread
I am using MATLAB R2019b with windows 10 Enterprise 20H2 OS build 19042.1586.
Everytime I tried to edit a plot (2D or 3D), MATLAB becomes unresponsive.
I can minimize and maximize but I even can’t close it. The command window is also unresponsive. After some time I receive the following error:
Exception in thread "IPC Process Thread": java.lang.UnsatisfiedLinkError: C:Users???????????????????AppDataLocalTempjxbrowser-chromium-43.0.2357.52.5.4.3.1dataTempjxbrowser-common64-a60ded20-f14c-4744-94df-474eb1350234.dll: Can’t find dependent libraries
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1941)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1824)
at java.lang.Runtime.load0(Runtime.java:809)
at java.lang.System.load(System.java:1086)
at com.teamdev.jxbrowser.chromium.internal.LibraryLoader.loadLibrary(Unknown Source)
at com.teamdev.jxbrowser.chromium.internal.SharedMemoryLibrary.<init>(Unknown Source)
at com.teamdev.jxbrowser.chromium.internal.SharedMemoryLibrary.getInstance(Unknown Source)
at com.teamdev.jxbrowser.chromium.internal.ipc.ChromiumProcess.start(Unknown Source)
at com.teamdev.jxbrowser.chromium.internal.ipc.d.run(Unknown Source)
at java.lang.Thread.run(Thread.java:748)
Exception in thread "IPC Process Thread": java.lang.UnsatisfiedLinkError: C:Users???????????????????AppDataLocalTempjxbrowser-chromium-43.0.2357.52.5.4.3.1dataTempjxbrowser-common64-4b01d43e-a593-4c5f-a88c-fe959fbb9492.dll: Can’t find dependent libraries
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1941)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1824)
at java.lang.Runtime.load0(Runtime.java:809)
at java.lang.System.load(System.java:1086)
at com.teamdev.jxbrowser.chromium.internal.LibraryLoader.loadLibrary(Unknown Source)
at com.teamdev.jxbrowser.chromium.internal.SharedMemoryLibrary.<init>(Unknown Source)
at com.teamdev.jxbrowser.chromium.internal.SharedMemoryLibrary.getInstance(Unknown Source)
at com.teamdev.jxbrowser.chromium.internal.ipc.ChromiumProcess.start(Unknown Source)
at com.teamdev.jxbrowser.chromium.internal.ipc.d.run(Unknown Source)
at java.lang.Thread.run(Thread.java:748)
Exception in thread "AWT-EventQueue-0": java.lang.NullPointerException
at com.mathworks.page.plottool.propertyinspectormanager.PropertyInspectorManager$2.run(PropertyInspectorManager.java:167)
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)I am using MATLAB R2019b with windows 10 Enterprise 20H2 OS build 19042.1586.
Everytime I tried to edit a plot (2D or 3D), MATLAB becomes unresponsive.
I can minimize and maximize but I even can’t close it. The command window is also unresponsive. After some time I receive the following error:
Exception in thread "IPC Process Thread": java.lang.UnsatisfiedLinkError: C:Users???????????????????AppDataLocalTempjxbrowser-chromium-43.0.2357.52.5.4.3.1dataTempjxbrowser-common64-a60ded20-f14c-4744-94df-474eb1350234.dll: Can’t find dependent libraries
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1941)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1824)
at java.lang.Runtime.load0(Runtime.java:809)
at java.lang.System.load(System.java:1086)
at com.teamdev.jxbrowser.chromium.internal.LibraryLoader.loadLibrary(Unknown Source)
at com.teamdev.jxbrowser.chromium.internal.SharedMemoryLibrary.<init>(Unknown Source)
at com.teamdev.jxbrowser.chromium.internal.SharedMemoryLibrary.getInstance(Unknown Source)
at com.teamdev.jxbrowser.chromium.internal.ipc.ChromiumProcess.start(Unknown Source)
at com.teamdev.jxbrowser.chromium.internal.ipc.d.run(Unknown Source)
at java.lang.Thread.run(Thread.java:748)
Exception in thread "IPC Process Thread": java.lang.UnsatisfiedLinkError: C:Users???????????????????AppDataLocalTempjxbrowser-chromium-43.0.2357.52.5.4.3.1dataTempjxbrowser-common64-4b01d43e-a593-4c5f-a88c-fe959fbb9492.dll: Can’t find dependent libraries
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1941)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1824)
at java.lang.Runtime.load0(Runtime.java:809)
at java.lang.System.load(System.java:1086)
at com.teamdev.jxbrowser.chromium.internal.LibraryLoader.loadLibrary(Unknown Source)
at com.teamdev.jxbrowser.chromium.internal.SharedMemoryLibrary.<init>(Unknown Source)
at com.teamdev.jxbrowser.chromium.internal.SharedMemoryLibrary.getInstance(Unknown Source)
at com.teamdev.jxbrowser.chromium.internal.ipc.ChromiumProcess.start(Unknown Source)
at com.teamdev.jxbrowser.chromium.internal.ipc.d.run(Unknown Source)
at java.lang.Thread.run(Thread.java:748)
Exception in thread "AWT-EventQueue-0": java.lang.NullPointerException
at com.mathworks.page.plottool.propertyinspectormanager.PropertyInspectorManager$2.run(PropertyInspectorManager.java:167)
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) I am using MATLAB R2019b with windows 10 Enterprise 20H2 OS build 19042.1586.
Everytime I tried to edit a plot (2D or 3D), MATLAB becomes unresponsive.
I can minimize and maximize but I even can’t close it. The command window is also unresponsive. After some time I receive the following error:
Exception in thread "IPC Process Thread": java.lang.UnsatisfiedLinkError: C:Users???????????????????AppDataLocalTempjxbrowser-chromium-43.0.2357.52.5.4.3.1dataTempjxbrowser-common64-a60ded20-f14c-4744-94df-474eb1350234.dll: Can’t find dependent libraries
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1941)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1824)
at java.lang.Runtime.load0(Runtime.java:809)
at java.lang.System.load(System.java:1086)
at com.teamdev.jxbrowser.chromium.internal.LibraryLoader.loadLibrary(Unknown Source)
at com.teamdev.jxbrowser.chromium.internal.SharedMemoryLibrary.<init>(Unknown Source)
at com.teamdev.jxbrowser.chromium.internal.SharedMemoryLibrary.getInstance(Unknown Source)
at com.teamdev.jxbrowser.chromium.internal.ipc.ChromiumProcess.start(Unknown Source)
at com.teamdev.jxbrowser.chromium.internal.ipc.d.run(Unknown Source)
at java.lang.Thread.run(Thread.java:748)
Exception in thread "IPC Process Thread": java.lang.UnsatisfiedLinkError: C:Users???????????????????AppDataLocalTempjxbrowser-chromium-43.0.2357.52.5.4.3.1dataTempjxbrowser-common64-4b01d43e-a593-4c5f-a88c-fe959fbb9492.dll: Can’t find dependent libraries
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1941)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1824)
at java.lang.Runtime.load0(Runtime.java:809)
at java.lang.System.load(System.java:1086)
at com.teamdev.jxbrowser.chromium.internal.LibraryLoader.loadLibrary(Unknown Source)
at com.teamdev.jxbrowser.chromium.internal.SharedMemoryLibrary.<init>(Unknown Source)
at com.teamdev.jxbrowser.chromium.internal.SharedMemoryLibrary.getInstance(Unknown Source)
at com.teamdev.jxbrowser.chromium.internal.ipc.ChromiumProcess.start(Unknown Source)
at com.teamdev.jxbrowser.chromium.internal.ipc.d.run(Unknown Source)
at java.lang.Thread.run(Thread.java:748)
Exception in thread "AWT-EventQueue-0": java.lang.NullPointerException
at com.mathworks.page.plottool.propertyinspectormanager.PropertyInspectorManager$2.run(PropertyInspectorManager.java:167)
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) matlab MATLAB Answers — New Questions
my question is if a=[1 2;3 4],b=[5 6;7 8],c=[9 10;11 12] the resultant matrix should be d=[1 5 9;2 6 10;3 7 11;4 8 12] this should be done using for loop?
my question is if a=[1 2;3 4],b=[5 6;7 8],c=[9 10;11 12]
the resultant matrix should be d=[1 5 9;2 6 10;3 7 11;4 8 12] this should be done using for loop?my question is if a=[1 2;3 4],b=[5 6;7 8],c=[9 10;11 12]
the resultant matrix should be d=[1 5 9;2 6 10;3 7 11;4 8 12] this should be done using for loop? my question is if a=[1 2;3 4],b=[5 6;7 8],c=[9 10;11 12]
the resultant matrix should be d=[1 5 9;2 6 10;3 7 11;4 8 12] this should be done using for loop? MATLAB Answers — New Questions
error in matlab code
I have been trying to solve an optimal problem in which a body of mass have to [be] transfered to y(tf) = 0 from its initial position y(o) = 0 such that its final velocity is zero satisfying the performance index.
, where t = [to, tf].
But I am not getting the optimal trajectories using this code. Could anyone help me to find where the mistake [is]?
clear all
c0 = [0.1; 0.1; 0.1; 0.1; 5]; % Make a starting guess at the solution
[c, fval] = fsolve (@myfun1, c0) % Call optimizer
c1 = c(1); c2 = c(2); c3 = c(3); c4 = c(4); c5 = c(5);
t=0:0.01:c5;
x1op = -(c1*(t.^3))/6-(c2*(t.^2))/2+(c3.*t)+c4
x2op =-(c1*(t.^2))/2+-(c2.*t)+c3
uop = -(c1.*t)-c2
lam1= c1;
H = 1.5 * uop.^2 + x2op.* lam1;
figure (1)
plot(t, uop)
figure(2)
plot(t,x1op,t,x2op)
figure(3)
plot(t,H)
function F = myfun1(c)
x10 = 1;
x20 = 0;
x1f = 0;
x2f = 0;
u=-(c(1)*c(5))-c(2);
ud = c(1);
% the conditions x1(t = 0), x1(t = tf), x2(t = 0), x2(t = tf)
f1 = c(4)-x10;
f2 =-(c(1)*(c(5)^3))/6 -(c(2)*(c(5)^2))/2 +(c(3)*c(5)) + 1 -x1f;
f3 = c(3)-x20;
f4 = -(c(1)*(c(5)^2))/2 -(c(2)*c(5))-x2f;
f5 = 1.5 *u.^2 -f4.*ud ;% the condition H(tf) = 0
F = [f1;f2;f3;f4;f5]; % the five unknown system F(C) = 0
endI have been trying to solve an optimal problem in which a body of mass have to [be] transfered to y(tf) = 0 from its initial position y(o) = 0 such that its final velocity is zero satisfying the performance index.
, where t = [to, tf].
But I am not getting the optimal trajectories using this code. Could anyone help me to find where the mistake [is]?
clear all
c0 = [0.1; 0.1; 0.1; 0.1; 5]; % Make a starting guess at the solution
[c, fval] = fsolve (@myfun1, c0) % Call optimizer
c1 = c(1); c2 = c(2); c3 = c(3); c4 = c(4); c5 = c(5);
t=0:0.01:c5;
x1op = -(c1*(t.^3))/6-(c2*(t.^2))/2+(c3.*t)+c4
x2op =-(c1*(t.^2))/2+-(c2.*t)+c3
uop = -(c1.*t)-c2
lam1= c1;
H = 1.5 * uop.^2 + x2op.* lam1;
figure (1)
plot(t, uop)
figure(2)
plot(t,x1op,t,x2op)
figure(3)
plot(t,H)
function F = myfun1(c)
x10 = 1;
x20 = 0;
x1f = 0;
x2f = 0;
u=-(c(1)*c(5))-c(2);
ud = c(1);
% the conditions x1(t = 0), x1(t = tf), x2(t = 0), x2(t = tf)
f1 = c(4)-x10;
f2 =-(c(1)*(c(5)^3))/6 -(c(2)*(c(5)^2))/2 +(c(3)*c(5)) + 1 -x1f;
f3 = c(3)-x20;
f4 = -(c(1)*(c(5)^2))/2 -(c(2)*c(5))-x2f;
f5 = 1.5 *u.^2 -f4.*ud ;% the condition H(tf) = 0
F = [f1;f2;f3;f4;f5]; % the five unknown system F(C) = 0
end I have been trying to solve an optimal problem in which a body of mass have to [be] transfered to y(tf) = 0 from its initial position y(o) = 0 such that its final velocity is zero satisfying the performance index.
, where t = [to, tf].
But I am not getting the optimal trajectories using this code. Could anyone help me to find where the mistake [is]?
clear all
c0 = [0.1; 0.1; 0.1; 0.1; 5]; % Make a starting guess at the solution
[c, fval] = fsolve (@myfun1, c0) % Call optimizer
c1 = c(1); c2 = c(2); c3 = c(3); c4 = c(4); c5 = c(5);
t=0:0.01:c5;
x1op = -(c1*(t.^3))/6-(c2*(t.^2))/2+(c3.*t)+c4
x2op =-(c1*(t.^2))/2+-(c2.*t)+c3
uop = -(c1.*t)-c2
lam1= c1;
H = 1.5 * uop.^2 + x2op.* lam1;
figure (1)
plot(t, uop)
figure(2)
plot(t,x1op,t,x2op)
figure(3)
plot(t,H)
function F = myfun1(c)
x10 = 1;
x20 = 0;
x1f = 0;
x2f = 0;
u=-(c(1)*c(5))-c(2);
ud = c(1);
% the conditions x1(t = 0), x1(t = tf), x2(t = 0), x2(t = tf)
f1 = c(4)-x10;
f2 =-(c(1)*(c(5)^3))/6 -(c(2)*(c(5)^2))/2 +(c(3)*c(5)) + 1 -x1f;
f3 = c(3)-x20;
f4 = -(c(1)*(c(5)^2))/2 -(c(2)*c(5))-x2f;
f5 = 1.5 *u.^2 -f4.*ud ;% the condition H(tf) = 0
F = [f1;f2;f3;f4;f5]; % the five unknown system F(C) = 0
end optimal control MATLAB Answers — New Questions
how to apply exist model configset to current model through script
i have config set that exported from other model, now i want import this configset to my new model, and set this config set active, how to realzie this through script, following pic for reference.i have config set that exported from other model, now i want import this configset to my new model, and set this config set active, how to realzie this through script, following pic for reference. i have config set that exported from other model, now i want import this configset to my new model, and set this config set active, how to realzie this through script, following pic for reference. simulink, model configset, configurations MATLAB Answers — New Questions
Can’t use.dll library on the 2020 or later versions of Matlab
I’m working with some DLL library in order to integrate a measurment instrument (a power meeter) on Matlab. I’m using the 2021 version of Matlab and I used the following code to load the DLL library: (note that the library was given to me from the company who sell me the power meeter).
clear all;
%Load the library
NET.addAssembly(‘C:Program Files (x86)Microsoft.NETPrimary Interop AssembliesThorlabs.TLPM_64.Interop.dll’);
import Thorlabs.TLPM_64.Interop.*;
%Create a dummy TLPM object to check for compatible devices.
handle = System.IntPtr(0);
device = TLPM(handle);
%Search the device
[~,deviceCount] = device.findRsrc();
When I run it, Matlab load the library but when I try to use the function "findRsrc" I get the following error:
Found on line 1324 of input from line 1065 of file C:\Program Files\IVI Foundation\VISA\Win64\Include\TLPM.h
Type ‘intViStatus__fastcall’ was not found. Defaulting to type error.
Found on line 1325 of input from line 1066 of file C:\Program Files\IVI Foundation\VISA\Win64\Include\TLPM.h
Warning no reference to header ‘C:/Program Files/IVI Foundation/VISA/Win64/Include/visa’ added with addheader was found in source.
*********
Error using loadlibrary
Building TPLM_64_thunk_pcwin64 failed. Compiler output is:
cl -I"C:Program FilesIVI FoundationVISAWin64Lib_x64msc" -I"C:Program FilesIVI FoundationVISAWin64Include" -I"C:Program
FilesMATLABR2020aexterninclude" /Zp8 /W3 /nologo -I"C:UsersinstallDesktop" -I"C:Program FilesIVI FoundationVISAWin64Include"
"TPLM_64_thunk_pcwin64.c" -LD -Fe"TPLM_64_thunk_pcwin64.dll"
TPLM_64_thunk_pcwin64.c
TPLM_64_thunk_pcwin64.c(47): error C2059: syntax error: ‘*’
I tried many things ans then, by seraching online, I saw that the problem is may due to the compiler version. Since I have also 2019 and 2020 matlab licenes I tried on both the version and i found out that it works on the 2019 version of Matlab.
So my questions is: Do you have any ideaa what could be the problem on the newest version? there is something that I can do to make it work on the 2020/2021 version?I’m working with some DLL library in order to integrate a measurment instrument (a power meeter) on Matlab. I’m using the 2021 version of Matlab and I used the following code to load the DLL library: (note that the library was given to me from the company who sell me the power meeter).
clear all;
%Load the library
NET.addAssembly(‘C:Program Files (x86)Microsoft.NETPrimary Interop AssembliesThorlabs.TLPM_64.Interop.dll’);
import Thorlabs.TLPM_64.Interop.*;
%Create a dummy TLPM object to check for compatible devices.
handle = System.IntPtr(0);
device = TLPM(handle);
%Search the device
[~,deviceCount] = device.findRsrc();
When I run it, Matlab load the library but when I try to use the function "findRsrc" I get the following error:
Found on line 1324 of input from line 1065 of file C:\Program Files\IVI Foundation\VISA\Win64\Include\TLPM.h
Type ‘intViStatus__fastcall’ was not found. Defaulting to type error.
Found on line 1325 of input from line 1066 of file C:\Program Files\IVI Foundation\VISA\Win64\Include\TLPM.h
Warning no reference to header ‘C:/Program Files/IVI Foundation/VISA/Win64/Include/visa’ added with addheader was found in source.
*********
Error using loadlibrary
Building TPLM_64_thunk_pcwin64 failed. Compiler output is:
cl -I"C:Program FilesIVI FoundationVISAWin64Lib_x64msc" -I"C:Program FilesIVI FoundationVISAWin64Include" -I"C:Program
FilesMATLABR2020aexterninclude" /Zp8 /W3 /nologo -I"C:UsersinstallDesktop" -I"C:Program FilesIVI FoundationVISAWin64Include"
"TPLM_64_thunk_pcwin64.c" -LD -Fe"TPLM_64_thunk_pcwin64.dll"
TPLM_64_thunk_pcwin64.c
TPLM_64_thunk_pcwin64.c(47): error C2059: syntax error: ‘*’
I tried many things ans then, by seraching online, I saw that the problem is may due to the compiler version. Since I have also 2019 and 2020 matlab licenes I tried on both the version and i found out that it works on the 2019 version of Matlab.
So my questions is: Do you have any ideaa what could be the problem on the newest version? there is something that I can do to make it work on the 2020/2021 version? I’m working with some DLL library in order to integrate a measurment instrument (a power meeter) on Matlab. I’m using the 2021 version of Matlab and I used the following code to load the DLL library: (note that the library was given to me from the company who sell me the power meeter).
clear all;
%Load the library
NET.addAssembly(‘C:Program Files (x86)Microsoft.NETPrimary Interop AssembliesThorlabs.TLPM_64.Interop.dll’);
import Thorlabs.TLPM_64.Interop.*;
%Create a dummy TLPM object to check for compatible devices.
handle = System.IntPtr(0);
device = TLPM(handle);
%Search the device
[~,deviceCount] = device.findRsrc();
When I run it, Matlab load the library but when I try to use the function "findRsrc" I get the following error:
Found on line 1324 of input from line 1065 of file C:\Program Files\IVI Foundation\VISA\Win64\Include\TLPM.h
Type ‘intViStatus__fastcall’ was not found. Defaulting to type error.
Found on line 1325 of input from line 1066 of file C:\Program Files\IVI Foundation\VISA\Win64\Include\TLPM.h
Warning no reference to header ‘C:/Program Files/IVI Foundation/VISA/Win64/Include/visa’ added with addheader was found in source.
*********
Error using loadlibrary
Building TPLM_64_thunk_pcwin64 failed. Compiler output is:
cl -I"C:Program FilesIVI FoundationVISAWin64Lib_x64msc" -I"C:Program FilesIVI FoundationVISAWin64Include" -I"C:Program
FilesMATLABR2020aexterninclude" /Zp8 /W3 /nologo -I"C:UsersinstallDesktop" -I"C:Program FilesIVI FoundationVISAWin64Include"
"TPLM_64_thunk_pcwin64.c" -LD -Fe"TPLM_64_thunk_pcwin64.dll"
TPLM_64_thunk_pcwin64.c
TPLM_64_thunk_pcwin64.c(47): error C2059: syntax error: ‘*’
I tried many things ans then, by seraching online, I saw that the problem is may due to the compiler version. Since I have also 2019 and 2020 matlab licenes I tried on both the version and i found out that it works on the 2019 version of Matlab.
So my questions is: Do you have any ideaa what could be the problem on the newest version? there is something that I can do to make it work on the 2020/2021 version? dll, matlab compiler MATLAB Answers — New Questions
Enter data on a worldmap
I want to show precipitation data on the world map
This code does not appear to indicate the exact amount of precipitation in latitude and longitude
Please help me
clc; clear all;
fnm = ‘precip.mon.ltm.1981-2010.nc’
lon=double(ncread(fnm,’lon’));
lat=double(ncread(fnm,’lat’));
time=ncread(fnm,’time’);
dateT=datetime(1800,01,01,00,00,00)+days(time);
precip=ncread(fnm,’precip’);
load coastlines; % Load coastline data
[X, Y] = meshgrid(lon, lat);
for month = 1:12
f = figure;
% Create world map projection
worldmap(‘world’);
setm(gca, ‘Origin’, [0 180 0]); % Set map origin to be the equator
% Plot precipitation data on the world map
surfm(X’, Y’, precip(:, :, month)); % Use surfm to plot data on the map
cmap = brewermap(16, ‘BrBG’); % Generate the colormap
colormap(cmap); % Apply the colormap to the current figure
cb = colorbar; % Create a colorbar
cb.Label.String = ‘mm/day’;
clim([0 16]); % Set color axis limits
cb.Ticks = 0:1:16;
% Overlay coastlines
plotm(coastlat, coastlon, ‘k’, ‘LineWidth’, 1); % Plot coastlines on top of precipitation data
% Add title with month name
title(sprintf(‘Average Monthly Precipitation (1981-2010) – %s’, datestr(dateT(month), ‘mmmm’)));
% Save each figure as an image file
filename = sprintf(‘E:\Koppen-Geiger climate classes\Average_Monthly_Precipitation%d.png’, month);
saveas(f, filename);
close(f);
endI want to show precipitation data on the world map
This code does not appear to indicate the exact amount of precipitation in latitude and longitude
Please help me
clc; clear all;
fnm = ‘precip.mon.ltm.1981-2010.nc’
lon=double(ncread(fnm,’lon’));
lat=double(ncread(fnm,’lat’));
time=ncread(fnm,’time’);
dateT=datetime(1800,01,01,00,00,00)+days(time);
precip=ncread(fnm,’precip’);
load coastlines; % Load coastline data
[X, Y] = meshgrid(lon, lat);
for month = 1:12
f = figure;
% Create world map projection
worldmap(‘world’);
setm(gca, ‘Origin’, [0 180 0]); % Set map origin to be the equator
% Plot precipitation data on the world map
surfm(X’, Y’, precip(:, :, month)); % Use surfm to plot data on the map
cmap = brewermap(16, ‘BrBG’); % Generate the colormap
colormap(cmap); % Apply the colormap to the current figure
cb = colorbar; % Create a colorbar
cb.Label.String = ‘mm/day’;
clim([0 16]); % Set color axis limits
cb.Ticks = 0:1:16;
% Overlay coastlines
plotm(coastlat, coastlon, ‘k’, ‘LineWidth’, 1); % Plot coastlines on top of precipitation data
% Add title with month name
title(sprintf(‘Average Monthly Precipitation (1981-2010) – %s’, datestr(dateT(month), ‘mmmm’)));
% Save each figure as an image file
filename = sprintf(‘E:\Koppen-Geiger climate classes\Average_Monthly_Precipitation%d.png’, month);
saveas(f, filename);
close(f);
end I want to show precipitation data on the world map
This code does not appear to indicate the exact amount of precipitation in latitude and longitude
Please help me
clc; clear all;
fnm = ‘precip.mon.ltm.1981-2010.nc’
lon=double(ncread(fnm,’lon’));
lat=double(ncread(fnm,’lat’));
time=ncread(fnm,’time’);
dateT=datetime(1800,01,01,00,00,00)+days(time);
precip=ncread(fnm,’precip’);
load coastlines; % Load coastline data
[X, Y] = meshgrid(lon, lat);
for month = 1:12
f = figure;
% Create world map projection
worldmap(‘world’);
setm(gca, ‘Origin’, [0 180 0]); % Set map origin to be the equator
% Plot precipitation data on the world map
surfm(X’, Y’, precip(:, :, month)); % Use surfm to plot data on the map
cmap = brewermap(16, ‘BrBG’); % Generate the colormap
colormap(cmap); % Apply the colormap to the current figure
cb = colorbar; % Create a colorbar
cb.Label.String = ‘mm/day’;
clim([0 16]); % Set color axis limits
cb.Ticks = 0:1:16;
% Overlay coastlines
plotm(coastlat, coastlon, ‘k’, ‘LineWidth’, 1); % Plot coastlines on top of precipitation data
% Add title with month name
title(sprintf(‘Average Monthly Precipitation (1981-2010) – %s’, datestr(dateT(month), ‘mmmm’)));
% Save each figure as an image file
filename = sprintf(‘E:\Koppen-Geiger climate classes\Average_Monthly_Precipitation%d.png’, month);
saveas(f, filename);
close(f);
end worldmap, data input, plot MATLAB Answers — New Questions
MATLAB code for right handed circular polarization
Hello,
I need help to write simple code that preview right handed circular polarization,
using the cos and sin fun.
also in the plot must see the direction of the polarization (for example with arrows).
the expression of RHCP is : Acos(t)+Asint(t)Hello,
I need help to write simple code that preview right handed circular polarization,
using the cos and sin fun.
also in the plot must see the direction of the polarization (for example with arrows).
the expression of RHCP is : Acos(t)+Asint(t) Hello,
I need help to write simple code that preview right handed circular polarization,
using the cos and sin fun.
also in the plot must see the direction of the polarization (for example with arrows).
the expression of RHCP is : Acos(t)+Asint(t) rhcp MATLAB Answers — New Questions
Matlab mobile plot functions
I would like to plot some data in MATLAB Mobile, access the plot and then continue processing back in the code. It won’t allow the plot to draw and be accessed while waiting for the code to finish.I would like to plot some data in MATLAB Mobile, access the plot and then continue processing back in the code. It won’t allow the plot to draw and be accessed while waiting for the code to finish. I would like to plot some data in MATLAB Mobile, access the plot and then continue processing back in the code. It won’t allow the plot to draw and be accessed while waiting for the code to finish. matlab mobile, plot MATLAB Answers — New Questions
如何使用脚本获取simulink模式是否关联了sldd文件
如何通过脚本获取simulink是否关联了sldd文件
如何通过脚本设置simulink关联sldd文件
以及sldd文件的相关属性如何通过脚本获取simulink是否关联了sldd文件
如何通过脚本设置simulink关联sldd文件
以及sldd文件的相关属性 如何通过脚本获取simulink是否关联了sldd文件
如何通过脚本设置simulink关联sldd文件
以及sldd文件的相关属性 simulink, sldd, simulink link sldd MATLAB Answers — New Questions
How to fill a large hole?
The imfill function doesn’t fill the large hole. How can I fill it?
Or, more generally:
How can I separate the image from the background?
Using a very large ‘disk’ might work to fill the hole, but it would also make the subject too large.
Any suggestions?
Thank you!
I = imread("sample_image.png");
BW = imbinarize(I);
se = strel(‘disk’,40);
closeBW = imclose(BW,se);
BW2 = imfill(closeBW,’holes’);
figure
imshowpair(I,BW2,’montage’)The imfill function doesn’t fill the large hole. How can I fill it?
Or, more generally:
How can I separate the image from the background?
Using a very large ‘disk’ might work to fill the hole, but it would also make the subject too large.
Any suggestions?
Thank you!
I = imread("sample_image.png");
BW = imbinarize(I);
se = strel(‘disk’,40);
closeBW = imclose(BW,se);
BW2 = imfill(closeBW,’holes’);
figure
imshowpair(I,BW2,’montage’) The imfill function doesn’t fill the large hole. How can I fill it?
Or, more generally:
How can I separate the image from the background?
Using a very large ‘disk’ might work to fill the hole, but it would also make the subject too large.
Any suggestions?
Thank you!
I = imread("sample_image.png");
BW = imbinarize(I);
se = strel(‘disk’,40);
closeBW = imclose(BW,se);
BW2 = imfill(closeBW,’holes’);
figure
imshowpair(I,BW2,’montage’) fill, hole, separate background, matlab MATLAB Answers — New Questions
Why does my simulation give different results in parsim or batchsim than it does in sim?
I have a simulation that I want to run in parsim, but I have noticed that the simulations output is different than when I run in serial simulation. Why could that be?I have a simulation that I want to run in parsim, but I have noticed that the simulations output is different than when I run in serial simulation. Why could that be? I have a simulation that I want to run in parsim, but I have noticed that the simulations output is different than when I run in serial simulation. Why could that be? parsim, results, different, sim MATLAB Answers — New Questions
Building sparse matrix inside parfor
I’m building a large sparse matrix in smaller pieces. Unfortunately the pieces overlap a bit. At the moment I’m building each piece to match the final size and after the loop I sum the pieces together. I have tried following approaches
1) I tried summing up sparse matrixes inside parfor. Bad idea. Produces full matrix.
2) Build index vectors for each piece of the matrix and combine the index vectors inside parfor. Then use one sparse command after the loop to build the final matrix. This, unfortunately, is rather slow. The reason might be the repetitive entries that the sparse command needs to sum up.
3) Build sparse matrix of each piece and store them in cell array inside parfor. Then sum up the sparse matrixes inside regular for loop. This is the best so far; fast and reliable. (See the pseudocode below.)
4) This is the problematic case: Build sparse vectors out of each piece and store them in cell array. Then sum up the sparse vectors inside regular for loop, and reshape to matrix. Unfortunately for larger systems it crashes with
Error using parallel_function (line 598)
Error during serialization
Error stack:
remoteParallelFunction.m at 31
As a for loop it runs just fine.
Below is some pseudocode to shed light on what I’m doing:
First option 3) that always works.
Aset = cell(1,Nsets) ;
parfor S=1:Nsets
% Do lots of stuff to get iind, jind, Aval
Aset{S} = sparse( iind, jind, Aval, Ndof, Ndof );
end
A = Aset{1};
for S=2:Nsets
A = A + Aset{S} ;
end
Option 4) that gives the error:
Aset = cell(1,Nsets) ;
parfor S=1:Nsets
% Do lots of stuff to get iind, jind, Aval
matind = iind +Ndof*( jind-1 );
Aset{S} = sparse( matind, ones(size(matind)), Aval, Ndof*Ndof, 1 ) ;
end
A = Aset{1};
for S=2:Nsets
A = A + Aset{S} ;
end
A = reshape(A,Ndof,Ndof) ;
Any ideas why option 4 crashes?
How should I do this to gain speed?
The size of the final matrix, i.e. Ndof, is few millions. Number of matrix pieces, i.e. Nsets, is 10 to 30. For option 3 it takes roughly 30 seconds to sum the matrixes of size Ndof=4000000.I’m building a large sparse matrix in smaller pieces. Unfortunately the pieces overlap a bit. At the moment I’m building each piece to match the final size and after the loop I sum the pieces together. I have tried following approaches
1) I tried summing up sparse matrixes inside parfor. Bad idea. Produces full matrix.
2) Build index vectors for each piece of the matrix and combine the index vectors inside parfor. Then use one sparse command after the loop to build the final matrix. This, unfortunately, is rather slow. The reason might be the repetitive entries that the sparse command needs to sum up.
3) Build sparse matrix of each piece and store them in cell array inside parfor. Then sum up the sparse matrixes inside regular for loop. This is the best so far; fast and reliable. (See the pseudocode below.)
4) This is the problematic case: Build sparse vectors out of each piece and store them in cell array. Then sum up the sparse vectors inside regular for loop, and reshape to matrix. Unfortunately for larger systems it crashes with
Error using parallel_function (line 598)
Error during serialization
Error stack:
remoteParallelFunction.m at 31
As a for loop it runs just fine.
Below is some pseudocode to shed light on what I’m doing:
First option 3) that always works.
Aset = cell(1,Nsets) ;
parfor S=1:Nsets
% Do lots of stuff to get iind, jind, Aval
Aset{S} = sparse( iind, jind, Aval, Ndof, Ndof );
end
A = Aset{1};
for S=2:Nsets
A = A + Aset{S} ;
end
Option 4) that gives the error:
Aset = cell(1,Nsets) ;
parfor S=1:Nsets
% Do lots of stuff to get iind, jind, Aval
matind = iind +Ndof*( jind-1 );
Aset{S} = sparse( matind, ones(size(matind)), Aval, Ndof*Ndof, 1 ) ;
end
A = Aset{1};
for S=2:Nsets
A = A + Aset{S} ;
end
A = reshape(A,Ndof,Ndof) ;
Any ideas why option 4 crashes?
How should I do this to gain speed?
The size of the final matrix, i.e. Ndof, is few millions. Number of matrix pieces, i.e. Nsets, is 10 to 30. For option 3 it takes roughly 30 seconds to sum the matrixes of size Ndof=4000000. I’m building a large sparse matrix in smaller pieces. Unfortunately the pieces overlap a bit. At the moment I’m building each piece to match the final size and after the loop I sum the pieces together. I have tried following approaches
1) I tried summing up sparse matrixes inside parfor. Bad idea. Produces full matrix.
2) Build index vectors for each piece of the matrix and combine the index vectors inside parfor. Then use one sparse command after the loop to build the final matrix. This, unfortunately, is rather slow. The reason might be the repetitive entries that the sparse command needs to sum up.
3) Build sparse matrix of each piece and store them in cell array inside parfor. Then sum up the sparse matrixes inside regular for loop. This is the best so far; fast and reliable. (See the pseudocode below.)
4) This is the problematic case: Build sparse vectors out of each piece and store them in cell array. Then sum up the sparse vectors inside regular for loop, and reshape to matrix. Unfortunately for larger systems it crashes with
Error using parallel_function (line 598)
Error during serialization
Error stack:
remoteParallelFunction.m at 31
As a for loop it runs just fine.
Below is some pseudocode to shed light on what I’m doing:
First option 3) that always works.
Aset = cell(1,Nsets) ;
parfor S=1:Nsets
% Do lots of stuff to get iind, jind, Aval
Aset{S} = sparse( iind, jind, Aval, Ndof, Ndof );
end
A = Aset{1};
for S=2:Nsets
A = A + Aset{S} ;
end
Option 4) that gives the error:
Aset = cell(1,Nsets) ;
parfor S=1:Nsets
% Do lots of stuff to get iind, jind, Aval
matind = iind +Ndof*( jind-1 );
Aset{S} = sparse( matind, ones(size(matind)), Aval, Ndof*Ndof, 1 ) ;
end
A = Aset{1};
for S=2:Nsets
A = A + Aset{S} ;
end
A = reshape(A,Ndof,Ndof) ;
Any ideas why option 4 crashes?
How should I do this to gain speed?
The size of the final matrix, i.e. Ndof, is few millions. Number of matrix pieces, i.e. Nsets, is 10 to 30. For option 3 it takes roughly 30 seconds to sum the matrixes of size Ndof=4000000. parfor, sparse MATLAB Answers — New Questions
filtfilt Does Not Perform Zero-Phase Filtering. Does It Matter?
The doc page for filtfilt claims that the function "performs zero-phase digital filtering" and then goes on to describe the expected characteristics of a zero-phase output. It’s pretty easy to show that this claim is false.
Generate some input data
rng(100);
x = rand(1,50);
Define a simple FIR filter
b = 1:4;
a = 1;
The zero-phase filtered output y and its associated discrete times can be computed as
h = b; % filter impulse resonse
y2 = conv(fliplr(h),conv(h,x)); % zero-phase, filtered output
Nh = numel(h); % length of impulse response
Nx = numel(x); % length of input
ny2 = -(Nh-1) : Nh + Nx – 2; % time of output
As must be the case, the output is longer than the input, and the output extends to the left into negative time.
We can show that y2 satisfies the properties for zero-phase filtering
Compute the DTFT of the input and the impulse response
[X,w] = freqz(x,1,1000);
H = freqz(b,a,w);
Compute the DTFT of the output
Y2 = freqz(y2,1,w).*exp(-1j*ny2(1)*w);
The phase of Y2 relative to X is (essentially) zero
figure
plot(w,angle(Y2./X)),xlabel(‘rad’),ylabel(‘rad’)
The magnitude of Y2 relative to X is the square of the magitude of the transfer function
figure
semilogy(w,abs(Y2./X),’DisplayName’,’abs(Y2/X)’)
hold on
semilogy(w,abs(H).^2,’ro’,’MarkerIndices’,1:20:numel(w),’DisplayName’,’abs(H)^2′)
xlabel(‘rad’),ylabel(‘Amplitude’)
legend
Now compare the output of filtfilt() to the zero-phase output
y4 = filtfilt(b,a,x);
ny4 = 0:numel(y4) – 1;
figure
stem(ny2,y2,’DisplayName’,’zero-phase’)
hold on
stem(ny4,y4,’x’,’DisplayName’,’filtfilt’)
legend("Location",’Best’)
The differences are apparent at the edges, undoubtedly because filtfilt() also takes actation that "minimizes start-up and ending transients." However, such action kills the "zero-phase" intent of the function. Even though it looks like the output of filtfilt() is close to the zero-phase output, the phase response really isn’t even close to zero-phase and the magnitude response isn’t abs(H)^2, even after taking into account that filtfilt() only returns the values of the output that correspond to the time samples of the input (it doesn’t return the computed values that extend past the left and right edges of the input).
Edit 13 April 2023
Here is the frequency domain assesment of the output of filtfilt as seen by the user. I didn’t include it in the original post because the output of filtfilt to the user doesn’t include the extra points that extend off the edges of the result that filtfilt computes internally but chops off before returning to the user to make the output points correspond to the input points. However, I’ve looked at those when debugging and they don’t really change the story and I thinkg these plots may be of interest.
Y4 = freqz(y4,1,w);
figure
semilogy(w,abs(Y4./X),’DisplayName’,’abs(Y4/X)’)
hold on
semilogy(w,abs(H).^2,’ro’,’MarkerIndices’,1:20:numel(w),’DisplayName’,’abs(H)^2′)
xlabel(‘rad’),ylabel(‘Amplitude’)
legend
figure
plot(w,angle(Y4./X)),xlabel(‘rad’),ylabel(‘rad’)
Are there applications where the true, zero-phase response (or at least its portion that corresponds to the time samples of the input) is desired?
Should filtfilt() include an option to not minimize transients for applications that need a true, zero-phase filter?
At a minimum, shouldn’t the filtfilt() doc page be updated?
Related to that last question, I think it’s interesting (if not telling) that other functions, like lowpass, that I think operate nearly exactly, if not exactly, the same as filtfilt() only claim that the function "compensates for the delay introduced by the filter."The doc page for filtfilt claims that the function "performs zero-phase digital filtering" and then goes on to describe the expected characteristics of a zero-phase output. It’s pretty easy to show that this claim is false.
Generate some input data
rng(100);
x = rand(1,50);
Define a simple FIR filter
b = 1:4;
a = 1;
The zero-phase filtered output y and its associated discrete times can be computed as
h = b; % filter impulse resonse
y2 = conv(fliplr(h),conv(h,x)); % zero-phase, filtered output
Nh = numel(h); % length of impulse response
Nx = numel(x); % length of input
ny2 = -(Nh-1) : Nh + Nx – 2; % time of output
As must be the case, the output is longer than the input, and the output extends to the left into negative time.
We can show that y2 satisfies the properties for zero-phase filtering
Compute the DTFT of the input and the impulse response
[X,w] = freqz(x,1,1000);
H = freqz(b,a,w);
Compute the DTFT of the output
Y2 = freqz(y2,1,w).*exp(-1j*ny2(1)*w);
The phase of Y2 relative to X is (essentially) zero
figure
plot(w,angle(Y2./X)),xlabel(‘rad’),ylabel(‘rad’)
The magnitude of Y2 relative to X is the square of the magitude of the transfer function
figure
semilogy(w,abs(Y2./X),’DisplayName’,’abs(Y2/X)’)
hold on
semilogy(w,abs(H).^2,’ro’,’MarkerIndices’,1:20:numel(w),’DisplayName’,’abs(H)^2′)
xlabel(‘rad’),ylabel(‘Amplitude’)
legend
Now compare the output of filtfilt() to the zero-phase output
y4 = filtfilt(b,a,x);
ny4 = 0:numel(y4) – 1;
figure
stem(ny2,y2,’DisplayName’,’zero-phase’)
hold on
stem(ny4,y4,’x’,’DisplayName’,’filtfilt’)
legend("Location",’Best’)
The differences are apparent at the edges, undoubtedly because filtfilt() also takes actation that "minimizes start-up and ending transients." However, such action kills the "zero-phase" intent of the function. Even though it looks like the output of filtfilt() is close to the zero-phase output, the phase response really isn’t even close to zero-phase and the magnitude response isn’t abs(H)^2, even after taking into account that filtfilt() only returns the values of the output that correspond to the time samples of the input (it doesn’t return the computed values that extend past the left and right edges of the input).
Edit 13 April 2023
Here is the frequency domain assesment of the output of filtfilt as seen by the user. I didn’t include it in the original post because the output of filtfilt to the user doesn’t include the extra points that extend off the edges of the result that filtfilt computes internally but chops off before returning to the user to make the output points correspond to the input points. However, I’ve looked at those when debugging and they don’t really change the story and I thinkg these plots may be of interest.
Y4 = freqz(y4,1,w);
figure
semilogy(w,abs(Y4./X),’DisplayName’,’abs(Y4/X)’)
hold on
semilogy(w,abs(H).^2,’ro’,’MarkerIndices’,1:20:numel(w),’DisplayName’,’abs(H)^2′)
xlabel(‘rad’),ylabel(‘Amplitude’)
legend
figure
plot(w,angle(Y4./X)),xlabel(‘rad’),ylabel(‘rad’)
Are there applications where the true, zero-phase response (or at least its portion that corresponds to the time samples of the input) is desired?
Should filtfilt() include an option to not minimize transients for applications that need a true, zero-phase filter?
At a minimum, shouldn’t the filtfilt() doc page be updated?
Related to that last question, I think it’s interesting (if not telling) that other functions, like lowpass, that I think operate nearly exactly, if not exactly, the same as filtfilt() only claim that the function "compensates for the delay introduced by the filter." The doc page for filtfilt claims that the function "performs zero-phase digital filtering" and then goes on to describe the expected characteristics of a zero-phase output. It’s pretty easy to show that this claim is false.
Generate some input data
rng(100);
x = rand(1,50);
Define a simple FIR filter
b = 1:4;
a = 1;
The zero-phase filtered output y and its associated discrete times can be computed as
h = b; % filter impulse resonse
y2 = conv(fliplr(h),conv(h,x)); % zero-phase, filtered output
Nh = numel(h); % length of impulse response
Nx = numel(x); % length of input
ny2 = -(Nh-1) : Nh + Nx – 2; % time of output
As must be the case, the output is longer than the input, and the output extends to the left into negative time.
We can show that y2 satisfies the properties for zero-phase filtering
Compute the DTFT of the input and the impulse response
[X,w] = freqz(x,1,1000);
H = freqz(b,a,w);
Compute the DTFT of the output
Y2 = freqz(y2,1,w).*exp(-1j*ny2(1)*w);
The phase of Y2 relative to X is (essentially) zero
figure
plot(w,angle(Y2./X)),xlabel(‘rad’),ylabel(‘rad’)
The magnitude of Y2 relative to X is the square of the magitude of the transfer function
figure
semilogy(w,abs(Y2./X),’DisplayName’,’abs(Y2/X)’)
hold on
semilogy(w,abs(H).^2,’ro’,’MarkerIndices’,1:20:numel(w),’DisplayName’,’abs(H)^2′)
xlabel(‘rad’),ylabel(‘Amplitude’)
legend
Now compare the output of filtfilt() to the zero-phase output
y4 = filtfilt(b,a,x);
ny4 = 0:numel(y4) – 1;
figure
stem(ny2,y2,’DisplayName’,’zero-phase’)
hold on
stem(ny4,y4,’x’,’DisplayName’,’filtfilt’)
legend("Location",’Best’)
The differences are apparent at the edges, undoubtedly because filtfilt() also takes actation that "minimizes start-up and ending transients." However, such action kills the "zero-phase" intent of the function. Even though it looks like the output of filtfilt() is close to the zero-phase output, the phase response really isn’t even close to zero-phase and the magnitude response isn’t abs(H)^2, even after taking into account that filtfilt() only returns the values of the output that correspond to the time samples of the input (it doesn’t return the computed values that extend past the left and right edges of the input).
Edit 13 April 2023
Here is the frequency domain assesment of the output of filtfilt as seen by the user. I didn’t include it in the original post because the output of filtfilt to the user doesn’t include the extra points that extend off the edges of the result that filtfilt computes internally but chops off before returning to the user to make the output points correspond to the input points. However, I’ve looked at those when debugging and they don’t really change the story and I thinkg these plots may be of interest.
Y4 = freqz(y4,1,w);
figure
semilogy(w,abs(Y4./X),’DisplayName’,’abs(Y4/X)’)
hold on
semilogy(w,abs(H).^2,’ro’,’MarkerIndices’,1:20:numel(w),’DisplayName’,’abs(H)^2′)
xlabel(‘rad’),ylabel(‘Amplitude’)
legend
figure
plot(w,angle(Y4./X)),xlabel(‘rad’),ylabel(‘rad’)
Are there applications where the true, zero-phase response (or at least its portion that corresponds to the time samples of the input) is desired?
Should filtfilt() include an option to not minimize transients for applications that need a true, zero-phase filter?
At a minimum, shouldn’t the filtfilt() doc page be updated?
Related to that last question, I think it’s interesting (if not telling) that other functions, like lowpass, that I think operate nearly exactly, if not exactly, the same as filtfilt() only claim that the function "compensates for the delay introduced by the filter." filtfilt, zero-phase filter MATLAB Answers — New Questions
Cannot make Linearization work
Still after watching several tutorials I cannot make the Model Linearizer work as I hope it shoud (and how it seems to work for anybody else)
I have the following Simuling model:
Everything on Simuling works fine, I get this output from the measurement probe:
Then I mark the step input as Linear Analysis Point/Open-loop input (tried also with Input perturbation) and the probe signal as Linear Analysis Point/Output measurement. Then I start the Model linearizer (in many videos I see that it is called from a menu item that doesn’t show up in my Simuling: Analysis/Contro Design/Linear analsys, but I assume it is the same, probably just different software releases).
Finally, when I hit "Step" or "Bode", all I get is a flat response (basically only the steady-state value):
What am I missing? I also tried playing around with different operating points (i.e., [0, 1, 1.1, 2, ….] to no avail.
I would expect to get the same output, and from there extract the transfer function. Thanks for any helpStill after watching several tutorials I cannot make the Model Linearizer work as I hope it shoud (and how it seems to work for anybody else)
I have the following Simuling model:
Everything on Simuling works fine, I get this output from the measurement probe:
Then I mark the step input as Linear Analysis Point/Open-loop input (tried also with Input perturbation) and the probe signal as Linear Analysis Point/Output measurement. Then I start the Model linearizer (in many videos I see that it is called from a menu item that doesn’t show up in my Simuling: Analysis/Contro Design/Linear analsys, but I assume it is the same, probably just different software releases).
Finally, when I hit "Step" or "Bode", all I get is a flat response (basically only the steady-state value):
What am I missing? I also tried playing around with different operating points (i.e., [0, 1, 1.1, 2, ….] to no avail.
I would expect to get the same output, and from there extract the transfer function. Thanks for any help Still after watching several tutorials I cannot make the Model Linearizer work as I hope it shoud (and how it seems to work for anybody else)
I have the following Simuling model:
Everything on Simuling works fine, I get this output from the measurement probe:
Then I mark the step input as Linear Analysis Point/Open-loop input (tried also with Input perturbation) and the probe signal as Linear Analysis Point/Output measurement. Then I start the Model linearizer (in many videos I see that it is called from a menu item that doesn’t show up in my Simuling: Analysis/Contro Design/Linear analsys, but I assume it is the same, probably just different software releases).
Finally, when I hit "Step" or "Bode", all I get is a flat response (basically only the steady-state value):
What am I missing? I also tried playing around with different operating points (i.e., [0, 1, 1.1, 2, ….] to no avail.
I would expect to get the same output, and from there extract the transfer function. Thanks for any help linearization, transfer function, simulink MATLAB Answers — New Questions
How do I find and plot the average of action potentials from a trace?
Hi,
I need to find the average wave from several in a trace.
I would like to produce a figure where the action potentials are stacked, with their average incorporated into the figure.
I only managed to find peaks in the waveform and plot them but I don’t know how to proceed.
%What I have so far:
clear
close all
D = load(‘C:UsersrsanaDesktopAPAnalysisS2C1_17082020_WM4peaks.mat’);
F = fieldnames(D);
C = struct2cell(D);
vm = C{1}.values; % Signal Vector
L1 = numel(vm); % Length
% Set Time Vector for ms Interval
t = linspace(0, L1, L1).’*C{1}.interval;
% Determine peaks, time interval, and cutoff for APs
[peaks, int, W] = findpeaks(vm, ‘WidthReference’, ‘halfprom’);
figure
plot(t, vm)
hold on
plot(t(int), peaks, ‘+r’)
hold off
xlabel(‘Time (s)’)
ylabel(‘Voltage (mV)’)
%%%
The above generates labelled peaks. So I am wondering how to extract, stack, and average them.
Thank you,
RoksanaHi,
I need to find the average wave from several in a trace.
I would like to produce a figure where the action potentials are stacked, with their average incorporated into the figure.
I only managed to find peaks in the waveform and plot them but I don’t know how to proceed.
%What I have so far:
clear
close all
D = load(‘C:UsersrsanaDesktopAPAnalysisS2C1_17082020_WM4peaks.mat’);
F = fieldnames(D);
C = struct2cell(D);
vm = C{1}.values; % Signal Vector
L1 = numel(vm); % Length
% Set Time Vector for ms Interval
t = linspace(0, L1, L1).’*C{1}.interval;
% Determine peaks, time interval, and cutoff for APs
[peaks, int, W] = findpeaks(vm, ‘WidthReference’, ‘halfprom’);
figure
plot(t, vm)
hold on
plot(t(int), peaks, ‘+r’)
hold off
xlabel(‘Time (s)’)
ylabel(‘Voltage (mV)’)
%%%
The above generates labelled peaks. So I am wondering how to extract, stack, and average them.
Thank you,
Roksana Hi,
I need to find the average wave from several in a trace.
I would like to produce a figure where the action potentials are stacked, with their average incorporated into the figure.
I only managed to find peaks in the waveform and plot them but I don’t know how to proceed.
%What I have so far:
clear
close all
D = load(‘C:UsersrsanaDesktopAPAnalysisS2C1_17082020_WM4peaks.mat’);
F = fieldnames(D);
C = struct2cell(D);
vm = C{1}.values; % Signal Vector
L1 = numel(vm); % Length
% Set Time Vector for ms Interval
t = linspace(0, L1, L1).’*C{1}.interval;
% Determine peaks, time interval, and cutoff for APs
[peaks, int, W] = findpeaks(vm, ‘WidthReference’, ‘halfprom’);
figure
plot(t, vm)
hold on
plot(t(int), peaks, ‘+r’)
hold off
xlabel(‘Time (s)’)
ylabel(‘Voltage (mV)’)
%%%
The above generates labelled peaks. So I am wondering how to extract, stack, and average them.
Thank you,
Roksana waveform analysis, average action potential MATLAB Answers — New Questions
image coordinates to robot coordinates
Hello to Community members.
2D image coordinates to 3D robot coordinates is an old topic with so many threads but there is a confusion i need to ask..
i am working on a project of guiding the 6 DOF ABB Industrial robotic arm using a Full HD Webcam to reach a designated location. Almost all the previous threads i have gone through mentions calibration and transformation of smaller robots where calculations between image and robot base can be done usign small ruler.
2nd camera is calibrated using checkerboard method. which is suggested to be calibrated using 20 or more checkerboard images. after calibration it gives "Rotation Matrices of 3*3 for 20 images and translational vectors of 1*3 for 20 images.
As in actual process guide, for camera extrinsic calculation R and T matrices are used, Which one rotataion and translational vector among these 20 we will use for calculation of base transformation in actual process guide? Sorry for a childish question but i will be thankful for a decent guide.
can somebody share his experience in detail that how to transform or map 2D image coordinates of calibrated fisheye camera to 3D robot coordinates (for 6 dof industrial robot) so the robotic arm moves to exact position deteted by webcam.? (Distance in real time between Image coordinates (u,v) and robot 3D coordinate (x,y,z) of base or TCP.
i am not asking for a complete solution, rather i need some useful hints to guide me in proper way. (the camera will be mounted on robotic arm)
regardssHello to Community members.
2D image coordinates to 3D robot coordinates is an old topic with so many threads but there is a confusion i need to ask..
i am working on a project of guiding the 6 DOF ABB Industrial robotic arm using a Full HD Webcam to reach a designated location. Almost all the previous threads i have gone through mentions calibration and transformation of smaller robots where calculations between image and robot base can be done usign small ruler.
2nd camera is calibrated using checkerboard method. which is suggested to be calibrated using 20 or more checkerboard images. after calibration it gives "Rotation Matrices of 3*3 for 20 images and translational vectors of 1*3 for 20 images.
As in actual process guide, for camera extrinsic calculation R and T matrices are used, Which one rotataion and translational vector among these 20 we will use for calculation of base transformation in actual process guide? Sorry for a childish question but i will be thankful for a decent guide.
can somebody share his experience in detail that how to transform or map 2D image coordinates of calibrated fisheye camera to 3D robot coordinates (for 6 dof industrial robot) so the robotic arm moves to exact position deteted by webcam.? (Distance in real time between Image coordinates (u,v) and robot 3D coordinate (x,y,z) of base or TCP.
i am not asking for a complete solution, rather i need some useful hints to guide me in proper way. (the camera will be mounted on robotic arm)
regardss Hello to Community members.
2D image coordinates to 3D robot coordinates is an old topic with so many threads but there is a confusion i need to ask..
i am working on a project of guiding the 6 DOF ABB Industrial robotic arm using a Full HD Webcam to reach a designated location. Almost all the previous threads i have gone through mentions calibration and transformation of smaller robots where calculations between image and robot base can be done usign small ruler.
2nd camera is calibrated using checkerboard method. which is suggested to be calibrated using 20 or more checkerboard images. after calibration it gives "Rotation Matrices of 3*3 for 20 images and translational vectors of 1*3 for 20 images.
As in actual process guide, for camera extrinsic calculation R and T matrices are used, Which one rotataion and translational vector among these 20 we will use for calculation of base transformation in actual process guide? Sorry for a childish question but i will be thankful for a decent guide.
can somebody share his experience in detail that how to transform or map 2D image coordinates of calibrated fisheye camera to 3D robot coordinates (for 6 dof industrial robot) so the robotic arm moves to exact position deteted by webcam.? (Distance in real time between Image coordinates (u,v) and robot 3D coordinate (x,y,z) of base or TCP.
i am not asking for a complete solution, rather i need some useful hints to guide me in proper way. (the camera will be mounted on robotic arm)
regardss robot coordinates MATLAB Answers — New Questions
error using sin or math.sin
I have plugged in math.sin and sin into my equation and I continue getting errors when trying to run the script. I am lost and I am not sure how to correct this.
(8+6)*abs(4-15) + math.sin(math.log10(18))-(4+6) * math.tan(8/18+1)
Unable to resolve the name ‘math.sin’.
(8+6)*abs(4-15) + sin*(math.log10(18))-(4+6) * math.tan(8/18+1)
Error using sin. Not enough input arguments.I have plugged in math.sin and sin into my equation and I continue getting errors when trying to run the script. I am lost and I am not sure how to correct this.
(8+6)*abs(4-15) + math.sin(math.log10(18))-(4+6) * math.tan(8/18+1)
Unable to resolve the name ‘math.sin’.
(8+6)*abs(4-15) + sin*(math.log10(18))-(4+6) * math.tan(8/18+1)
Error using sin. Not enough input arguments. I have plugged in math.sin and sin into my equation and I continue getting errors when trying to run the script. I am lost and I am not sure how to correct this.
(8+6)*abs(4-15) + math.sin(math.log10(18))-(4+6) * math.tan(8/18+1)
Unable to resolve the name ‘math.sin’.
(8+6)*abs(4-15) + sin*(math.log10(18))-(4+6) * math.tan(8/18+1)
Error using sin. Not enough input arguments. matlab MATLAB Answers — New Questions
Newbie starter – AC generator circuit in Simulink
Hello everybody.
I’m a new starter to Matlab and Simulink, and I’m trying to create a basic electrical circuit in Simulink. It’s comprised of a ‘Synchronous Machine SI Fundamental’ block, using ‘Preset Model 05: 50hZ 400V 60kVA 1500RPM’, and feeds a ‘Three-Phase Parallel RLC Load’ block, with parameters of 400V P-P, 10KW, +7.5kVAr and -5.0kVAr. I have a constant block of 100*pi (for 1500 rpm) connected to the PM input, and another constant of 3.212 connected to the Vf input of the generator, to provide speed and field voltage respectively. From the ‘m’ terminal I have a Bus Selector with 9 parameters selected, which then feed a 9-input scope. These inputs are:
Electrical power,
Rotor speed,
Field current,
Output active power,
Output reactive power,
is_A,
is_B,
is_C,
Load angle.
When I run the simulation the graphs in the scope display low electrical power, negative rotor speed, low output active power, massive output reactive power and a load angle that oscillates between +200 and -200 degrees. Additionally, nothing seems to happen for the first 55 seconds of the simulation, then from 55 to 60 seconds (when the simulation stops) I have activity.
I’d like some tips on how to correct this. My intent upon getting this going is to replace the Vf constant with a control system (PID or otherwise) to act as an automatic voltage regulator, and modify the model to simulate faults and changes in load. First things first though.
I don’t know if models can be posted on here. If they can, could someone tell me how and I’ll put it up for people to have a look at? I’ve tried to attach a picture of the circuit. I’ve also tried to attach some pictures of the scope displays. I’d also like to know how to slow down the simulation, if that’s possible?
Thanks in advance!Hello everybody.
I’m a new starter to Matlab and Simulink, and I’m trying to create a basic electrical circuit in Simulink. It’s comprised of a ‘Synchronous Machine SI Fundamental’ block, using ‘Preset Model 05: 50hZ 400V 60kVA 1500RPM’, and feeds a ‘Three-Phase Parallel RLC Load’ block, with parameters of 400V P-P, 10KW, +7.5kVAr and -5.0kVAr. I have a constant block of 100*pi (for 1500 rpm) connected to the PM input, and another constant of 3.212 connected to the Vf input of the generator, to provide speed and field voltage respectively. From the ‘m’ terminal I have a Bus Selector with 9 parameters selected, which then feed a 9-input scope. These inputs are:
Electrical power,
Rotor speed,
Field current,
Output active power,
Output reactive power,
is_A,
is_B,
is_C,
Load angle.
When I run the simulation the graphs in the scope display low electrical power, negative rotor speed, low output active power, massive output reactive power and a load angle that oscillates between +200 and -200 degrees. Additionally, nothing seems to happen for the first 55 seconds of the simulation, then from 55 to 60 seconds (when the simulation stops) I have activity.
I’d like some tips on how to correct this. My intent upon getting this going is to replace the Vf constant with a control system (PID or otherwise) to act as an automatic voltage regulator, and modify the model to simulate faults and changes in load. First things first though.
I don’t know if models can be posted on here. If they can, could someone tell me how and I’ll put it up for people to have a look at? I’ve tried to attach a picture of the circuit. I’ve also tried to attach some pictures of the scope displays. I’d also like to know how to slow down the simulation, if that’s possible?
Thanks in advance! Hello everybody.
I’m a new starter to Matlab and Simulink, and I’m trying to create a basic electrical circuit in Simulink. It’s comprised of a ‘Synchronous Machine SI Fundamental’ block, using ‘Preset Model 05: 50hZ 400V 60kVA 1500RPM’, and feeds a ‘Three-Phase Parallel RLC Load’ block, with parameters of 400V P-P, 10KW, +7.5kVAr and -5.0kVAr. I have a constant block of 100*pi (for 1500 rpm) connected to the PM input, and another constant of 3.212 connected to the Vf input of the generator, to provide speed and field voltage respectively. From the ‘m’ terminal I have a Bus Selector with 9 parameters selected, which then feed a 9-input scope. These inputs are:
Electrical power,
Rotor speed,
Field current,
Output active power,
Output reactive power,
is_A,
is_B,
is_C,
Load angle.
When I run the simulation the graphs in the scope display low electrical power, negative rotor speed, low output active power, massive output reactive power and a load angle that oscillates between +200 and -200 degrees. Additionally, nothing seems to happen for the first 55 seconds of the simulation, then from 55 to 60 seconds (when the simulation stops) I have activity.
I’d like some tips on how to correct this. My intent upon getting this going is to replace the Vf constant with a control system (PID or otherwise) to act as an automatic voltage regulator, and modify the model to simulate faults and changes in load. First things first though.
I don’t know if models can be posted on here. If they can, could someone tell me how and I’ll put it up for people to have a look at? I’ve tried to attach a picture of the circuit. I’ve also tried to attach some pictures of the scope displays. I’d also like to know how to slow down the simulation, if that’s possible?
Thanks in advance! simulink MATLAB Answers — New Questions
steady plot end with different rate of rise question
Hello, in the photo below the start and end points are stable,the rate of change between them changes.
In the code below i tried to use exponential curves but different rate gives me different end point.
is there some wat the curves will start and end at the same points as shown below?
Thanks.
% Define the range of x values
x = linspace(0, 1, 10); % 0 to 1 with 100 points
% Define different rates for the exponential rise
rate1 = 10; % Faster rise
rate2 = 9.9; % Moderate rise
rate3 = 2; % Slower rise
% Compute the exponential values
y1 = exp(rate1 * x) – 1; % Exponential curve 1
y2 = exp(rate2 * x) – 1; % Exponential curve 2
y3 = exp(rate3 * x) – 1; % Exponential curve 3
% Plot the exponential curves
figure;
plot(x, y1, ‘b’, ‘LineWidth’, 1.5); hold on;
plot(x, y2, ‘r’, ‘LineWidth’, 1.5);
plot(x, y3, ‘g’, ‘LineWidth’, 1.5);
% Add labels and legend
xlabel(‘x-axis’);
ylabel(‘y-axis’);
legend({‘Rate = 10’, ‘Rate = 5’, ‘Rate = 2’}, ‘Location’, ‘NorthEast’);
title(‘Exponential Rise at Different Rates’);
grid on;Hello, in the photo below the start and end points are stable,the rate of change between them changes.
In the code below i tried to use exponential curves but different rate gives me different end point.
is there some wat the curves will start and end at the same points as shown below?
Thanks.
% Define the range of x values
x = linspace(0, 1, 10); % 0 to 1 with 100 points
% Define different rates for the exponential rise
rate1 = 10; % Faster rise
rate2 = 9.9; % Moderate rise
rate3 = 2; % Slower rise
% Compute the exponential values
y1 = exp(rate1 * x) – 1; % Exponential curve 1
y2 = exp(rate2 * x) – 1; % Exponential curve 2
y3 = exp(rate3 * x) – 1; % Exponential curve 3
% Plot the exponential curves
figure;
plot(x, y1, ‘b’, ‘LineWidth’, 1.5); hold on;
plot(x, y2, ‘r’, ‘LineWidth’, 1.5);
plot(x, y3, ‘g’, ‘LineWidth’, 1.5);
% Add labels and legend
xlabel(‘x-axis’);
ylabel(‘y-axis’);
legend({‘Rate = 10’, ‘Rate = 5’, ‘Rate = 2’}, ‘Location’, ‘NorthEast’);
title(‘Exponential Rise at Different Rates’);
grid on; Hello, in the photo below the start and end points are stable,the rate of change between them changes.
In the code below i tried to use exponential curves but different rate gives me different end point.
is there some wat the curves will start and end at the same points as shown below?
Thanks.
% Define the range of x values
x = linspace(0, 1, 10); % 0 to 1 with 100 points
% Define different rates for the exponential rise
rate1 = 10; % Faster rise
rate2 = 9.9; % Moderate rise
rate3 = 2; % Slower rise
% Compute the exponential values
y1 = exp(rate1 * x) – 1; % Exponential curve 1
y2 = exp(rate2 * x) – 1; % Exponential curve 2
y3 = exp(rate3 * x) – 1; % Exponential curve 3
% Plot the exponential curves
figure;
plot(x, y1, ‘b’, ‘LineWidth’, 1.5); hold on;
plot(x, y2, ‘r’, ‘LineWidth’, 1.5);
plot(x, y3, ‘g’, ‘LineWidth’, 1.5);
% Add labels and legend
xlabel(‘x-axis’);
ylabel(‘y-axis’);
legend({‘Rate = 10’, ‘Rate = 5’, ‘Rate = 2’}, ‘Location’, ‘NorthEast’);
title(‘Exponential Rise at Different Rates’);
grid on; rate of rise steady ends MATLAB Answers — New Questions
How to find the period between group of regularly spaced hot-spots?
I have a group of numbers with values enriched at uniformly regularly spaced hot-spots.
There is no other information available.
How to get the estimated length of the space between these hot-spots?
For this example, the interval is about 128.I have a group of numbers with values enriched at uniformly regularly spaced hot-spots.
There is no other information available.
How to get the estimated length of the space between these hot-spots?
For this example, the interval is about 128. I have a group of numbers with values enriched at uniformly regularly spaced hot-spots.
There is no other information available.
How to get the estimated length of the space between these hot-spots?
For this example, the interval is about 128. period MATLAB Answers — New Questions