Category: Matlab
Category Archives: Matlab
How to keep the order in plotting scatter plot with categorical variables
Hi,
I am using scatter (b,a) where a is categorical variable and b is double. The plot shows a different order than in my list in a. How do I keep the same order in the plot?Hi,
I am using scatter (b,a) where a is categorical variable and b is double. The plot shows a different order than in my list in a. How do I keep the same order in the plot? Hi,
I am using scatter (b,a) where a is categorical variable and b is double. The plot shows a different order than in my list in a. How do I keep the same order in the plot? scatter, plot, categorical MATLAB Answers — New Questions
Why do I get the error “Unable to resolve the name com.mathworks.toolbox.distcomp.ui.widget.SupportedDataTypes.STRING” when running configCluster?
Why do I get the error "Unable to resolve the name com.mathworks.toolbox.distcomp.ui.widget.SupportedDataTypes.STRING" when running configCluster?Why do I get the error "Unable to resolve the name com.mathworks.toolbox.distcomp.ui.widget.SupportedDataTypes.STRING" when running configCluster? Why do I get the error "Unable to resolve the name com.mathworks.toolbox.distcomp.ui.widget.SupportedDataTypes.STRING" when running configCluster? MATLAB Answers — New Questions
Using the trigonometric Fourier series to develop MATLAB code to confirm correctness
fs = 2/5 + sum(2/(n*pi)*sin(2*pi/5*n)*cos(2*pi/5*n*t))
x(t) = sum(rect((t-5*n)/2))
I really don’t know how to plot two function. Please help me.fs = 2/5 + sum(2/(n*pi)*sin(2*pi/5*n)*cos(2*pi/5*n*t))
x(t) = sum(rect((t-5*n)/2))
I really don’t know how to plot two function. Please help me. fs = 2/5 + sum(2/(n*pi)*sin(2*pi/5*n)*cos(2*pi/5*n*t))
x(t) = sum(rect((t-5*n)/2))
I really don’t know how to plot two function. Please help me. trigonometric fourier series MATLAB Answers — New Questions
Has anyone found a way to enable/disable tabs in App Designer?
I am building a fairly simple GUI in I have tried implementations using findjobj, such as:
jtabgroup=findjobj(tabgrp);
jtabgroup.setEnabledAt(1,0);
but I am unsure if the app class can be read the same way (I’m very new to Java implementations). Any help would be much appreciated!I am building a fairly simple GUI in I have tried implementations using findjobj, such as:
jtabgroup=findjobj(tabgrp);
jtabgroup.setEnabledAt(1,0);
but I am unsure if the app class can be read the same way (I’m very new to Java implementations). Any help would be much appreciated! I am building a fairly simple GUI in I have tried implementations using findjobj, such as:
jtabgroup=findjobj(tabgrp);
jtabgroup.setEnabledAt(1,0);
but I am unsure if the app class can be read the same way (I’m very new to Java implementations). Any help would be much appreciated! gui, app designer MATLAB Answers — New Questions
Why do my laptop and work computer produce different results when adding a small term to a matrix?
In the following code, when I add the term eye(8)*(0.0001) to the matrix F, my laptop and my work computer return different values for the variable Uk. Could anyone please help me understand what is happening?
I am using MATLAB R2024a on both computers.
clear; clc;
% constants
a = 1;
x1 = 1;
x2 = 0;
x4 = 0;
lambda = 1;
sigma3 = diag([1 1 1 1 -1 -1 -1 -1]);
kx = -2.0944;
ky = -3.6276;
F = [ – 0.4444*x4*lambda^3 + (2.0*x1 + 2.0*x2)*lambda, – lambda*(x2*(exp(-a*ky*0.866i) + exp(a*ky*0.866i)) + x1*(exp(-a*kx*0.5i) + exp(a*kx*0.5i)))*(0.3333 – 4.082e-17i) – 1.0*x4*lambda^3*(exp(-a*kx*0.5i)*(0.8889 + 5.551e-17i) + exp(a*kx*0.5i)*(0.8889 + 5.551e-17i)) + x4*lambda^3*(exp(-a*kx*0.5i)*(0.8889 + 1.11e-16i) + exp(a*kx*0.5i)*(0.8889 + 1.11e-16i)) + x4*lambda^3*(exp(-a*kx*0.5i)*(0.2222 – 2.721e-17i) + exp(a*kx*0.5i)*(0.2222 – 2.721e-17i)), lambda*(x1*(exp(- a*kx*0.25i + a*ky*0.433i) + exp(a*kx*0.25i – a*ky*0.433i)) + x2*(exp(- a*kx*0.75i – a*ky*0.433i) + exp(a*kx*0.75i + a*ky*0.433i)))*(0.1667 – 0.2887i) – x4*lambda^3*(exp(- a*kx*0.25i + a*ky*0.433i) + exp(a*kx*0.25i – a*ky*0.433i))*(0.7778 – 1.347i), lambda*(x1*(exp(- a*kx*0.25i – a*ky*0.433i) + exp(a*kx*0.25i + a*ky*0.433i)) + x2*(exp(- a*kx*0.75i + a*ky*0.433i) + exp(a*kx*0.75i – a*ky*0.433i)))*(0.1667 + 0.2887i) – x4*lambda^3*(exp(- a*kx*0.25i – a*ky*0.433i) + exp(a*kx*0.25i + a*ky*0.433i))*(0.1111 + 0.1925i), 0, lambda*(x2*(exp(-a*ky*0.866i) + exp(a*ky*0.866i)) + x1*(exp(-a*kx*0.5i) + exp(a*kx*0.5i)))*(0.6667 – 8.164e-17i) + x4*lambda^3*(exp(-a*kx*0.5i) + exp(a*kx*0.5i))*1.54i – 1.0*x4*lambda^3*(exp(-a*kx*0.5i)*(0.4444 – 5.443e-17i) + exp(a*kx*0.5i)*(0.4444 – 5.443e-17i)), – lambda*(x1*(exp(- a*kx*0.25i + a*ky*0.433i) + exp(a*kx*0.25i – a*ky*0.433i)) + x2*(exp(- a*kx*0.75i – a*ky*0.433i) + exp(a*kx*0.75i + a*ky*0.433i)))*(0.3333 – 0.5774i) – x4*lambda^3*(exp(- a*kx*0.25i + a*ky*0.433i) + exp(a*kx*0.25i – a*ky*0.433i))*(0.6667 + 0.3849i) + x4*lambda^3*(exp(- a*kx*0.25i + a*ky*0.433i)*(0.8889 + 1.11e-16i) + exp(a*kx*0.25i – a*ky*0.433i)*(0.8889 + 1.11e-16i)), – lambda*(x1*(exp(- a*kx*0.25i – a*ky*0.433i) + exp(a*kx*0.25i + a*ky*0.433i)) + x2*(exp(- a*kx*0.75i + a*ky*0.433i) + exp(a*kx*0.75i – a*ky*0.433i)))*(0.3333 + 0.5774i) – x4*lambda^3*(exp(- a*kx*0.25i – a*ky*0.433i) + exp(a*kx*0.25i + a*ky*0.433i))*(0.2222 – 1.155i) – 1.0*x4*lambda^3*(exp(- a*kx*0.25i – a*ky*0.433i)*(0.8889 + 5.551e-17i) + exp(a*kx*0.25i + a*ky*0.433i)*(0.8889 + 5.551e-17i))
– lambda*(x2*(exp(-a*ky*0.866i) + exp(a*ky*0.866i)) + x1*(exp(-a*kx*0.5i) + exp(a*kx*0.5i)))*(0.3333 + 4.082e-17i) – 1.0*x4*lambda^3*(exp(-a*kx*0.5i)*(0.8889 – 5.551e-17i) + exp(a*kx*0.5i)*(0.8889 – 5.551e-17i)) + x4*lambda^3*(exp(-a*kx*0.5i)*(0.8889 – 1.11e-16i) + exp(a*kx*0.5i)*(0.8889 – 1.11e-16i)) + x4*lambda^3*(exp(-a*kx*0.5i)*(0.2222 + 2.721e-17i) + exp(a*kx*0.5i)*(0.2222 + 2.721e-17i)), – 0.4444*x4*lambda^3 + (2.0*x1 + 2.0*x2)*lambda, lambda*(x1*(exp(- a*kx*0.25i – a*ky*0.433i) + exp(a*kx*0.25i + a*ky*0.433i)) + x2*(exp(- a*kx*0.75i + a*ky*0.433i) + exp(a*kx*0.75i – a*ky*0.433i)))*(0.1667 – 0.2887i) – x4*lambda^3*(exp(- a*kx*0.25i – a*ky*0.433i) + exp(a*kx*0.25i + a*ky*0.433i))*(0.1111 – 0.1925i), lambda*(x1*(exp(- a*kx*0.25i + a*ky*0.433i) + exp(a*kx*0.25i – a*ky*0.433i)) + x2*(exp(- a*kx*0.75i – a*ky*0.433i) + exp(a*kx*0.75i + a*ky*0.433i)))*(0.1667 + 0.2887i) – x4*lambda^3*(exp(- a*kx*0.25i + a*ky*0.433i) + exp(a*kx*0.25i – a*ky*0.433i))*(0.7778 + 1.347i), lambda*(x2*(exp(-a*ky*0.866i) + exp(a*ky*0.866i)) + x1*(exp(-a*kx*0.5i) + exp(a*kx*0.5i)))*(0.6667 – 8.164e-17i) + x4*lambda^3*(exp(-a*kx*0.5i) + exp(a*kx*0.5i))*1.54i – 1.0*x4*lambda^3*(exp(-a*kx*0.5i)*(0.4444 – 5.443e-17i) + exp(a*kx*0.5i)*(0.4444 – 5.443e-17i)), 0, lambda*(x1*(exp(- a*kx*0.25i – a*ky*0.433i) + exp(a*kx*0.25i + a*ky*0.433i)) + x2*(exp(- a*kx*0.75i + a*ky*0.433i) + exp(a*kx*0.75i – a*ky*0.433i)))*(0.6667 – 1.027e-33i) – x4*lambda^3*(exp(- a*kx*0.25i – a*ky*0.433i) + exp(a*kx*0.25i + a*ky*0.433i))*1.54i – 1.0*x4*lambda^3*(0.4444*exp(- a*kx*0.25i – a*ky*0.433i) + 0.4444*exp(a*kx*0.25i + a*ky*0.433i)), lambda*(x1*(exp(- a*kx*0.25i + a*ky*0.433i) + exp(a*kx*0.25i – a*ky*0.433i)) + x2*(exp(- a*kx*0.75i – a*ky*0.433i) + exp(a*kx*0.75i + a*ky*0.433i)))*(0.6667 – 1.027e-33i) – 0.8889*x4*lambda^3*(exp(- a*kx*0.25i + a*ky*0.433i) + exp(a*kx*0.25i – a*ky*0.433i)) + x4*lambda^3*(0.4444*exp(- a*kx*0.25i + a*ky*0.433i) + 0.4444*exp(a*kx*0.25i – a*ky*0.433i))
lambda*(x1*(exp(- a*kx*0.25i + a*ky*0.433i) + exp(a*kx*0.25i – a*ky*0.433i)) + x2*(exp(- a*kx*0.75i – a*ky*0.433i) + exp(a*kx*0.75i + a*ky*0.433i)))*(0.1667 + 0.2887i) – x4*lambda^3*(exp(- a*kx*0.25i + a*ky*0.433i) + exp(a*kx*0.25i – a*ky*0.433i))*(0.7778 + 1.347i), lambda*(x1*(exp(- a*kx*0.25i – a*ky*0.433i) + exp(a*kx*0.25i + a*ky*0.433i)) + x2*(exp(- a*kx*0.75i + a*ky*0.433i) + exp(a*kx*0.75i – a*ky*0.433i)))*(0.1667 + 0.2887i) – x4*lambda^3*(exp(- a*kx*0.25i – a*ky*0.433i) + exp(a*kx*0.25i + a*ky*0.433i))*(0.1111 + 0.1925i), – 0.4444*x4*lambda^3 + (2.0*x1 + 2.0*x2)*lambda, lambda*(x2*(exp(-a*ky*0.866i) + exp(a*ky*0.866i)) + x1*(exp(-a*kx*0.5i) + exp(a*kx*0.5i)))*(0.1667 – 0.2887i) – x4*lambda^3*(exp(-a*kx*0.5i) + exp(a*kx*0.5i))*(0.1111 – 0.1925i), – lambda*(x1*(exp(- a*kx*0.25i + a*ky*0.433i) + exp(a*kx*0.25i – a*ky*0.433i)) + x2*(exp(- a*kx*0.75i – a*ky*0.433i) + exp(a*kx*0.75i + a*ky*0.433i)))*(0.3333 – 0.5774i) – x4*lambda^3*(exp(- a*kx*0.25i + a*ky*0.433i) + exp(a*kx*0.25i – a*ky*0.433i))*(0.6667 + 0.3849i) + x4*lambda^3*(exp(- a*kx*0.25i + a*ky*0.433i)*(0.8889 + 1.11e-16i) + exp(a*kx*0.25i – a*ky*0.433i)*(0.8889 + 1.11e-16i)), lambda*(x1*(exp(- a*kx*0.25i – a*ky*0.433i) + exp(a*kx*0.25i + a*ky*0.433i)) + x2*(exp(- a*kx*0.75i + a*ky*0.433i) + exp(a*kx*0.75i – a*ky*0.433i)))*(0.6667 – 1.027e-33i) – x4*lambda^3*(exp(- a*kx*0.25i – a*ky*0.433i) + exp(a*kx*0.25i + a*ky*0.433i))*(1.257 + 1.54i), 0, 0.6667*lambda*(x2*(exp(-a*ky*0.866i) + exp(a*ky*0.866i)) + x1*(exp(-a*kx*0.5i) + exp(a*kx*0.5i))) + x4*lambda^3*(exp(-a*kx*0.5i) + exp(a*kx*0.5i))*1.54i – 1.0*x4*lambda^3*(exp(-a*kx*0.5i)*(0.4444 – 1.388e-17i) + exp(a*kx*0.5i)*(0.4444 – 1.388e-17i))
lambda*(x1*(exp(- a*kx*0.25i – a*ky*0.433i) + exp(a*kx*0.25i + a*ky*0.433i)) + x2*(exp(- a*kx*0.75i + a*ky*0.433i) + exp(a*kx*0.75i – a*ky*0.433i)))*(0.1667 – 0.2887i) – x4*lambda^3*(exp(- a*kx*0.25i – a*ky*0.433i) + exp(a*kx*0.25i + a*ky*0.433i))*(0.1111 – 0.1925i), lambda*(x1*(exp(- a*kx*0.25i + a*ky*0.433i) + exp(a*kx*0.25i – a*ky*0.433i)) + x2*(exp(- a*kx*0.75i – a*ky*0.433i) + exp(a*kx*0.75i + a*ky*0.433i)))*(0.1667 – 0.2887i) – x4*lambda^3*(exp(- a*kx*0.25i + a*ky*0.433i) + exp(a*kx*0.25i – a*ky*0.433i))*(0.7778 – 1.347i), lambda*(x2*(exp(-a*ky*0.866i) + exp(a*ky*0.866i)) + x1*(exp(-a*kx*0.5i) + exp(a*kx*0.5i)))*(0.1667 + 0.2887i) – x4*lambda^3*(exp(-a*kx*0.5i) + exp(a*kx*0.5i))*(0.1111 + 0.1925i), – 0.4444*x4*lambda^3 + (2.0*x1 + 2.0*x2)*lambda, – lambda*(x1*(exp(- a*kx*0.25i – a*ky*0.433i) + exp(a*kx*0.25i + a*ky*0.433i)) + x2*(exp(- a*kx*0.75i + a*ky*0.433i) + exp(a*kx*0.75i – a*ky*0.433i)))*(0.3333 + 0.5774i) – x4*lambda^3*(exp(- a*kx*0.25i – a*ky*0.433i) + exp(a*kx*0.25i + a*ky*0.433i))*(0.2222 – 1.155i) – 1.0*x4*lambda^3*(exp(- a*kx*0.25i – a*ky*0.433i)*(0.8889 + 5.551e-17i) + exp(a*kx*0.25i + a*ky*0.433i)*(0.8889 + 5.551e-17i)), lambda*(x1*(exp(- a*kx*0.25i + a*ky*0.433i) + exp(a*kx*0.25i – a*ky*0.433i)) + x2*(exp(- a*kx*0.75i – a*ky*0.433i) + exp(a*kx*0.75i + a*ky*0.433i)))*(0.6667 – 1.027e-33i) – 0.8889*x4*lambda^3*(exp(- a*kx*0.25i + a*ky*0.433i) + exp(a*kx*0.25i – a*ky*0.433i)) + x4*lambda^3*(0.4444*exp(- a*kx*0.25i + a*ky*0.433i) + 0.4444*exp(a*kx*0.25i – a*ky*0.433i)), 0.6667*lambda*(x2*(exp(-a*ky*0.866i) + exp(a*ky*0.866i)) + x1*(exp(-a*kx*0.5i) + exp(a*kx*0.5i))) + x4*lambda^3*(exp(-a*kx*0.5i) + exp(a*kx*0.5i))*1.54i – 1.0*x4*lambda^3*(exp(-a*kx*0.5i)*(0.4444 – 1.388e-17i) + exp(a*kx*0.5i)*(0.4444 – 1.388e-17i)), 0
0, lambda*(x2*(exp(-a*ky*0.866i) + exp(a*ky*0.866i)) + x1*(exp(-a*kx*0.5i) + exp(a*kx*0.5i)))*(0.6667 + 8.164e-17i) – x4*lambda^3*(exp(-a*kx*0.5i) + exp(a*kx*0.5i))*1.54i – 1.0*x4*lambda^3*(exp(-a*kx*0.5i)*(0.4444 + 5.443e-17i) + exp(a*kx*0.5i)*(0.4444 + 5.443e-17i)), – lambda*(x1*(exp(- a*kx*0.25i + a*ky*0.433i) + exp(a*kx*0.25i – a*ky*0.433i)) + x2*(exp(- a*kx*0.75i – a*ky*0.433i) + exp(a*kx*0.75i + a*ky*0.433i)))*(0.3333 + 0.5774i) – x4*lambda^3*(exp(- a*kx*0.25i + a*ky*0.433i) + exp(a*kx*0.25i – a*ky*0.433i))*(0.6667 – 0.3849i) + x4*lambda^3*(exp(- a*kx*0.25i + a*ky*0.433i)*(0.8889 – 1.11e-16i) + exp(a*kx*0.25i – a*ky*0.433i)*(0.8889 – 1.11e-16i)), – lambda*(x1*(exp(- a*kx*0.25i – a*ky*0.433i) + exp(a*kx*0.25i + a*ky*0.433i)) + x2*(exp(- a*kx*0.75i + a*ky*0.433i) + exp(a*kx*0.75i – a*ky*0.433i)))*(0.3333 – 0.5774i) – x4*lambda^3*(exp(- a*kx*0.25i – a*ky*0.433i) + exp(a*kx*0.25i + a*ky*0.433i))*(0.2222 + 1.155i) – 1.0*x4*lambda^3*(exp(- a*kx*0.25i – a*ky*0.433i)*(0.8889 – 5.551e-17i) + exp(a*kx*0.25i + a*ky*0.433i)*(0.8889 – 5.551e-17i)), – 0.4444*x4*lambda^3 + (2.0*x1 + 2.0*x2)*lambda, – lambda*(x2*(exp(-a*ky*0.866i) + exp(a*ky*0.866i)) + x1*(exp(-a*kx*0.5i) + exp(a*kx*0.5i)))*(0.3333 + 4.082e-17i) – 1.0*x4*lambda^3*(exp(-a*kx*0.5i)*(0.8889 – 5.551e-17i) + exp(a*kx*0.5i)*(0.8889 – 5.551e-17i)) + x4*lambda^3*(exp(-a*kx*0.5i)*(0.8889 – 1.11e-16i) + exp(a*kx*0.5i)*(0.8889 – 1.11e-16i)) + x4*lambda^3*(exp(-a*kx*0.5i)*(0.2222 + 2.721e-17i) + exp(a*kx*0.5i)*(0.2222 + 2.721e-17i)), lambda*(x1*(exp(- a*kx*0.25i + a*ky*0.433i) + exp(a*kx*0.25i – a*ky*0.433i)) + x2*(exp(- a*kx*0.75i – a*ky*0.433i) + exp(a*kx*0.75i + a*ky*0.433i)))*(0.1667 + 0.2887i) – x4*lambda^3*(exp(- a*kx*0.25i + a*ky*0.433i) + exp(a*kx*0.25i – a*ky*0.433i))*(0.7778 + 1.347i), lambda*(x1*(exp(- a*kx*0.25i – a*ky*0.433i) + exp(a*kx*0.25i + a*ky*0.433i)) + x2*(exp(- a*kx*0.75i + a*ky*0.433i) + exp(a*kx*0.75i – a*ky*0.433i)))*(0.1667 – 0.2887i) – x4*lambda^3*(exp(- a*kx*0.25i – a*ky*0.433i) + exp(a*kx*0.25i + a*ky*0.433i))*(0.1111 – 0.1925i)
lambda*(x2*(exp(-a*ky*0.866i) + exp(a*ky*0.866i)) + x1*(exp(-a*kx*0.5i) + exp(a*kx*0.5i)))*(0.6667 + 8.164e-17i) – x4*lambda^3*(exp(-a*kx*0.5i) + exp(a*kx*0.5i))*1.54i – 1.0*x4*lambda^3*(exp(-a*kx*0.5i)*(0.4444 + 5.443e-17i) + exp(a*kx*0.5i)*(0.4444 + 5.443e-17i)), 0, lambda*(x1*(exp(- a*kx*0.25i – a*ky*0.433i) + exp(a*kx*0.25i + a*ky*0.433i)) + x2*(exp(- a*kx*0.75i + a*ky*0.433i) + exp(a*kx*0.75i – a*ky*0.433i)))*(0.6667 + 1.027e-33i) – x4*lambda^3*(exp(- a*kx*0.25i – a*ky*0.433i) + exp(a*kx*0.25i + a*ky*0.433i))*(1.257 – 1.54i), lambda*(x1*(exp(- a*kx*0.25i + a*ky*0.433i) + exp(a*kx*0.25i – a*ky*0.433i)) + x2*(exp(- a*kx*0.75i – a*ky*0.433i) + exp(a*kx*0.75i + a*ky*0.433i)))*(0.6667 + 1.027e-33i) – 0.8889*x4*lambda^3*(exp(- a*kx*0.25i + a*ky*0.433i) + exp(a*kx*0.25i – a*ky*0.433i)) + x4*lambda^3*(0.4444*exp(- a*kx*0.25i + a*ky*0.433i) + 0.4444*exp(a*kx*0.25i – a*ky*0.433i)), – lambda*(x2*(exp(-a*ky*0.866i) + exp(a*ky*0.866i)) + x1*(exp(-a*kx*0.5i) + exp(a*kx*0.5i)))*(0.3333 – 4.082e-17i) – 1.0*x4*lambda^3*(exp(-a*kx*0.5i)*(0.8889 + 5.551e-17i) + exp(a*kx*0.5i)*(0.8889 + 5.551e-17i)) + x4*lambda^3*(exp(-a*kx*0.5i)*(0.8889 + 1.11e-16i) + exp(a*kx*0.5i)*(0.8889 + 1.11e-16i)) + x4*lambda^3*(exp(-a*kx*0.5i)*(0.2222 – 2.721e-17i) + exp(a*kx*0.5i)*(0.2222 – 2.721e-17i)), – 0.4444*x4*lambda^3 + (2.0*x1 + 2.0*x2)*lambda, lambda*(x1*(exp(- a*kx*0.25i – a*ky*0.433i) + exp(a*kx*0.25i + a*ky*0.433i)) + x2*(exp(- a*kx*0.75i + a*ky*0.433i) + exp(a*kx*0.75i – a*ky*0.433i)))*(0.1667 + 0.2887i) – x4*lambda^3*(exp(- a*kx*0.25i – a*ky*0.433i) + exp(a*kx*0.25i + a*ky*0.433i))*(0.1111 + 0.1925i), lambda*(x1*(exp(- a*kx*0.25i + a*ky*0.433i) + exp(a*kx*0.25i – a*ky*0.433i)) + x2*(exp(- a*kx*0.75i – a*ky*0.433i) + exp(a*kx*0.75i + a*ky*0.433i)))*(0.1667 – 0.2887i) – x4*lambda^3*(exp(- a*kx*0.25i + a*ky*0.433i) + exp(a*kx*0.25i – a*ky*0.433i))*(0.7778 – 1.347i)
– lambda*(x1*(exp(- a*kx*0.25i + a*ky*0.433i) + exp(a*kx*0.25i – a*ky*0.433i)) + x2*(exp(- a*kx*0.75i – a*ky*0.433i) + exp(a*kx*0.75i + a*ky*0.433i)))*(0.3333 + 0.5774i) – x4*lambda^3*(exp(- a*kx*0.25i + a*ky*0.433i) + exp(a*kx*0.25i – a*ky*0.433i))*(0.6667 – 0.3849i) + x4*lambda^3*(exp(- a*kx*0.25i + a*ky*0.433i)*(0.8889 – 1.11e-16i) + exp(a*kx*0.25i – a*ky*0.433i)*(0.8889 – 1.11e-16i)), lambda*(x1*(exp(- a*kx*0.25i – a*ky*0.433i) + exp(a*kx*0.25i + a*ky*0.433i)) + x2*(exp(- a*kx*0.75i + a*ky*0.433i) + exp(a*kx*0.75i – a*ky*0.433i)))*(0.6667 + 1.027e-33i) + x4*lambda^3*(exp(- a*kx*0.25i – a*ky*0.433i) + exp(a*kx*0.25i + a*ky*0.433i))*1.54i – 1.0*x4*lambda^3*(0.4444*exp(- a*kx*0.25i – a*ky*0.433i) + 0.4444*exp(a*kx*0.25i + a*ky*0.433i)), 0, 0.6667*lambda*(x2*(exp(-a*ky*0.866i) + exp(a*ky*0.866i)) + x1*(exp(-a*kx*0.5i) + exp(a*kx*0.5i))) – x4*lambda^3*(exp(-a*kx*0.5i) + exp(a*kx*0.5i))*1.54i – 1.0*x4*lambda^3*(exp(-a*kx*0.5i)*(0.4444 + 1.388e-17i) + exp(a*kx*0.5i)*(0.4444 + 1.388e-17i)), lambda*(x1*(exp(- a*kx*0.25i + a*ky*0.433i) + exp(a*kx*0.25i – a*ky*0.433i)) + x2*(exp(- a*kx*0.75i – a*ky*0.433i) + exp(a*kx*0.75i + a*ky*0.433i)))*(0.1667 – 0.2887i) – x4*lambda^3*(exp(- a*kx*0.25i + a*ky*0.433i) + exp(a*kx*0.25i – a*ky*0.433i))*(0.7778 – 1.347i), lambda*(x1*(exp(- a*kx*0.25i – a*ky*0.433i) + exp(a*kx*0.25i + a*ky*0.433i)) + x2*(exp(- a*kx*0.75i + a*ky*0.433i) + exp(a*kx*0.75i – a*ky*0.433i)))*(0.1667 – 0.2887i) – x4*lambda^3*(exp(- a*kx*0.25i – a*ky*0.433i) + exp(a*kx*0.25i + a*ky*0.433i))*(0.1111 – 0.1925i), – 0.4444*x4*lambda^3 + (2.0*x1 + 2.0*x2)*lambda, lambda*(x2*(exp(-a*ky*0.866i) + exp(a*ky*0.866i)) + x1*(exp(-a*kx*0.5i) + exp(a*kx*0.5i)))*(0.1667 + 0.2887i) – x4*lambda^3*(exp(-a*kx*0.5i) + exp(a*kx*0.5i))*(0.1111 + 0.1925i)
– lambda*(x1*(exp(- a*kx*0.25i – a*ky*0.433i) + exp(a*kx*0.25i + a*ky*0.433i)) + x2*(exp(- a*kx*0.75i + a*ky*0.433i) + exp(a*kx*0.75i – a*ky*0.433i)))*(0.3333 – 0.5774i) – x4*lambda^3*(exp(- a*kx*0.25i – a*ky*0.433i) + exp(a*kx*0.25i + a*ky*0.433i))*(0.2222 + 1.155i) – 1.0*x4*lambda^3*(exp(- a*kx*0.25i – a*ky*0.433i)*(0.8889 – 5.551e-17i) + exp(a*kx*0.25i + a*ky*0.433i)*(0.8889 – 5.551e-17i)), lambda*(x1*(exp(- a*kx*0.25i + a*ky*0.433i) + exp(a*kx*0.25i – a*ky*0.433i)) + x2*(exp(- a*kx*0.75i – a*ky*0.433i) + exp(a*kx*0.75i + a*ky*0.433i)))*(0.6667 + 1.027e-33i) – 0.8889*x4*lambda^3*(exp(- a*kx*0.25i + a*ky*0.433i) + exp(a*kx*0.25i – a*ky*0.433i)) + x4*lambda^3*(0.4444*exp(- a*kx*0.25i + a*ky*0.433i) + 0.4444*exp(a*kx*0.25i – a*ky*0.433i)), 0.6667*lambda*(x2*(exp(-a*ky*0.866i) + exp(a*ky*0.866i)) + x1*(exp(-a*kx*0.5i) + exp(a*kx*0.5i))) – x4*lambda^3*(exp(-a*kx*0.5i) + exp(a*kx*0.5i))*1.54i – 1.0*x4*lambda^3*(exp(-a*kx*0.5i)*(0.4444 + 1.388e-17i) + exp(a*kx*0.5i)*(0.4444 + 1.388e-17i)), 0, lambda*(x1*(exp(- a*kx*0.25i – a*ky*0.433i) + exp(a*kx*0.25i + a*ky*0.433i)) + x2*(exp(- a*kx*0.75i + a*ky*0.433i) + exp(a*kx*0.75i – a*ky*0.433i)))*(0.1667 + 0.2887i) – x4*lambda^3*(exp(- a*kx*0.25i – a*ky*0.433i) + exp(a*kx*0.25i + a*ky*0.433i))*(0.1111 + 0.1925i), lambda*(x1*(exp(- a*kx*0.25i + a*ky*0.433i) + exp(a*kx*0.25i – a*ky*0.433i)) + x2*(exp(- a*kx*0.75i – a*ky*0.433i) + exp(a*kx*0.75i + a*ky*0.433i)))*(0.1667 + 0.2887i) – x4*lambda^3*(exp(- a*kx*0.25i + a*ky*0.433i) + exp(a*kx*0.25i – a*ky*0.433i))*(0.7778 + 1.347i), lambda*(x2*(exp(-a*ky*0.866i) + exp(a*ky*0.866i)) + x1*(exp(-a*kx*0.5i) + exp(a*kx*0.5i)))*(0.1667 – 0.2887i) – x4*lambda^3*(exp(-a*kx*0.5i) + exp(a*kx*0.5i))*(0.1111 – 0.1925i), – 0.4444*x4*lambda^3 + (2.0*x1 + 2.0*x2)*lambda
];
FF = F; % this gives same "Uk" on both computers
FF = F + eye(8)*(0.0001); % this gives different "Uk" on both computers
K = chol(FF,"upper");
Q = K*sigma3*(K’); % Q is same on both computers
[RV,D,~] = eig(Q);
[D,I] = sort(diag(real(D)),’descend’);
RV = RV(:, I);
Uk = RV;
Lk = diag(D);
% more specifically i get these results with "FF = F + eye(8)*(0.0001)":
Uk_on_laptop = [-0.5581 – 0.2520i -0.4914 – 0.1718i -0.1074 – 0.3017i 0.2309 – 0.2705i 0.0962 – 0.0850i -0.1447 – 0.2249i 0.1924 – 0.0017i -0.0000 + 0.0000i
0.4717 + 0.2130i -0.5796 – 0.1237i 0.1084 – 0.2927i -0.2900 + 0.2300i -0.2030 + 0.1332i -0.0739 – 0.1924i 0.2089 – 0.0371i 0.0000 + 0.0000i
-0.0445 – 0.4460i -0.0758 – 0.2465i -0.4168 + 0.3376i -0.5328 + 0.0341i -0.2467 – 0.0430i -0.1713 + 0.1603i 0.0220 + 0.2039i 0.0000 – 0.0000i
0.3210 – 0.2306i -0.2904 + 0.1641i 0.3409 + 0.4428i 0.0806 – 0.4949i 0.0400 – 0.2456i 0.1073 + 0.1394i 0.2399 – 0.1355i 0.0000 – 0.0000i
0.0000 – 0.0000i 0.1304 – 0.0722i -0.2064 + 0.0175i 0.0769 – 0.0629i -0.2355 + 0.1429i 0.2359 – 0.0767i 0.2660 – 0.3031i -0.3953 + 0.6846i
-0.0000 + 0.0000i 0.2267 – 0.0899i -0.2537 + 0.0585i -0.1151 + 0.1335i 0.1507 – 0.1648i 0.2370 – 0.2627i 0.4938 – 0.4630i 0.2283 – 0.3953i
-0.0000 – 0.0000i -0.0689 – 0.1710i 0.0363 – 0.2315i 0.0199 + 0.2998i 0.0948 – 0.6211i -0.0523 + 0.5134i -0.0370 – 0.2328i 0.1614 + 0.2795i
-0.0000 + 0.0000i 0.2904 + 0.0000i 0.1855 + 0.0000i 0.2623 + 0.0000i -0.5286 + 0.0000i -0.5890 + 0.0000i 0.3516 + 0.0000i 0.2500 + 0.0000i];
Uk_on_work = [-0.5581 – 0.2520i -0.4914 – 0.1718i -0.1074 – 0.3017i 0.2309 – 0.2705i -0.0962 + 0.0850i -0.1447 – 0.2249i -0.1924 + 0.0017i -0.0000 + 0.0000i
0.4717 + 0.2130i -0.5796 – 0.1237i 0.1084 – 0.2927i -0.2900 + 0.2300i 0.2030 – 0.1332i -0.0739 – 0.1924i -0.2089 + 0.0371i 0.0000 + 0.0000i
-0.0445 – 0.4460i -0.0758 – 0.2465i -0.4168 + 0.3376i -0.5328 + 0.0341i 0.2467 + 0.0430i -0.1713 + 0.1603i -0.0220 – 0.2039i 0.0000 – 0.0000i
0.3210 – 0.2306i -0.2904 + 0.1641i 0.3409 + 0.4428i 0.0806 – 0.4949i -0.0400 + 0.2456i 0.1073 + 0.1394i -0.2399 + 0.1355i 0.0000 – 0.0000i
0.0000 – 0.0000i 0.1304 – 0.0722i -0.2064 + 0.0175i 0.0769 – 0.0629i 0.2355 – 0.1429i 0.2359 – 0.0767i -0.2660 + 0.3031i -0.3953 + 0.6846i
-0.0000 + 0.0000i 0.2267 – 0.0899i -0.2537 + 0.0585i -0.1151 + 0.1335i -0.1507 + 0.1648i 0.2370 – 0.2627i -0.4938 + 0.4630i 0.2283 – 0.3953i
-0.0000 – 0.0000i -0.0689 – 0.1710i 0.0363 – 0.2315i 0.0199 + 0.2998i -0.0948 + 0.6211i -0.0523 + 0.5134i 0.0370 + 0.2328i 0.1614 + 0.2795i
-0.0000 + 0.0000i 0.2904 + 0.0000i 0.1855 + 0.0000i 0.2623 + 0.0000i 0.5286 + 0.0000i -0.5890 + 0.0000i -0.3516 + 0.0000i 0.2500 + 0.0000i];In the following code, when I add the term eye(8)*(0.0001) to the matrix F, my laptop and my work computer return different values for the variable Uk. Could anyone please help me understand what is happening?
I am using MATLAB R2024a on both computers.
clear; clc;
% constants
a = 1;
x1 = 1;
x2 = 0;
x4 = 0;
lambda = 1;
sigma3 = diag([1 1 1 1 -1 -1 -1 -1]);
kx = -2.0944;
ky = -3.6276;
F = [ – 0.4444*x4*lambda^3 + (2.0*x1 + 2.0*x2)*lambda, – lambda*(x2*(exp(-a*ky*0.866i) + exp(a*ky*0.866i)) + x1*(exp(-a*kx*0.5i) + exp(a*kx*0.5i)))*(0.3333 – 4.082e-17i) – 1.0*x4*lambda^3*(exp(-a*kx*0.5i)*(0.8889 + 5.551e-17i) + exp(a*kx*0.5i)*(0.8889 + 5.551e-17i)) + x4*lambda^3*(exp(-a*kx*0.5i)*(0.8889 + 1.11e-16i) + exp(a*kx*0.5i)*(0.8889 + 1.11e-16i)) + x4*lambda^3*(exp(-a*kx*0.5i)*(0.2222 – 2.721e-17i) + exp(a*kx*0.5i)*(0.2222 – 2.721e-17i)), lambda*(x1*(exp(- a*kx*0.25i + a*ky*0.433i) + exp(a*kx*0.25i – a*ky*0.433i)) + x2*(exp(- a*kx*0.75i – a*ky*0.433i) + exp(a*kx*0.75i + a*ky*0.433i)))*(0.1667 – 0.2887i) – x4*lambda^3*(exp(- a*kx*0.25i + a*ky*0.433i) + exp(a*kx*0.25i – a*ky*0.433i))*(0.7778 – 1.347i), lambda*(x1*(exp(- a*kx*0.25i – a*ky*0.433i) + exp(a*kx*0.25i + a*ky*0.433i)) + x2*(exp(- a*kx*0.75i + a*ky*0.433i) + exp(a*kx*0.75i – a*ky*0.433i)))*(0.1667 + 0.2887i) – x4*lambda^3*(exp(- a*kx*0.25i – a*ky*0.433i) + exp(a*kx*0.25i + a*ky*0.433i))*(0.1111 + 0.1925i), 0, lambda*(x2*(exp(-a*ky*0.866i) + exp(a*ky*0.866i)) + x1*(exp(-a*kx*0.5i) + exp(a*kx*0.5i)))*(0.6667 – 8.164e-17i) + x4*lambda^3*(exp(-a*kx*0.5i) + exp(a*kx*0.5i))*1.54i – 1.0*x4*lambda^3*(exp(-a*kx*0.5i)*(0.4444 – 5.443e-17i) + exp(a*kx*0.5i)*(0.4444 – 5.443e-17i)), – lambda*(x1*(exp(- a*kx*0.25i + a*ky*0.433i) + exp(a*kx*0.25i – a*ky*0.433i)) + x2*(exp(- a*kx*0.75i – a*ky*0.433i) + exp(a*kx*0.75i + a*ky*0.433i)))*(0.3333 – 0.5774i) – x4*lambda^3*(exp(- a*kx*0.25i + a*ky*0.433i) + exp(a*kx*0.25i – a*ky*0.433i))*(0.6667 + 0.3849i) + x4*lambda^3*(exp(- a*kx*0.25i + a*ky*0.433i)*(0.8889 + 1.11e-16i) + exp(a*kx*0.25i – a*ky*0.433i)*(0.8889 + 1.11e-16i)), – lambda*(x1*(exp(- a*kx*0.25i – a*ky*0.433i) + exp(a*kx*0.25i + a*ky*0.433i)) + x2*(exp(- a*kx*0.75i + a*ky*0.433i) + exp(a*kx*0.75i – a*ky*0.433i)))*(0.3333 + 0.5774i) – x4*lambda^3*(exp(- a*kx*0.25i – a*ky*0.433i) + exp(a*kx*0.25i + a*ky*0.433i))*(0.2222 – 1.155i) – 1.0*x4*lambda^3*(exp(- a*kx*0.25i – a*ky*0.433i)*(0.8889 + 5.551e-17i) + exp(a*kx*0.25i + a*ky*0.433i)*(0.8889 + 5.551e-17i))
– lambda*(x2*(exp(-a*ky*0.866i) + exp(a*ky*0.866i)) + x1*(exp(-a*kx*0.5i) + exp(a*kx*0.5i)))*(0.3333 + 4.082e-17i) – 1.0*x4*lambda^3*(exp(-a*kx*0.5i)*(0.8889 – 5.551e-17i) + exp(a*kx*0.5i)*(0.8889 – 5.551e-17i)) + x4*lambda^3*(exp(-a*kx*0.5i)*(0.8889 – 1.11e-16i) + exp(a*kx*0.5i)*(0.8889 – 1.11e-16i)) + x4*lambda^3*(exp(-a*kx*0.5i)*(0.2222 + 2.721e-17i) + exp(a*kx*0.5i)*(0.2222 + 2.721e-17i)), – 0.4444*x4*lambda^3 + (2.0*x1 + 2.0*x2)*lambda, lambda*(x1*(exp(- a*kx*0.25i – a*ky*0.433i) + exp(a*kx*0.25i + a*ky*0.433i)) + x2*(exp(- a*kx*0.75i + a*ky*0.433i) + exp(a*kx*0.75i – a*ky*0.433i)))*(0.1667 – 0.2887i) – x4*lambda^3*(exp(- a*kx*0.25i – a*ky*0.433i) + exp(a*kx*0.25i + a*ky*0.433i))*(0.1111 – 0.1925i), lambda*(x1*(exp(- a*kx*0.25i + a*ky*0.433i) + exp(a*kx*0.25i – a*ky*0.433i)) + x2*(exp(- a*kx*0.75i – a*ky*0.433i) + exp(a*kx*0.75i + a*ky*0.433i)))*(0.1667 + 0.2887i) – x4*lambda^3*(exp(- a*kx*0.25i + a*ky*0.433i) + exp(a*kx*0.25i – a*ky*0.433i))*(0.7778 + 1.347i), lambda*(x2*(exp(-a*ky*0.866i) + exp(a*ky*0.866i)) + x1*(exp(-a*kx*0.5i) + exp(a*kx*0.5i)))*(0.6667 – 8.164e-17i) + x4*lambda^3*(exp(-a*kx*0.5i) + exp(a*kx*0.5i))*1.54i – 1.0*x4*lambda^3*(exp(-a*kx*0.5i)*(0.4444 – 5.443e-17i) + exp(a*kx*0.5i)*(0.4444 – 5.443e-17i)), 0, lambda*(x1*(exp(- a*kx*0.25i – a*ky*0.433i) + exp(a*kx*0.25i + a*ky*0.433i)) + x2*(exp(- a*kx*0.75i + a*ky*0.433i) + exp(a*kx*0.75i – a*ky*0.433i)))*(0.6667 – 1.027e-33i) – x4*lambda^3*(exp(- a*kx*0.25i – a*ky*0.433i) + exp(a*kx*0.25i + a*ky*0.433i))*1.54i – 1.0*x4*lambda^3*(0.4444*exp(- a*kx*0.25i – a*ky*0.433i) + 0.4444*exp(a*kx*0.25i + a*ky*0.433i)), lambda*(x1*(exp(- a*kx*0.25i + a*ky*0.433i) + exp(a*kx*0.25i – a*ky*0.433i)) + x2*(exp(- a*kx*0.75i – a*ky*0.433i) + exp(a*kx*0.75i + a*ky*0.433i)))*(0.6667 – 1.027e-33i) – 0.8889*x4*lambda^3*(exp(- a*kx*0.25i + a*ky*0.433i) + exp(a*kx*0.25i – a*ky*0.433i)) + x4*lambda^3*(0.4444*exp(- a*kx*0.25i + a*ky*0.433i) + 0.4444*exp(a*kx*0.25i – a*ky*0.433i))
lambda*(x1*(exp(- a*kx*0.25i + a*ky*0.433i) + exp(a*kx*0.25i – a*ky*0.433i)) + x2*(exp(- a*kx*0.75i – a*ky*0.433i) + exp(a*kx*0.75i + a*ky*0.433i)))*(0.1667 + 0.2887i) – x4*lambda^3*(exp(- a*kx*0.25i + a*ky*0.433i) + exp(a*kx*0.25i – a*ky*0.433i))*(0.7778 + 1.347i), lambda*(x1*(exp(- a*kx*0.25i – a*ky*0.433i) + exp(a*kx*0.25i + a*ky*0.433i)) + x2*(exp(- a*kx*0.75i + a*ky*0.433i) + exp(a*kx*0.75i – a*ky*0.433i)))*(0.1667 + 0.2887i) – x4*lambda^3*(exp(- a*kx*0.25i – a*ky*0.433i) + exp(a*kx*0.25i + a*ky*0.433i))*(0.1111 + 0.1925i), – 0.4444*x4*lambda^3 + (2.0*x1 + 2.0*x2)*lambda, lambda*(x2*(exp(-a*ky*0.866i) + exp(a*ky*0.866i)) + x1*(exp(-a*kx*0.5i) + exp(a*kx*0.5i)))*(0.1667 – 0.2887i) – x4*lambda^3*(exp(-a*kx*0.5i) + exp(a*kx*0.5i))*(0.1111 – 0.1925i), – lambda*(x1*(exp(- a*kx*0.25i + a*ky*0.433i) + exp(a*kx*0.25i – a*ky*0.433i)) + x2*(exp(- a*kx*0.75i – a*ky*0.433i) + exp(a*kx*0.75i + a*ky*0.433i)))*(0.3333 – 0.5774i) – x4*lambda^3*(exp(- a*kx*0.25i + a*ky*0.433i) + exp(a*kx*0.25i – a*ky*0.433i))*(0.6667 + 0.3849i) + x4*lambda^3*(exp(- a*kx*0.25i + a*ky*0.433i)*(0.8889 + 1.11e-16i) + exp(a*kx*0.25i – a*ky*0.433i)*(0.8889 + 1.11e-16i)), lambda*(x1*(exp(- a*kx*0.25i – a*ky*0.433i) + exp(a*kx*0.25i + a*ky*0.433i)) + x2*(exp(- a*kx*0.75i + a*ky*0.433i) + exp(a*kx*0.75i – a*ky*0.433i)))*(0.6667 – 1.027e-33i) – x4*lambda^3*(exp(- a*kx*0.25i – a*ky*0.433i) + exp(a*kx*0.25i + a*ky*0.433i))*(1.257 + 1.54i), 0, 0.6667*lambda*(x2*(exp(-a*ky*0.866i) + exp(a*ky*0.866i)) + x1*(exp(-a*kx*0.5i) + exp(a*kx*0.5i))) + x4*lambda^3*(exp(-a*kx*0.5i) + exp(a*kx*0.5i))*1.54i – 1.0*x4*lambda^3*(exp(-a*kx*0.5i)*(0.4444 – 1.388e-17i) + exp(a*kx*0.5i)*(0.4444 – 1.388e-17i))
lambda*(x1*(exp(- a*kx*0.25i – a*ky*0.433i) + exp(a*kx*0.25i + a*ky*0.433i)) + x2*(exp(- a*kx*0.75i + a*ky*0.433i) + exp(a*kx*0.75i – a*ky*0.433i)))*(0.1667 – 0.2887i) – x4*lambda^3*(exp(- a*kx*0.25i – a*ky*0.433i) + exp(a*kx*0.25i + a*ky*0.433i))*(0.1111 – 0.1925i), lambda*(x1*(exp(- a*kx*0.25i + a*ky*0.433i) + exp(a*kx*0.25i – a*ky*0.433i)) + x2*(exp(- a*kx*0.75i – a*ky*0.433i) + exp(a*kx*0.75i + a*ky*0.433i)))*(0.1667 – 0.2887i) – x4*lambda^3*(exp(- a*kx*0.25i + a*ky*0.433i) + exp(a*kx*0.25i – a*ky*0.433i))*(0.7778 – 1.347i), lambda*(x2*(exp(-a*ky*0.866i) + exp(a*ky*0.866i)) + x1*(exp(-a*kx*0.5i) + exp(a*kx*0.5i)))*(0.1667 + 0.2887i) – x4*lambda^3*(exp(-a*kx*0.5i) + exp(a*kx*0.5i))*(0.1111 + 0.1925i), – 0.4444*x4*lambda^3 + (2.0*x1 + 2.0*x2)*lambda, – lambda*(x1*(exp(- a*kx*0.25i – a*ky*0.433i) + exp(a*kx*0.25i + a*ky*0.433i)) + x2*(exp(- a*kx*0.75i + a*ky*0.433i) + exp(a*kx*0.75i – a*ky*0.433i)))*(0.3333 + 0.5774i) – x4*lambda^3*(exp(- a*kx*0.25i – a*ky*0.433i) + exp(a*kx*0.25i + a*ky*0.433i))*(0.2222 – 1.155i) – 1.0*x4*lambda^3*(exp(- a*kx*0.25i – a*ky*0.433i)*(0.8889 + 5.551e-17i) + exp(a*kx*0.25i + a*ky*0.433i)*(0.8889 + 5.551e-17i)), lambda*(x1*(exp(- a*kx*0.25i + a*ky*0.433i) + exp(a*kx*0.25i – a*ky*0.433i)) + x2*(exp(- a*kx*0.75i – a*ky*0.433i) + exp(a*kx*0.75i + a*ky*0.433i)))*(0.6667 – 1.027e-33i) – 0.8889*x4*lambda^3*(exp(- a*kx*0.25i + a*ky*0.433i) + exp(a*kx*0.25i – a*ky*0.433i)) + x4*lambda^3*(0.4444*exp(- a*kx*0.25i + a*ky*0.433i) + 0.4444*exp(a*kx*0.25i – a*ky*0.433i)), 0.6667*lambda*(x2*(exp(-a*ky*0.866i) + exp(a*ky*0.866i)) + x1*(exp(-a*kx*0.5i) + exp(a*kx*0.5i))) + x4*lambda^3*(exp(-a*kx*0.5i) + exp(a*kx*0.5i))*1.54i – 1.0*x4*lambda^3*(exp(-a*kx*0.5i)*(0.4444 – 1.388e-17i) + exp(a*kx*0.5i)*(0.4444 – 1.388e-17i)), 0
0, lambda*(x2*(exp(-a*ky*0.866i) + exp(a*ky*0.866i)) + x1*(exp(-a*kx*0.5i) + exp(a*kx*0.5i)))*(0.6667 + 8.164e-17i) – x4*lambda^3*(exp(-a*kx*0.5i) + exp(a*kx*0.5i))*1.54i – 1.0*x4*lambda^3*(exp(-a*kx*0.5i)*(0.4444 + 5.443e-17i) + exp(a*kx*0.5i)*(0.4444 + 5.443e-17i)), – lambda*(x1*(exp(- a*kx*0.25i + a*ky*0.433i) + exp(a*kx*0.25i – a*ky*0.433i)) + x2*(exp(- a*kx*0.75i – a*ky*0.433i) + exp(a*kx*0.75i + a*ky*0.433i)))*(0.3333 + 0.5774i) – x4*lambda^3*(exp(- a*kx*0.25i + a*ky*0.433i) + exp(a*kx*0.25i – a*ky*0.433i))*(0.6667 – 0.3849i) + x4*lambda^3*(exp(- a*kx*0.25i + a*ky*0.433i)*(0.8889 – 1.11e-16i) + exp(a*kx*0.25i – a*ky*0.433i)*(0.8889 – 1.11e-16i)), – lambda*(x1*(exp(- a*kx*0.25i – a*ky*0.433i) + exp(a*kx*0.25i + a*ky*0.433i)) + x2*(exp(- a*kx*0.75i + a*ky*0.433i) + exp(a*kx*0.75i – a*ky*0.433i)))*(0.3333 – 0.5774i) – x4*lambda^3*(exp(- a*kx*0.25i – a*ky*0.433i) + exp(a*kx*0.25i + a*ky*0.433i))*(0.2222 + 1.155i) – 1.0*x4*lambda^3*(exp(- a*kx*0.25i – a*ky*0.433i)*(0.8889 – 5.551e-17i) + exp(a*kx*0.25i + a*ky*0.433i)*(0.8889 – 5.551e-17i)), – 0.4444*x4*lambda^3 + (2.0*x1 + 2.0*x2)*lambda, – lambda*(x2*(exp(-a*ky*0.866i) + exp(a*ky*0.866i)) + x1*(exp(-a*kx*0.5i) + exp(a*kx*0.5i)))*(0.3333 + 4.082e-17i) – 1.0*x4*lambda^3*(exp(-a*kx*0.5i)*(0.8889 – 5.551e-17i) + exp(a*kx*0.5i)*(0.8889 – 5.551e-17i)) + x4*lambda^3*(exp(-a*kx*0.5i)*(0.8889 – 1.11e-16i) + exp(a*kx*0.5i)*(0.8889 – 1.11e-16i)) + x4*lambda^3*(exp(-a*kx*0.5i)*(0.2222 + 2.721e-17i) + exp(a*kx*0.5i)*(0.2222 + 2.721e-17i)), lambda*(x1*(exp(- a*kx*0.25i + a*ky*0.433i) + exp(a*kx*0.25i – a*ky*0.433i)) + x2*(exp(- a*kx*0.75i – a*ky*0.433i) + exp(a*kx*0.75i + a*ky*0.433i)))*(0.1667 + 0.2887i) – x4*lambda^3*(exp(- a*kx*0.25i + a*ky*0.433i) + exp(a*kx*0.25i – a*ky*0.433i))*(0.7778 + 1.347i), lambda*(x1*(exp(- a*kx*0.25i – a*ky*0.433i) + exp(a*kx*0.25i + a*ky*0.433i)) + x2*(exp(- a*kx*0.75i + a*ky*0.433i) + exp(a*kx*0.75i – a*ky*0.433i)))*(0.1667 – 0.2887i) – x4*lambda^3*(exp(- a*kx*0.25i – a*ky*0.433i) + exp(a*kx*0.25i + a*ky*0.433i))*(0.1111 – 0.1925i)
lambda*(x2*(exp(-a*ky*0.866i) + exp(a*ky*0.866i)) + x1*(exp(-a*kx*0.5i) + exp(a*kx*0.5i)))*(0.6667 + 8.164e-17i) – x4*lambda^3*(exp(-a*kx*0.5i) + exp(a*kx*0.5i))*1.54i – 1.0*x4*lambda^3*(exp(-a*kx*0.5i)*(0.4444 + 5.443e-17i) + exp(a*kx*0.5i)*(0.4444 + 5.443e-17i)), 0, lambda*(x1*(exp(- a*kx*0.25i – a*ky*0.433i) + exp(a*kx*0.25i + a*ky*0.433i)) + x2*(exp(- a*kx*0.75i + a*ky*0.433i) + exp(a*kx*0.75i – a*ky*0.433i)))*(0.6667 + 1.027e-33i) – x4*lambda^3*(exp(- a*kx*0.25i – a*ky*0.433i) + exp(a*kx*0.25i + a*ky*0.433i))*(1.257 – 1.54i), lambda*(x1*(exp(- a*kx*0.25i + a*ky*0.433i) + exp(a*kx*0.25i – a*ky*0.433i)) + x2*(exp(- a*kx*0.75i – a*ky*0.433i) + exp(a*kx*0.75i + a*ky*0.433i)))*(0.6667 + 1.027e-33i) – 0.8889*x4*lambda^3*(exp(- a*kx*0.25i + a*ky*0.433i) + exp(a*kx*0.25i – a*ky*0.433i)) + x4*lambda^3*(0.4444*exp(- a*kx*0.25i + a*ky*0.433i) + 0.4444*exp(a*kx*0.25i – a*ky*0.433i)), – lambda*(x2*(exp(-a*ky*0.866i) + exp(a*ky*0.866i)) + x1*(exp(-a*kx*0.5i) + exp(a*kx*0.5i)))*(0.3333 – 4.082e-17i) – 1.0*x4*lambda^3*(exp(-a*kx*0.5i)*(0.8889 + 5.551e-17i) + exp(a*kx*0.5i)*(0.8889 + 5.551e-17i)) + x4*lambda^3*(exp(-a*kx*0.5i)*(0.8889 + 1.11e-16i) + exp(a*kx*0.5i)*(0.8889 + 1.11e-16i)) + x4*lambda^3*(exp(-a*kx*0.5i)*(0.2222 – 2.721e-17i) + exp(a*kx*0.5i)*(0.2222 – 2.721e-17i)), – 0.4444*x4*lambda^3 + (2.0*x1 + 2.0*x2)*lambda, lambda*(x1*(exp(- a*kx*0.25i – a*ky*0.433i) + exp(a*kx*0.25i + a*ky*0.433i)) + x2*(exp(- a*kx*0.75i + a*ky*0.433i) + exp(a*kx*0.75i – a*ky*0.433i)))*(0.1667 + 0.2887i) – x4*lambda^3*(exp(- a*kx*0.25i – a*ky*0.433i) + exp(a*kx*0.25i + a*ky*0.433i))*(0.1111 + 0.1925i), lambda*(x1*(exp(- a*kx*0.25i + a*ky*0.433i) + exp(a*kx*0.25i – a*ky*0.433i)) + x2*(exp(- a*kx*0.75i – a*ky*0.433i) + exp(a*kx*0.75i + a*ky*0.433i)))*(0.1667 – 0.2887i) – x4*lambda^3*(exp(- a*kx*0.25i + a*ky*0.433i) + exp(a*kx*0.25i – a*ky*0.433i))*(0.7778 – 1.347i)
– lambda*(x1*(exp(- a*kx*0.25i + a*ky*0.433i) + exp(a*kx*0.25i – a*ky*0.433i)) + x2*(exp(- a*kx*0.75i – a*ky*0.433i) + exp(a*kx*0.75i + a*ky*0.433i)))*(0.3333 + 0.5774i) – x4*lambda^3*(exp(- a*kx*0.25i + a*ky*0.433i) + exp(a*kx*0.25i – a*ky*0.433i))*(0.6667 – 0.3849i) + x4*lambda^3*(exp(- a*kx*0.25i + a*ky*0.433i)*(0.8889 – 1.11e-16i) + exp(a*kx*0.25i – a*ky*0.433i)*(0.8889 – 1.11e-16i)), lambda*(x1*(exp(- a*kx*0.25i – a*ky*0.433i) + exp(a*kx*0.25i + a*ky*0.433i)) + x2*(exp(- a*kx*0.75i + a*ky*0.433i) + exp(a*kx*0.75i – a*ky*0.433i)))*(0.6667 + 1.027e-33i) + x4*lambda^3*(exp(- a*kx*0.25i – a*ky*0.433i) + exp(a*kx*0.25i + a*ky*0.433i))*1.54i – 1.0*x4*lambda^3*(0.4444*exp(- a*kx*0.25i – a*ky*0.433i) + 0.4444*exp(a*kx*0.25i + a*ky*0.433i)), 0, 0.6667*lambda*(x2*(exp(-a*ky*0.866i) + exp(a*ky*0.866i)) + x1*(exp(-a*kx*0.5i) + exp(a*kx*0.5i))) – x4*lambda^3*(exp(-a*kx*0.5i) + exp(a*kx*0.5i))*1.54i – 1.0*x4*lambda^3*(exp(-a*kx*0.5i)*(0.4444 + 1.388e-17i) + exp(a*kx*0.5i)*(0.4444 + 1.388e-17i)), lambda*(x1*(exp(- a*kx*0.25i + a*ky*0.433i) + exp(a*kx*0.25i – a*ky*0.433i)) + x2*(exp(- a*kx*0.75i – a*ky*0.433i) + exp(a*kx*0.75i + a*ky*0.433i)))*(0.1667 – 0.2887i) – x4*lambda^3*(exp(- a*kx*0.25i + a*ky*0.433i) + exp(a*kx*0.25i – a*ky*0.433i))*(0.7778 – 1.347i), lambda*(x1*(exp(- a*kx*0.25i – a*ky*0.433i) + exp(a*kx*0.25i + a*ky*0.433i)) + x2*(exp(- a*kx*0.75i + a*ky*0.433i) + exp(a*kx*0.75i – a*ky*0.433i)))*(0.1667 – 0.2887i) – x4*lambda^3*(exp(- a*kx*0.25i – a*ky*0.433i) + exp(a*kx*0.25i + a*ky*0.433i))*(0.1111 – 0.1925i), – 0.4444*x4*lambda^3 + (2.0*x1 + 2.0*x2)*lambda, lambda*(x2*(exp(-a*ky*0.866i) + exp(a*ky*0.866i)) + x1*(exp(-a*kx*0.5i) + exp(a*kx*0.5i)))*(0.1667 + 0.2887i) – x4*lambda^3*(exp(-a*kx*0.5i) + exp(a*kx*0.5i))*(0.1111 + 0.1925i)
– lambda*(x1*(exp(- a*kx*0.25i – a*ky*0.433i) + exp(a*kx*0.25i + a*ky*0.433i)) + x2*(exp(- a*kx*0.75i + a*ky*0.433i) + exp(a*kx*0.75i – a*ky*0.433i)))*(0.3333 – 0.5774i) – x4*lambda^3*(exp(- a*kx*0.25i – a*ky*0.433i) + exp(a*kx*0.25i + a*ky*0.433i))*(0.2222 + 1.155i) – 1.0*x4*lambda^3*(exp(- a*kx*0.25i – a*ky*0.433i)*(0.8889 – 5.551e-17i) + exp(a*kx*0.25i + a*ky*0.433i)*(0.8889 – 5.551e-17i)), lambda*(x1*(exp(- a*kx*0.25i + a*ky*0.433i) + exp(a*kx*0.25i – a*ky*0.433i)) + x2*(exp(- a*kx*0.75i – a*ky*0.433i) + exp(a*kx*0.75i + a*ky*0.433i)))*(0.6667 + 1.027e-33i) – 0.8889*x4*lambda^3*(exp(- a*kx*0.25i + a*ky*0.433i) + exp(a*kx*0.25i – a*ky*0.433i)) + x4*lambda^3*(0.4444*exp(- a*kx*0.25i + a*ky*0.433i) + 0.4444*exp(a*kx*0.25i – a*ky*0.433i)), 0.6667*lambda*(x2*(exp(-a*ky*0.866i) + exp(a*ky*0.866i)) + x1*(exp(-a*kx*0.5i) + exp(a*kx*0.5i))) – x4*lambda^3*(exp(-a*kx*0.5i) + exp(a*kx*0.5i))*1.54i – 1.0*x4*lambda^3*(exp(-a*kx*0.5i)*(0.4444 + 1.388e-17i) + exp(a*kx*0.5i)*(0.4444 + 1.388e-17i)), 0, lambda*(x1*(exp(- a*kx*0.25i – a*ky*0.433i) + exp(a*kx*0.25i + a*ky*0.433i)) + x2*(exp(- a*kx*0.75i + a*ky*0.433i) + exp(a*kx*0.75i – a*ky*0.433i)))*(0.1667 + 0.2887i) – x4*lambda^3*(exp(- a*kx*0.25i – a*ky*0.433i) + exp(a*kx*0.25i + a*ky*0.433i))*(0.1111 + 0.1925i), lambda*(x1*(exp(- a*kx*0.25i + a*ky*0.433i) + exp(a*kx*0.25i – a*ky*0.433i)) + x2*(exp(- a*kx*0.75i – a*ky*0.433i) + exp(a*kx*0.75i + a*ky*0.433i)))*(0.1667 + 0.2887i) – x4*lambda^3*(exp(- a*kx*0.25i + a*ky*0.433i) + exp(a*kx*0.25i – a*ky*0.433i))*(0.7778 + 1.347i), lambda*(x2*(exp(-a*ky*0.866i) + exp(a*ky*0.866i)) + x1*(exp(-a*kx*0.5i) + exp(a*kx*0.5i)))*(0.1667 – 0.2887i) – x4*lambda^3*(exp(-a*kx*0.5i) + exp(a*kx*0.5i))*(0.1111 – 0.1925i), – 0.4444*x4*lambda^3 + (2.0*x1 + 2.0*x2)*lambda
];
FF = F; % this gives same "Uk" on both computers
FF = F + eye(8)*(0.0001); % this gives different "Uk" on both computers
K = chol(FF,"upper");
Q = K*sigma3*(K’); % Q is same on both computers
[RV,D,~] = eig(Q);
[D,I] = sort(diag(real(D)),’descend’);
RV = RV(:, I);
Uk = RV;
Lk = diag(D);
% more specifically i get these results with "FF = F + eye(8)*(0.0001)":
Uk_on_laptop = [-0.5581 – 0.2520i -0.4914 – 0.1718i -0.1074 – 0.3017i 0.2309 – 0.2705i 0.0962 – 0.0850i -0.1447 – 0.2249i 0.1924 – 0.0017i -0.0000 + 0.0000i
0.4717 + 0.2130i -0.5796 – 0.1237i 0.1084 – 0.2927i -0.2900 + 0.2300i -0.2030 + 0.1332i -0.0739 – 0.1924i 0.2089 – 0.0371i 0.0000 + 0.0000i
-0.0445 – 0.4460i -0.0758 – 0.2465i -0.4168 + 0.3376i -0.5328 + 0.0341i -0.2467 – 0.0430i -0.1713 + 0.1603i 0.0220 + 0.2039i 0.0000 – 0.0000i
0.3210 – 0.2306i -0.2904 + 0.1641i 0.3409 + 0.4428i 0.0806 – 0.4949i 0.0400 – 0.2456i 0.1073 + 0.1394i 0.2399 – 0.1355i 0.0000 – 0.0000i
0.0000 – 0.0000i 0.1304 – 0.0722i -0.2064 + 0.0175i 0.0769 – 0.0629i -0.2355 + 0.1429i 0.2359 – 0.0767i 0.2660 – 0.3031i -0.3953 + 0.6846i
-0.0000 + 0.0000i 0.2267 – 0.0899i -0.2537 + 0.0585i -0.1151 + 0.1335i 0.1507 – 0.1648i 0.2370 – 0.2627i 0.4938 – 0.4630i 0.2283 – 0.3953i
-0.0000 – 0.0000i -0.0689 – 0.1710i 0.0363 – 0.2315i 0.0199 + 0.2998i 0.0948 – 0.6211i -0.0523 + 0.5134i -0.0370 – 0.2328i 0.1614 + 0.2795i
-0.0000 + 0.0000i 0.2904 + 0.0000i 0.1855 + 0.0000i 0.2623 + 0.0000i -0.5286 + 0.0000i -0.5890 + 0.0000i 0.3516 + 0.0000i 0.2500 + 0.0000i];
Uk_on_work = [-0.5581 – 0.2520i -0.4914 – 0.1718i -0.1074 – 0.3017i 0.2309 – 0.2705i -0.0962 + 0.0850i -0.1447 – 0.2249i -0.1924 + 0.0017i -0.0000 + 0.0000i
0.4717 + 0.2130i -0.5796 – 0.1237i 0.1084 – 0.2927i -0.2900 + 0.2300i 0.2030 – 0.1332i -0.0739 – 0.1924i -0.2089 + 0.0371i 0.0000 + 0.0000i
-0.0445 – 0.4460i -0.0758 – 0.2465i -0.4168 + 0.3376i -0.5328 + 0.0341i 0.2467 + 0.0430i -0.1713 + 0.1603i -0.0220 – 0.2039i 0.0000 – 0.0000i
0.3210 – 0.2306i -0.2904 + 0.1641i 0.3409 + 0.4428i 0.0806 – 0.4949i -0.0400 + 0.2456i 0.1073 + 0.1394i -0.2399 + 0.1355i 0.0000 – 0.0000i
0.0000 – 0.0000i 0.1304 – 0.0722i -0.2064 + 0.0175i 0.0769 – 0.0629i 0.2355 – 0.1429i 0.2359 – 0.0767i -0.2660 + 0.3031i -0.3953 + 0.6846i
-0.0000 + 0.0000i 0.2267 – 0.0899i -0.2537 + 0.0585i -0.1151 + 0.1335i -0.1507 + 0.1648i 0.2370 – 0.2627i -0.4938 + 0.4630i 0.2283 – 0.3953i
-0.0000 – 0.0000i -0.0689 – 0.1710i 0.0363 – 0.2315i 0.0199 + 0.2998i -0.0948 + 0.6211i -0.0523 + 0.5134i 0.0370 + 0.2328i 0.1614 + 0.2795i
-0.0000 + 0.0000i 0.2904 + 0.0000i 0.1855 + 0.0000i 0.2623 + 0.0000i 0.5286 + 0.0000i -0.5890 + 0.0000i -0.3516 + 0.0000i 0.2500 + 0.0000i]; In the following code, when I add the term eye(8)*(0.0001) to the matrix F, my laptop and my work computer return different values for the variable Uk. Could anyone please help me understand what is happening?
I am using MATLAB R2024a on both computers.
clear; clc;
% constants
a = 1;
x1 = 1;
x2 = 0;
x4 = 0;
lambda = 1;
sigma3 = diag([1 1 1 1 -1 -1 -1 -1]);
kx = -2.0944;
ky = -3.6276;
F = [ – 0.4444*x4*lambda^3 + (2.0*x1 + 2.0*x2)*lambda, – lambda*(x2*(exp(-a*ky*0.866i) + exp(a*ky*0.866i)) + x1*(exp(-a*kx*0.5i) + exp(a*kx*0.5i)))*(0.3333 – 4.082e-17i) – 1.0*x4*lambda^3*(exp(-a*kx*0.5i)*(0.8889 + 5.551e-17i) + exp(a*kx*0.5i)*(0.8889 + 5.551e-17i)) + x4*lambda^3*(exp(-a*kx*0.5i)*(0.8889 + 1.11e-16i) + exp(a*kx*0.5i)*(0.8889 + 1.11e-16i)) + x4*lambda^3*(exp(-a*kx*0.5i)*(0.2222 – 2.721e-17i) + exp(a*kx*0.5i)*(0.2222 – 2.721e-17i)), lambda*(x1*(exp(- a*kx*0.25i + a*ky*0.433i) + exp(a*kx*0.25i – a*ky*0.433i)) + x2*(exp(- a*kx*0.75i – a*ky*0.433i) + exp(a*kx*0.75i + a*ky*0.433i)))*(0.1667 – 0.2887i) – x4*lambda^3*(exp(- a*kx*0.25i + a*ky*0.433i) + exp(a*kx*0.25i – a*ky*0.433i))*(0.7778 – 1.347i), lambda*(x1*(exp(- a*kx*0.25i – a*ky*0.433i) + exp(a*kx*0.25i + a*ky*0.433i)) + x2*(exp(- a*kx*0.75i + a*ky*0.433i) + exp(a*kx*0.75i – a*ky*0.433i)))*(0.1667 + 0.2887i) – x4*lambda^3*(exp(- a*kx*0.25i – a*ky*0.433i) + exp(a*kx*0.25i + a*ky*0.433i))*(0.1111 + 0.1925i), 0, lambda*(x2*(exp(-a*ky*0.866i) + exp(a*ky*0.866i)) + x1*(exp(-a*kx*0.5i) + exp(a*kx*0.5i)))*(0.6667 – 8.164e-17i) + x4*lambda^3*(exp(-a*kx*0.5i) + exp(a*kx*0.5i))*1.54i – 1.0*x4*lambda^3*(exp(-a*kx*0.5i)*(0.4444 – 5.443e-17i) + exp(a*kx*0.5i)*(0.4444 – 5.443e-17i)), – lambda*(x1*(exp(- a*kx*0.25i + a*ky*0.433i) + exp(a*kx*0.25i – a*ky*0.433i)) + x2*(exp(- a*kx*0.75i – a*ky*0.433i) + exp(a*kx*0.75i + a*ky*0.433i)))*(0.3333 – 0.5774i) – x4*lambda^3*(exp(- a*kx*0.25i + a*ky*0.433i) + exp(a*kx*0.25i – a*ky*0.433i))*(0.6667 + 0.3849i) + x4*lambda^3*(exp(- a*kx*0.25i + a*ky*0.433i)*(0.8889 + 1.11e-16i) + exp(a*kx*0.25i – a*ky*0.433i)*(0.8889 + 1.11e-16i)), – lambda*(x1*(exp(- a*kx*0.25i – a*ky*0.433i) + exp(a*kx*0.25i + a*ky*0.433i)) + x2*(exp(- a*kx*0.75i + a*ky*0.433i) + exp(a*kx*0.75i – a*ky*0.433i)))*(0.3333 + 0.5774i) – x4*lambda^3*(exp(- a*kx*0.25i – a*ky*0.433i) + exp(a*kx*0.25i + a*ky*0.433i))*(0.2222 – 1.155i) – 1.0*x4*lambda^3*(exp(- a*kx*0.25i – a*ky*0.433i)*(0.8889 + 5.551e-17i) + exp(a*kx*0.25i + a*ky*0.433i)*(0.8889 + 5.551e-17i))
– lambda*(x2*(exp(-a*ky*0.866i) + exp(a*ky*0.866i)) + x1*(exp(-a*kx*0.5i) + exp(a*kx*0.5i)))*(0.3333 + 4.082e-17i) – 1.0*x4*lambda^3*(exp(-a*kx*0.5i)*(0.8889 – 5.551e-17i) + exp(a*kx*0.5i)*(0.8889 – 5.551e-17i)) + x4*lambda^3*(exp(-a*kx*0.5i)*(0.8889 – 1.11e-16i) + exp(a*kx*0.5i)*(0.8889 – 1.11e-16i)) + x4*lambda^3*(exp(-a*kx*0.5i)*(0.2222 + 2.721e-17i) + exp(a*kx*0.5i)*(0.2222 + 2.721e-17i)), – 0.4444*x4*lambda^3 + (2.0*x1 + 2.0*x2)*lambda, lambda*(x1*(exp(- a*kx*0.25i – a*ky*0.433i) + exp(a*kx*0.25i + a*ky*0.433i)) + x2*(exp(- a*kx*0.75i + a*ky*0.433i) + exp(a*kx*0.75i – a*ky*0.433i)))*(0.1667 – 0.2887i) – x4*lambda^3*(exp(- a*kx*0.25i – a*ky*0.433i) + exp(a*kx*0.25i + a*ky*0.433i))*(0.1111 – 0.1925i), lambda*(x1*(exp(- a*kx*0.25i + a*ky*0.433i) + exp(a*kx*0.25i – a*ky*0.433i)) + x2*(exp(- a*kx*0.75i – a*ky*0.433i) + exp(a*kx*0.75i + a*ky*0.433i)))*(0.1667 + 0.2887i) – x4*lambda^3*(exp(- a*kx*0.25i + a*ky*0.433i) + exp(a*kx*0.25i – a*ky*0.433i))*(0.7778 + 1.347i), lambda*(x2*(exp(-a*ky*0.866i) + exp(a*ky*0.866i)) + x1*(exp(-a*kx*0.5i) + exp(a*kx*0.5i)))*(0.6667 – 8.164e-17i) + x4*lambda^3*(exp(-a*kx*0.5i) + exp(a*kx*0.5i))*1.54i – 1.0*x4*lambda^3*(exp(-a*kx*0.5i)*(0.4444 – 5.443e-17i) + exp(a*kx*0.5i)*(0.4444 – 5.443e-17i)), 0, lambda*(x1*(exp(- a*kx*0.25i – a*ky*0.433i) + exp(a*kx*0.25i + a*ky*0.433i)) + x2*(exp(- a*kx*0.75i + a*ky*0.433i) + exp(a*kx*0.75i – a*ky*0.433i)))*(0.6667 – 1.027e-33i) – x4*lambda^3*(exp(- a*kx*0.25i – a*ky*0.433i) + exp(a*kx*0.25i + a*ky*0.433i))*1.54i – 1.0*x4*lambda^3*(0.4444*exp(- a*kx*0.25i – a*ky*0.433i) + 0.4444*exp(a*kx*0.25i + a*ky*0.433i)), lambda*(x1*(exp(- a*kx*0.25i + a*ky*0.433i) + exp(a*kx*0.25i – a*ky*0.433i)) + x2*(exp(- a*kx*0.75i – a*ky*0.433i) + exp(a*kx*0.75i + a*ky*0.433i)))*(0.6667 – 1.027e-33i) – 0.8889*x4*lambda^3*(exp(- a*kx*0.25i + a*ky*0.433i) + exp(a*kx*0.25i – a*ky*0.433i)) + x4*lambda^3*(0.4444*exp(- a*kx*0.25i + a*ky*0.433i) + 0.4444*exp(a*kx*0.25i – a*ky*0.433i))
lambda*(x1*(exp(- a*kx*0.25i + a*ky*0.433i) + exp(a*kx*0.25i – a*ky*0.433i)) + x2*(exp(- a*kx*0.75i – a*ky*0.433i) + exp(a*kx*0.75i + a*ky*0.433i)))*(0.1667 + 0.2887i) – x4*lambda^3*(exp(- a*kx*0.25i + a*ky*0.433i) + exp(a*kx*0.25i – a*ky*0.433i))*(0.7778 + 1.347i), lambda*(x1*(exp(- a*kx*0.25i – a*ky*0.433i) + exp(a*kx*0.25i + a*ky*0.433i)) + x2*(exp(- a*kx*0.75i + a*ky*0.433i) + exp(a*kx*0.75i – a*ky*0.433i)))*(0.1667 + 0.2887i) – x4*lambda^3*(exp(- a*kx*0.25i – a*ky*0.433i) + exp(a*kx*0.25i + a*ky*0.433i))*(0.1111 + 0.1925i), – 0.4444*x4*lambda^3 + (2.0*x1 + 2.0*x2)*lambda, lambda*(x2*(exp(-a*ky*0.866i) + exp(a*ky*0.866i)) + x1*(exp(-a*kx*0.5i) + exp(a*kx*0.5i)))*(0.1667 – 0.2887i) – x4*lambda^3*(exp(-a*kx*0.5i) + exp(a*kx*0.5i))*(0.1111 – 0.1925i), – lambda*(x1*(exp(- a*kx*0.25i + a*ky*0.433i) + exp(a*kx*0.25i – a*ky*0.433i)) + x2*(exp(- a*kx*0.75i – a*ky*0.433i) + exp(a*kx*0.75i + a*ky*0.433i)))*(0.3333 – 0.5774i) – x4*lambda^3*(exp(- a*kx*0.25i + a*ky*0.433i) + exp(a*kx*0.25i – a*ky*0.433i))*(0.6667 + 0.3849i) + x4*lambda^3*(exp(- a*kx*0.25i + a*ky*0.433i)*(0.8889 + 1.11e-16i) + exp(a*kx*0.25i – a*ky*0.433i)*(0.8889 + 1.11e-16i)), lambda*(x1*(exp(- a*kx*0.25i – a*ky*0.433i) + exp(a*kx*0.25i + a*ky*0.433i)) + x2*(exp(- a*kx*0.75i + a*ky*0.433i) + exp(a*kx*0.75i – a*ky*0.433i)))*(0.6667 – 1.027e-33i) – x4*lambda^3*(exp(- a*kx*0.25i – a*ky*0.433i) + exp(a*kx*0.25i + a*ky*0.433i))*(1.257 + 1.54i), 0, 0.6667*lambda*(x2*(exp(-a*ky*0.866i) + exp(a*ky*0.866i)) + x1*(exp(-a*kx*0.5i) + exp(a*kx*0.5i))) + x4*lambda^3*(exp(-a*kx*0.5i) + exp(a*kx*0.5i))*1.54i – 1.0*x4*lambda^3*(exp(-a*kx*0.5i)*(0.4444 – 1.388e-17i) + exp(a*kx*0.5i)*(0.4444 – 1.388e-17i))
lambda*(x1*(exp(- a*kx*0.25i – a*ky*0.433i) + exp(a*kx*0.25i + a*ky*0.433i)) + x2*(exp(- a*kx*0.75i + a*ky*0.433i) + exp(a*kx*0.75i – a*ky*0.433i)))*(0.1667 – 0.2887i) – x4*lambda^3*(exp(- a*kx*0.25i – a*ky*0.433i) + exp(a*kx*0.25i + a*ky*0.433i))*(0.1111 – 0.1925i), lambda*(x1*(exp(- a*kx*0.25i + a*ky*0.433i) + exp(a*kx*0.25i – a*ky*0.433i)) + x2*(exp(- a*kx*0.75i – a*ky*0.433i) + exp(a*kx*0.75i + a*ky*0.433i)))*(0.1667 – 0.2887i) – x4*lambda^3*(exp(- a*kx*0.25i + a*ky*0.433i) + exp(a*kx*0.25i – a*ky*0.433i))*(0.7778 – 1.347i), lambda*(x2*(exp(-a*ky*0.866i) + exp(a*ky*0.866i)) + x1*(exp(-a*kx*0.5i) + exp(a*kx*0.5i)))*(0.1667 + 0.2887i) – x4*lambda^3*(exp(-a*kx*0.5i) + exp(a*kx*0.5i))*(0.1111 + 0.1925i), – 0.4444*x4*lambda^3 + (2.0*x1 + 2.0*x2)*lambda, – lambda*(x1*(exp(- a*kx*0.25i – a*ky*0.433i) + exp(a*kx*0.25i + a*ky*0.433i)) + x2*(exp(- a*kx*0.75i + a*ky*0.433i) + exp(a*kx*0.75i – a*ky*0.433i)))*(0.3333 + 0.5774i) – x4*lambda^3*(exp(- a*kx*0.25i – a*ky*0.433i) + exp(a*kx*0.25i + a*ky*0.433i))*(0.2222 – 1.155i) – 1.0*x4*lambda^3*(exp(- a*kx*0.25i – a*ky*0.433i)*(0.8889 + 5.551e-17i) + exp(a*kx*0.25i + a*ky*0.433i)*(0.8889 + 5.551e-17i)), lambda*(x1*(exp(- a*kx*0.25i + a*ky*0.433i) + exp(a*kx*0.25i – a*ky*0.433i)) + x2*(exp(- a*kx*0.75i – a*ky*0.433i) + exp(a*kx*0.75i + a*ky*0.433i)))*(0.6667 – 1.027e-33i) – 0.8889*x4*lambda^3*(exp(- a*kx*0.25i + a*ky*0.433i) + exp(a*kx*0.25i – a*ky*0.433i)) + x4*lambda^3*(0.4444*exp(- a*kx*0.25i + a*ky*0.433i) + 0.4444*exp(a*kx*0.25i – a*ky*0.433i)), 0.6667*lambda*(x2*(exp(-a*ky*0.866i) + exp(a*ky*0.866i)) + x1*(exp(-a*kx*0.5i) + exp(a*kx*0.5i))) + x4*lambda^3*(exp(-a*kx*0.5i) + exp(a*kx*0.5i))*1.54i – 1.0*x4*lambda^3*(exp(-a*kx*0.5i)*(0.4444 – 1.388e-17i) + exp(a*kx*0.5i)*(0.4444 – 1.388e-17i)), 0
0, lambda*(x2*(exp(-a*ky*0.866i) + exp(a*ky*0.866i)) + x1*(exp(-a*kx*0.5i) + exp(a*kx*0.5i)))*(0.6667 + 8.164e-17i) – x4*lambda^3*(exp(-a*kx*0.5i) + exp(a*kx*0.5i))*1.54i – 1.0*x4*lambda^3*(exp(-a*kx*0.5i)*(0.4444 + 5.443e-17i) + exp(a*kx*0.5i)*(0.4444 + 5.443e-17i)), – lambda*(x1*(exp(- a*kx*0.25i + a*ky*0.433i) + exp(a*kx*0.25i – a*ky*0.433i)) + x2*(exp(- a*kx*0.75i – a*ky*0.433i) + exp(a*kx*0.75i + a*ky*0.433i)))*(0.3333 + 0.5774i) – x4*lambda^3*(exp(- a*kx*0.25i + a*ky*0.433i) + exp(a*kx*0.25i – a*ky*0.433i))*(0.6667 – 0.3849i) + x4*lambda^3*(exp(- a*kx*0.25i + a*ky*0.433i)*(0.8889 – 1.11e-16i) + exp(a*kx*0.25i – a*ky*0.433i)*(0.8889 – 1.11e-16i)), – lambda*(x1*(exp(- a*kx*0.25i – a*ky*0.433i) + exp(a*kx*0.25i + a*ky*0.433i)) + x2*(exp(- a*kx*0.75i + a*ky*0.433i) + exp(a*kx*0.75i – a*ky*0.433i)))*(0.3333 – 0.5774i) – x4*lambda^3*(exp(- a*kx*0.25i – a*ky*0.433i) + exp(a*kx*0.25i + a*ky*0.433i))*(0.2222 + 1.155i) – 1.0*x4*lambda^3*(exp(- a*kx*0.25i – a*ky*0.433i)*(0.8889 – 5.551e-17i) + exp(a*kx*0.25i + a*ky*0.433i)*(0.8889 – 5.551e-17i)), – 0.4444*x4*lambda^3 + (2.0*x1 + 2.0*x2)*lambda, – lambda*(x2*(exp(-a*ky*0.866i) + exp(a*ky*0.866i)) + x1*(exp(-a*kx*0.5i) + exp(a*kx*0.5i)))*(0.3333 + 4.082e-17i) – 1.0*x4*lambda^3*(exp(-a*kx*0.5i)*(0.8889 – 5.551e-17i) + exp(a*kx*0.5i)*(0.8889 – 5.551e-17i)) + x4*lambda^3*(exp(-a*kx*0.5i)*(0.8889 – 1.11e-16i) + exp(a*kx*0.5i)*(0.8889 – 1.11e-16i)) + x4*lambda^3*(exp(-a*kx*0.5i)*(0.2222 + 2.721e-17i) + exp(a*kx*0.5i)*(0.2222 + 2.721e-17i)), lambda*(x1*(exp(- a*kx*0.25i + a*ky*0.433i) + exp(a*kx*0.25i – a*ky*0.433i)) + x2*(exp(- a*kx*0.75i – a*ky*0.433i) + exp(a*kx*0.75i + a*ky*0.433i)))*(0.1667 + 0.2887i) – x4*lambda^3*(exp(- a*kx*0.25i + a*ky*0.433i) + exp(a*kx*0.25i – a*ky*0.433i))*(0.7778 + 1.347i), lambda*(x1*(exp(- a*kx*0.25i – a*ky*0.433i) + exp(a*kx*0.25i + a*ky*0.433i)) + x2*(exp(- a*kx*0.75i + a*ky*0.433i) + exp(a*kx*0.75i – a*ky*0.433i)))*(0.1667 – 0.2887i) – x4*lambda^3*(exp(- a*kx*0.25i – a*ky*0.433i) + exp(a*kx*0.25i + a*ky*0.433i))*(0.1111 – 0.1925i)
lambda*(x2*(exp(-a*ky*0.866i) + exp(a*ky*0.866i)) + x1*(exp(-a*kx*0.5i) + exp(a*kx*0.5i)))*(0.6667 + 8.164e-17i) – x4*lambda^3*(exp(-a*kx*0.5i) + exp(a*kx*0.5i))*1.54i – 1.0*x4*lambda^3*(exp(-a*kx*0.5i)*(0.4444 + 5.443e-17i) + exp(a*kx*0.5i)*(0.4444 + 5.443e-17i)), 0, lambda*(x1*(exp(- a*kx*0.25i – a*ky*0.433i) + exp(a*kx*0.25i + a*ky*0.433i)) + x2*(exp(- a*kx*0.75i + a*ky*0.433i) + exp(a*kx*0.75i – a*ky*0.433i)))*(0.6667 + 1.027e-33i) – x4*lambda^3*(exp(- a*kx*0.25i – a*ky*0.433i) + exp(a*kx*0.25i + a*ky*0.433i))*(1.257 – 1.54i), lambda*(x1*(exp(- a*kx*0.25i + a*ky*0.433i) + exp(a*kx*0.25i – a*ky*0.433i)) + x2*(exp(- a*kx*0.75i – a*ky*0.433i) + exp(a*kx*0.75i + a*ky*0.433i)))*(0.6667 + 1.027e-33i) – 0.8889*x4*lambda^3*(exp(- a*kx*0.25i + a*ky*0.433i) + exp(a*kx*0.25i – a*ky*0.433i)) + x4*lambda^3*(0.4444*exp(- a*kx*0.25i + a*ky*0.433i) + 0.4444*exp(a*kx*0.25i – a*ky*0.433i)), – lambda*(x2*(exp(-a*ky*0.866i) + exp(a*ky*0.866i)) + x1*(exp(-a*kx*0.5i) + exp(a*kx*0.5i)))*(0.3333 – 4.082e-17i) – 1.0*x4*lambda^3*(exp(-a*kx*0.5i)*(0.8889 + 5.551e-17i) + exp(a*kx*0.5i)*(0.8889 + 5.551e-17i)) + x4*lambda^3*(exp(-a*kx*0.5i)*(0.8889 + 1.11e-16i) + exp(a*kx*0.5i)*(0.8889 + 1.11e-16i)) + x4*lambda^3*(exp(-a*kx*0.5i)*(0.2222 – 2.721e-17i) + exp(a*kx*0.5i)*(0.2222 – 2.721e-17i)), – 0.4444*x4*lambda^3 + (2.0*x1 + 2.0*x2)*lambda, lambda*(x1*(exp(- a*kx*0.25i – a*ky*0.433i) + exp(a*kx*0.25i + a*ky*0.433i)) + x2*(exp(- a*kx*0.75i + a*ky*0.433i) + exp(a*kx*0.75i – a*ky*0.433i)))*(0.1667 + 0.2887i) – x4*lambda^3*(exp(- a*kx*0.25i – a*ky*0.433i) + exp(a*kx*0.25i + a*ky*0.433i))*(0.1111 + 0.1925i), lambda*(x1*(exp(- a*kx*0.25i + a*ky*0.433i) + exp(a*kx*0.25i – a*ky*0.433i)) + x2*(exp(- a*kx*0.75i – a*ky*0.433i) + exp(a*kx*0.75i + a*ky*0.433i)))*(0.1667 – 0.2887i) – x4*lambda^3*(exp(- a*kx*0.25i + a*ky*0.433i) + exp(a*kx*0.25i – a*ky*0.433i))*(0.7778 – 1.347i)
– lambda*(x1*(exp(- a*kx*0.25i + a*ky*0.433i) + exp(a*kx*0.25i – a*ky*0.433i)) + x2*(exp(- a*kx*0.75i – a*ky*0.433i) + exp(a*kx*0.75i + a*ky*0.433i)))*(0.3333 + 0.5774i) – x4*lambda^3*(exp(- a*kx*0.25i + a*ky*0.433i) + exp(a*kx*0.25i – a*ky*0.433i))*(0.6667 – 0.3849i) + x4*lambda^3*(exp(- a*kx*0.25i + a*ky*0.433i)*(0.8889 – 1.11e-16i) + exp(a*kx*0.25i – a*ky*0.433i)*(0.8889 – 1.11e-16i)), lambda*(x1*(exp(- a*kx*0.25i – a*ky*0.433i) + exp(a*kx*0.25i + a*ky*0.433i)) + x2*(exp(- a*kx*0.75i + a*ky*0.433i) + exp(a*kx*0.75i – a*ky*0.433i)))*(0.6667 + 1.027e-33i) + x4*lambda^3*(exp(- a*kx*0.25i – a*ky*0.433i) + exp(a*kx*0.25i + a*ky*0.433i))*1.54i – 1.0*x4*lambda^3*(0.4444*exp(- a*kx*0.25i – a*ky*0.433i) + 0.4444*exp(a*kx*0.25i + a*ky*0.433i)), 0, 0.6667*lambda*(x2*(exp(-a*ky*0.866i) + exp(a*ky*0.866i)) + x1*(exp(-a*kx*0.5i) + exp(a*kx*0.5i))) – x4*lambda^3*(exp(-a*kx*0.5i) + exp(a*kx*0.5i))*1.54i – 1.0*x4*lambda^3*(exp(-a*kx*0.5i)*(0.4444 + 1.388e-17i) + exp(a*kx*0.5i)*(0.4444 + 1.388e-17i)), lambda*(x1*(exp(- a*kx*0.25i + a*ky*0.433i) + exp(a*kx*0.25i – a*ky*0.433i)) + x2*(exp(- a*kx*0.75i – a*ky*0.433i) + exp(a*kx*0.75i + a*ky*0.433i)))*(0.1667 – 0.2887i) – x4*lambda^3*(exp(- a*kx*0.25i + a*ky*0.433i) + exp(a*kx*0.25i – a*ky*0.433i))*(0.7778 – 1.347i), lambda*(x1*(exp(- a*kx*0.25i – a*ky*0.433i) + exp(a*kx*0.25i + a*ky*0.433i)) + x2*(exp(- a*kx*0.75i + a*ky*0.433i) + exp(a*kx*0.75i – a*ky*0.433i)))*(0.1667 – 0.2887i) – x4*lambda^3*(exp(- a*kx*0.25i – a*ky*0.433i) + exp(a*kx*0.25i + a*ky*0.433i))*(0.1111 – 0.1925i), – 0.4444*x4*lambda^3 + (2.0*x1 + 2.0*x2)*lambda, lambda*(x2*(exp(-a*ky*0.866i) + exp(a*ky*0.866i)) + x1*(exp(-a*kx*0.5i) + exp(a*kx*0.5i)))*(0.1667 + 0.2887i) – x4*lambda^3*(exp(-a*kx*0.5i) + exp(a*kx*0.5i))*(0.1111 + 0.1925i)
– lambda*(x1*(exp(- a*kx*0.25i – a*ky*0.433i) + exp(a*kx*0.25i + a*ky*0.433i)) + x2*(exp(- a*kx*0.75i + a*ky*0.433i) + exp(a*kx*0.75i – a*ky*0.433i)))*(0.3333 – 0.5774i) – x4*lambda^3*(exp(- a*kx*0.25i – a*ky*0.433i) + exp(a*kx*0.25i + a*ky*0.433i))*(0.2222 + 1.155i) – 1.0*x4*lambda^3*(exp(- a*kx*0.25i – a*ky*0.433i)*(0.8889 – 5.551e-17i) + exp(a*kx*0.25i + a*ky*0.433i)*(0.8889 – 5.551e-17i)), lambda*(x1*(exp(- a*kx*0.25i + a*ky*0.433i) + exp(a*kx*0.25i – a*ky*0.433i)) + x2*(exp(- a*kx*0.75i – a*ky*0.433i) + exp(a*kx*0.75i + a*ky*0.433i)))*(0.6667 + 1.027e-33i) – 0.8889*x4*lambda^3*(exp(- a*kx*0.25i + a*ky*0.433i) + exp(a*kx*0.25i – a*ky*0.433i)) + x4*lambda^3*(0.4444*exp(- a*kx*0.25i + a*ky*0.433i) + 0.4444*exp(a*kx*0.25i – a*ky*0.433i)), 0.6667*lambda*(x2*(exp(-a*ky*0.866i) + exp(a*ky*0.866i)) + x1*(exp(-a*kx*0.5i) + exp(a*kx*0.5i))) – x4*lambda^3*(exp(-a*kx*0.5i) + exp(a*kx*0.5i))*1.54i – 1.0*x4*lambda^3*(exp(-a*kx*0.5i)*(0.4444 + 1.388e-17i) + exp(a*kx*0.5i)*(0.4444 + 1.388e-17i)), 0, lambda*(x1*(exp(- a*kx*0.25i – a*ky*0.433i) + exp(a*kx*0.25i + a*ky*0.433i)) + x2*(exp(- a*kx*0.75i + a*ky*0.433i) + exp(a*kx*0.75i – a*ky*0.433i)))*(0.1667 + 0.2887i) – x4*lambda^3*(exp(- a*kx*0.25i – a*ky*0.433i) + exp(a*kx*0.25i + a*ky*0.433i))*(0.1111 + 0.1925i), lambda*(x1*(exp(- a*kx*0.25i + a*ky*0.433i) + exp(a*kx*0.25i – a*ky*0.433i)) + x2*(exp(- a*kx*0.75i – a*ky*0.433i) + exp(a*kx*0.75i + a*ky*0.433i)))*(0.1667 + 0.2887i) – x4*lambda^3*(exp(- a*kx*0.25i + a*ky*0.433i) + exp(a*kx*0.25i – a*ky*0.433i))*(0.7778 + 1.347i), lambda*(x2*(exp(-a*ky*0.866i) + exp(a*ky*0.866i)) + x1*(exp(-a*kx*0.5i) + exp(a*kx*0.5i)))*(0.1667 – 0.2887i) – x4*lambda^3*(exp(-a*kx*0.5i) + exp(a*kx*0.5i))*(0.1111 – 0.1925i), – 0.4444*x4*lambda^3 + (2.0*x1 + 2.0*x2)*lambda
];
FF = F; % this gives same "Uk" on both computers
FF = F + eye(8)*(0.0001); % this gives different "Uk" on both computers
K = chol(FF,"upper");
Q = K*sigma3*(K’); % Q is same on both computers
[RV,D,~] = eig(Q);
[D,I] = sort(diag(real(D)),’descend’);
RV = RV(:, I);
Uk = RV;
Lk = diag(D);
% more specifically i get these results with "FF = F + eye(8)*(0.0001)":
Uk_on_laptop = [-0.5581 – 0.2520i -0.4914 – 0.1718i -0.1074 – 0.3017i 0.2309 – 0.2705i 0.0962 – 0.0850i -0.1447 – 0.2249i 0.1924 – 0.0017i -0.0000 + 0.0000i
0.4717 + 0.2130i -0.5796 – 0.1237i 0.1084 – 0.2927i -0.2900 + 0.2300i -0.2030 + 0.1332i -0.0739 – 0.1924i 0.2089 – 0.0371i 0.0000 + 0.0000i
-0.0445 – 0.4460i -0.0758 – 0.2465i -0.4168 + 0.3376i -0.5328 + 0.0341i -0.2467 – 0.0430i -0.1713 + 0.1603i 0.0220 + 0.2039i 0.0000 – 0.0000i
0.3210 – 0.2306i -0.2904 + 0.1641i 0.3409 + 0.4428i 0.0806 – 0.4949i 0.0400 – 0.2456i 0.1073 + 0.1394i 0.2399 – 0.1355i 0.0000 – 0.0000i
0.0000 – 0.0000i 0.1304 – 0.0722i -0.2064 + 0.0175i 0.0769 – 0.0629i -0.2355 + 0.1429i 0.2359 – 0.0767i 0.2660 – 0.3031i -0.3953 + 0.6846i
-0.0000 + 0.0000i 0.2267 – 0.0899i -0.2537 + 0.0585i -0.1151 + 0.1335i 0.1507 – 0.1648i 0.2370 – 0.2627i 0.4938 – 0.4630i 0.2283 – 0.3953i
-0.0000 – 0.0000i -0.0689 – 0.1710i 0.0363 – 0.2315i 0.0199 + 0.2998i 0.0948 – 0.6211i -0.0523 + 0.5134i -0.0370 – 0.2328i 0.1614 + 0.2795i
-0.0000 + 0.0000i 0.2904 + 0.0000i 0.1855 + 0.0000i 0.2623 + 0.0000i -0.5286 + 0.0000i -0.5890 + 0.0000i 0.3516 + 0.0000i 0.2500 + 0.0000i];
Uk_on_work = [-0.5581 – 0.2520i -0.4914 – 0.1718i -0.1074 – 0.3017i 0.2309 – 0.2705i -0.0962 + 0.0850i -0.1447 – 0.2249i -0.1924 + 0.0017i -0.0000 + 0.0000i
0.4717 + 0.2130i -0.5796 – 0.1237i 0.1084 – 0.2927i -0.2900 + 0.2300i 0.2030 – 0.1332i -0.0739 – 0.1924i -0.2089 + 0.0371i 0.0000 + 0.0000i
-0.0445 – 0.4460i -0.0758 – 0.2465i -0.4168 + 0.3376i -0.5328 + 0.0341i 0.2467 + 0.0430i -0.1713 + 0.1603i -0.0220 – 0.2039i 0.0000 – 0.0000i
0.3210 – 0.2306i -0.2904 + 0.1641i 0.3409 + 0.4428i 0.0806 – 0.4949i -0.0400 + 0.2456i 0.1073 + 0.1394i -0.2399 + 0.1355i 0.0000 – 0.0000i
0.0000 – 0.0000i 0.1304 – 0.0722i -0.2064 + 0.0175i 0.0769 – 0.0629i 0.2355 – 0.1429i 0.2359 – 0.0767i -0.2660 + 0.3031i -0.3953 + 0.6846i
-0.0000 + 0.0000i 0.2267 – 0.0899i -0.2537 + 0.0585i -0.1151 + 0.1335i -0.1507 + 0.1648i 0.2370 – 0.2627i -0.4938 + 0.4630i 0.2283 – 0.3953i
-0.0000 – 0.0000i -0.0689 – 0.1710i 0.0363 – 0.2315i 0.0199 + 0.2998i -0.0948 + 0.6211i -0.0523 + 0.5134i 0.0370 + 0.2328i 0.1614 + 0.2795i
-0.0000 + 0.0000i 0.2904 + 0.0000i 0.1855 + 0.0000i 0.2623 + 0.0000i 0.5286 + 0.0000i -0.5890 + 0.0000i -0.3516 + 0.0000i 0.2500 + 0.0000i]; system, eigenvalue, eig MATLAB Answers — New Questions
Answer to Moving Windows section of the “Calculations with Vectors and Matrices” online course is identical to solution but marked wrong. How to get credit?
I’m taking the "Calculations with Vectors and Matrices" self-paced online course, but I’m not getting due credit for the section on Moving WIndow Calculations. I have screenshots to prove that even an answer that is identical to the one under "See solution" (which I reached indenpendently) is marked as wrong, saying I haven’t added minUsage and maxUsage to the plot. I’ve tried many different ways of recalculating, reformatting, and resubmitting Task 4, including eliminating the section break between the problem setup and Task 1 because I suspected that the duplication of the original plot from the setup to Task 1 might be part of the issue, but even that didn’t fix it. At this point, the only way I can get full credit for the course is if someone on the admin side can override the spurious error.I’m taking the "Calculations with Vectors and Matrices" self-paced online course, but I’m not getting due credit for the section on Moving WIndow Calculations. I have screenshots to prove that even an answer that is identical to the one under "See solution" (which I reached indenpendently) is marked as wrong, saying I haven’t added minUsage and maxUsage to the plot. I’ve tried many different ways of recalculating, reformatting, and resubmitting Task 4, including eliminating the section break between the problem setup and Task 1 because I suspected that the duplication of the original plot from the setup to Task 1 might be part of the issue, but even that didn’t fix it. At this point, the only way I can get full credit for the course is if someone on the admin side can override the spurious error. I’m taking the "Calculations with Vectors and Matrices" self-paced online course, but I’m not getting due credit for the section on Moving WIndow Calculations. I have screenshots to prove that even an answer that is identical to the one under "See solution" (which I reached indenpendently) is marked as wrong, saying I haven’t added minUsage and maxUsage to the plot. I’ve tried many different ways of recalculating, reformatting, and resubmitting Task 4, including eliminating the section break between the problem setup and Task 1 because I suspected that the duplication of the original plot from the setup to Task 1 might be part of the issue, but even that didn’t fix it. At this point, the only way I can get full credit for the course is if someone on the admin side can override the spurious error. online course, error, self-paced, moving window MATLAB Answers — New Questions
Data in msec is not displayed
Hello,
I am recording data each 100msec and send it in a bulk data JSON each 30 sec. I only receave data in thingspeak with a time stamp of 1 second, and not those in between each second (I mis 9 measurements each second)
part of the JSON string:
[{ "created_at":"2024-08-12 17:10:55.797Z","field1":817},{ "created_at":"2024-08-12 17:10:55.920Z","field1":864},{ "created_at":"2024-08-12 17:10:56.043Z","field1":856}…
is there a way to visualise all the data?Hello,
I am recording data each 100msec and send it in a bulk data JSON each 30 sec. I only receave data in thingspeak with a time stamp of 1 second, and not those in between each second (I mis 9 measurements each second)
part of the JSON string:
[{ "created_at":"2024-08-12 17:10:55.797Z","field1":817},{ "created_at":"2024-08-12 17:10:55.920Z","field1":864},{ "created_at":"2024-08-12 17:10:56.043Z","field1":856}…
is there a way to visualise all the data? Hello,
I am recording data each 100msec and send it in a bulk data JSON each 30 sec. I only receave data in thingspeak with a time stamp of 1 second, and not those in between each second (I mis 9 measurements each second)
part of the JSON string:
[{ "created_at":"2024-08-12 17:10:55.797Z","field1":817},{ "created_at":"2024-08-12 17:10:55.920Z","field1":864},{ "created_at":"2024-08-12 17:10:56.043Z","field1":856}…
is there a way to visualise all the data? json, msec MATLAB Answers — New Questions
How can I write data repeatedly to an Excel file on a network drive from MATLAB R2024a?
I have a MATLAB script where I am using repeated calls to "writematrix" to write data to an Excel file on a network drive. The script will sometimes run successfully, but sometimes it fails at various lines with the following error.
Unable to write to file ‘…’ You might not have write permissions or the file might be open by another application.
I am looking for a consistent approach to write all of my data to this Excel file.I have a MATLAB script where I am using repeated calls to "writematrix" to write data to an Excel file on a network drive. The script will sometimes run successfully, but sometimes it fails at various lines with the following error.
Unable to write to file ‘…’ You might not have write permissions or the file might be open by another application.
I am looking for a consistent approach to write all of my data to this Excel file. I have a MATLAB script where I am using repeated calls to "writematrix" to write data to an Excel file on a network drive. The script will sometimes run successfully, but sometimes it fails at various lines with the following error.
Unable to write to file ‘…’ You might not have write permissions or the file might be open by another application.
I am looking for a consistent approach to write all of my data to this Excel file. writematrix MATLAB Answers — New Questions
Why is my GPU not detected by Parallel Computing Toolbox?
When I execute "gpuDevice" command in MATLAB command prompt on a machine with a supported GPU installed, I get the following error message:
ERROR: >> gpuDeviceError using gpuDevice (line 26)
No supported GPU device was found on this computer. To learn more about supported GPU devices, see
www.mathworks.com/gpudevice.When I execute "gpuDevice" command in MATLAB command prompt on a machine with a supported GPU installed, I get the following error message:
ERROR: >> gpuDeviceError using gpuDevice (line 26)
No supported GPU device was found on this computer. To learn more about supported GPU devices, see
www.mathworks.com/gpudevice. When I execute "gpuDevice" command in MATLAB command prompt on a machine with a supported GPU installed, I get the following error message:
ERROR: >> gpuDeviceError using gpuDevice (line 26)
No supported GPU device was found on this computer. To learn more about supported GPU devices, see
www.mathworks.com/gpudevice. gpu, nvidia, gpudevice MATLAB Answers — New Questions
How does Parallel Computing Toolbox handle Performance and Efficiency core usage?
I have a computer with a CPU where the architecture has been split into Performance Cores and Efficiency Cores (P and E cores). I would like to use this with Parallel Computing Toolbox but I am unsure how many workers to run and whether I should be using both types of cores?I have a computer with a CPU where the architecture has been split into Performance Cores and Efficiency Cores (P and E cores). I would like to use this with Parallel Computing Toolbox but I am unsure how many workers to run and whether I should be using both types of cores? I have a computer with a CPU where the architecture has been split into Performance Cores and Efficiency Cores (P and E cores). I would like to use this with Parallel Computing Toolbox but I am unsure how many workers to run and whether I should be using both types of cores? cores, parallel, numworkers MATLAB Answers — New Questions
Where can I find a comprehensive explanation of the Filter Design tools available in Matlab?
I have been trying to learn about the filter design tools avaialable in Matlab so that I can make an informed decision about which tools I need to use for particular applications. Unfortunately, I have not found a comprehensive explanation. Instead, I have learned that there appear to be tools in the Signal Processing Tollbox as well as the DSP System toolbox. Some of these tools are GUI-based, and others are functions, but many of them seem to have overlapping features. Both toolboxes appear to have unique data objects for storing filter designs, but I cannot find references to tools for converting between data types. Normally, I use the low-level functions like BUTTER to generate analog or digital filter designs and I will either store these as NUM & DEN arrays or as LTI objects. I also cannot find any reference for how I can convert either NUM,DEN or LTI object formats to any of the unique data objects in the digital filter design/analysis GUI’s. This is incredibly confusing and is not what I am used to with regard to traditional MathWorks documentation. Please direct me to a comprehensive reference on all of the digital filter design tools supported by MathWorks. I really hope that I don’t have to read all of the documentation for every tool just to figure out which one I need to use…I have been trying to learn about the filter design tools avaialable in Matlab so that I can make an informed decision about which tools I need to use for particular applications. Unfortunately, I have not found a comprehensive explanation. Instead, I have learned that there appear to be tools in the Signal Processing Tollbox as well as the DSP System toolbox. Some of these tools are GUI-based, and others are functions, but many of them seem to have overlapping features. Both toolboxes appear to have unique data objects for storing filter designs, but I cannot find references to tools for converting between data types. Normally, I use the low-level functions like BUTTER to generate analog or digital filter designs and I will either store these as NUM & DEN arrays or as LTI objects. I also cannot find any reference for how I can convert either NUM,DEN or LTI object formats to any of the unique data objects in the digital filter design/analysis GUI’s. This is incredibly confusing and is not what I am used to with regard to traditional MathWorks documentation. Please direct me to a comprehensive reference on all of the digital filter design tools supported by MathWorks. I really hope that I don’t have to read all of the documentation for every tool just to figure out which one I need to use… I have been trying to learn about the filter design tools avaialable in Matlab so that I can make an informed decision about which tools I need to use for particular applications. Unfortunately, I have not found a comprehensive explanation. Instead, I have learned that there appear to be tools in the Signal Processing Tollbox as well as the DSP System toolbox. Some of these tools are GUI-based, and others are functions, but many of them seem to have overlapping features. Both toolboxes appear to have unique data objects for storing filter designs, but I cannot find references to tools for converting between data types. Normally, I use the low-level functions like BUTTER to generate analog or digital filter designs and I will either store these as NUM & DEN arrays or as LTI objects. I also cannot find any reference for how I can convert either NUM,DEN or LTI object formats to any of the unique data objects in the digital filter design/analysis GUI’s. This is incredibly confusing and is not what I am used to with regard to traditional MathWorks documentation. Please direct me to a comprehensive reference on all of the digital filter design tools supported by MathWorks. I really hope that I don’t have to read all of the documentation for every tool just to figure out which one I need to use… filter design, digital filter MATLAB Answers — New Questions
Is there a variant of nlfilter for color images?
I need to perform quite a complex operation on color image using sliding window way. Is there any variant for RGB images?I need to perform quite a complex operation on color image using sliding window way. Is there any variant for RGB images? I need to perform quite a complex operation on color image using sliding window way. Is there any variant for RGB images? sliding window, nlfilter, image processing MATLAB Answers — New Questions
How to Fix Polyspace CodeProver Orange Overflow errors
Hello,
I am getting the below Orange Overflow error due to operator *
How to fix these Overflow errors as we know this operation is not going to generate a result bigger than the datatype of int32 ?Hello,
I am getting the below Orange Overflow error due to operator *
How to fix these Overflow errors as we know this operation is not going to generate a result bigger than the datatype of int32 ? Hello,
I am getting the below Orange Overflow error due to operator *
How to fix these Overflow errors as we know this operation is not going to generate a result bigger than the datatype of int32 ? codeprover, overflow, *operator MATLAB Answers — New Questions
Why are the final values for velocity and acceleration from bsplinepolytraj() always equal to zero?
When creating splines using bsplinepolytraj() the last values for the x and y component of velocity and acceleration are always zero. Here’s an example from the documentation:
% Interpolate with B-Spline
% Create waypoints to interpolate with a B-Spline.
wpts1 = [0 1 2.1 8 4 3];
wpts2 = [0 1 1.3 .8 .3 .3];
wpts = [wpts1; wpts2];
L = length(wpts) – 1;
% Form matrices used to compute interior points of control polygon
r = zeros(L+1, size(wpts,1));
A = eye(L+1);
for i= 1:(L-1)
A(i+1,(i):(i+2)) = [1 4 1];
r(i+1,:) = 6*wpts(:,i+1)’;
end
% Override end points and choose r0 and rL.
A(2,1:3) = [3/2 7/2 1];
A(L,(L-1):(L+1)) = [1 7/2 3/2];
r(1,:) = (wpts(:,1) + (wpts(:,2) – wpts(:,1))/2)’;
r(end,:) = (wpts(:,end-1) + (wpts(:,end) – wpts(:,end-1))/2)’;
dInterior = (Ar)’;
% Construct a complete control polygon and use bsplinepolytraj to compute a polynomial with the new control points
cpts = [wpts(:,1) dInterior wpts(:,end)];
t = 0:0.01:1;
[q, dq, ddq, ~] = bsplinepolytraj(cpts, [0 1], t);
The values for
disp(dq(:,end))
and
disp(ddq(:, end))
I feel like this is wrong. Why are these values zero and how can I get a non-zero answer?When creating splines using bsplinepolytraj() the last values for the x and y component of velocity and acceleration are always zero. Here’s an example from the documentation:
% Interpolate with B-Spline
% Create waypoints to interpolate with a B-Spline.
wpts1 = [0 1 2.1 8 4 3];
wpts2 = [0 1 1.3 .8 .3 .3];
wpts = [wpts1; wpts2];
L = length(wpts) – 1;
% Form matrices used to compute interior points of control polygon
r = zeros(L+1, size(wpts,1));
A = eye(L+1);
for i= 1:(L-1)
A(i+1,(i):(i+2)) = [1 4 1];
r(i+1,:) = 6*wpts(:,i+1)’;
end
% Override end points and choose r0 and rL.
A(2,1:3) = [3/2 7/2 1];
A(L,(L-1):(L+1)) = [1 7/2 3/2];
r(1,:) = (wpts(:,1) + (wpts(:,2) – wpts(:,1))/2)’;
r(end,:) = (wpts(:,end-1) + (wpts(:,end) – wpts(:,end-1))/2)’;
dInterior = (Ar)’;
% Construct a complete control polygon and use bsplinepolytraj to compute a polynomial with the new control points
cpts = [wpts(:,1) dInterior wpts(:,end)];
t = 0:0.01:1;
[q, dq, ddq, ~] = bsplinepolytraj(cpts, [0 1], t);
The values for
disp(dq(:,end))
and
disp(ddq(:, end))
I feel like this is wrong. Why are these values zero and how can I get a non-zero answer? When creating splines using bsplinepolytraj() the last values for the x and y component of velocity and acceleration are always zero. Here’s an example from the documentation:
% Interpolate with B-Spline
% Create waypoints to interpolate with a B-Spline.
wpts1 = [0 1 2.1 8 4 3];
wpts2 = [0 1 1.3 .8 .3 .3];
wpts = [wpts1; wpts2];
L = length(wpts) – 1;
% Form matrices used to compute interior points of control polygon
r = zeros(L+1, size(wpts,1));
A = eye(L+1);
for i= 1:(L-1)
A(i+1,(i):(i+2)) = [1 4 1];
r(i+1,:) = 6*wpts(:,i+1)’;
end
% Override end points and choose r0 and rL.
A(2,1:3) = [3/2 7/2 1];
A(L,(L-1):(L+1)) = [1 7/2 3/2];
r(1,:) = (wpts(:,1) + (wpts(:,2) – wpts(:,1))/2)’;
r(end,:) = (wpts(:,end-1) + (wpts(:,end) – wpts(:,end-1))/2)’;
dInterior = (Ar)’;
% Construct a complete control polygon and use bsplinepolytraj to compute a polynomial with the new control points
cpts = [wpts(:,1) dInterior wpts(:,end)];
t = 0:0.01:1;
[q, dq, ddq, ~] = bsplinepolytraj(cpts, [0 1], t);
The values for
disp(dq(:,end))
and
disp(ddq(:, end))
I feel like this is wrong. Why are these values zero and how can I get a non-zero answer? bsplinepolytraj, spline, curve fitting, robotics, trajectory MATLAB Answers — New Questions
How do I get run time or system time of my Speedgoat target computer in R2020b?
I’m upgrading from R2019a to R2020b and I can’t find analogous blocks to the "Elapsed Time" and "Time Stamp Delta" blocks to get run time or clock time from my Simulink Real-Time (SLRT) target computer.I’m upgrading from R2019a to R2020b and I can’t find analogous blocks to the "Elapsed Time" and "Time Stamp Delta" blocks to get run time or clock time from my Simulink Real-Time (SLRT) target computer. I’m upgrading from R2019a to R2020b and I can’t find analogous blocks to the "Elapsed Time" and "Time Stamp Delta" blocks to get run time or clock time from my Simulink Real-Time (SLRT) target computer. MATLAB Answers — New Questions
Training a neural network for different operating points
Hello,
i want to train a neural network to predict the temperature of an electrical machine in different operating points.
I have input data in the form of:
4×1 Cell, each cell with 101×3 elements
So the first cell contains the data for the first operating point, the second for the second…
And Target Data:
4×1 Cell, each cell with 101×1 elements
Where the first cell contains data for the first operating point, the second…
My question is now, which input layer i should use, so that the data is treated correctly ?Hello,
i want to train a neural network to predict the temperature of an electrical machine in different operating points.
I have input data in the form of:
4×1 Cell, each cell with 101×3 elements
So the first cell contains the data for the first operating point, the second for the second…
And Target Data:
4×1 Cell, each cell with 101×1 elements
Where the first cell contains data for the first operating point, the second…
My question is now, which input layer i should use, so that the data is treated correctly ? Hello,
i want to train a neural network to predict the temperature of an electrical machine in different operating points.
I have input data in the form of:
4×1 Cell, each cell with 101×3 elements
So the first cell contains the data for the first operating point, the second for the second…
And Target Data:
4×1 Cell, each cell with 101×1 elements
Where the first cell contains data for the first operating point, the second…
My question is now, which input layer i should use, so that the data is treated correctly ? matlab, neural network, deep learning MATLAB Answers — New Questions
How to fix Polyspace CodeProver Orange warnings due to + operator
Hello,
I am getting a Polyspace CodeProver Orange Overflow error due to + operator in the attached code
How to fix these issues as we are sure the expression is not going to generate a result that can extend beyond the data type of int32 ?Hello,
I am getting a Polyspace CodeProver Orange Overflow error due to + operator in the attached code
How to fix these issues as we are sure the expression is not going to generate a result that can extend beyond the data type of int32 ? Hello,
I am getting a Polyspace CodeProver Orange Overflow error due to + operator in the attached code
How to fix these issues as we are sure the expression is not going to generate a result that can extend beyond the data type of int32 ? codeprover, orange, overflow, +operator MATLAB Answers — New Questions
Call to inv() function seems to have (undesired) impact on Thread pool or maxNumCompThreads()
I tried to parallelize parts of my code via parpool("Threads"). I also use maxNumCompThreads to limit the maximum CPU utilization. I use a parfor loop which works as expected, meaning that the defined number of cores corresponds to the total cpu utilization shown in the windows taks manager (more or less).
However, if a call to the inv() function appears somewhere in the code before the thread pool is started, then the cpu utilization of the thread pool is unexpectedly higher, although the number of cores and also maxNumCompThreads is not changed. This happens reproducible, until matlab is restarted (and inv() is not called).
To obtain the unexpected behavior the input to inv() must exceed a certain size: inv(rand(10)) –> nothing happens, but inv(rand(1000)) –> CPU utilization of the following parfor loop is unexpectedly high.
A simple script to reproduce the described behavior (in matlab2023b):
maxNumCompThreads(12);
nCores = 12;
%% random parallel code
fprintf("Before inv function call:n");
pp = parpool("Threads", nCores);
for j = 1:3
tic;
parfor (i = 1:100)
A = rand(1000) / rand(1000);
end
toc
pause(2);
end
delete(pp);
%% matrix inverse
Minv = inv(rand(5000));
pause(5);
%% same random parallel code as before –> CPU Utilization goes up to 100%
fprintf("nnAfter inv function call:n");
pp = parpool("Threads", nCores);
for j = 1:3
tic;
parfor (i = 1:100)
A = rand(1000) / rand(1000);
end
toc
pause(2);
end
delete(pp);
On a 56-core machine, the first parallel block runs with < 20% CPU utilization, while the second block has ~50%.
I get the following output:
Before inv function call:
Starting parallel pool (parpool) using the ‘Threads’ profile …
Connected to parallel pool with 12 workers.
Elapsed time is 5.852217 seconds.
Elapsed time is 2.475874 seconds.
Elapsed time is 2.447292 seconds.
Parallel pool using the ‘Threads’ profile is shutting down.
After inv function call:
Starting parallel pool (parpool) using the ‘Threads’ profile …
Connected to parallel pool with 12 workers.
Elapsed time is 23.414892 seconds.
Elapsed time is 24.350276 seconds.
Elapsed time is 23.297744 seconds.
Parallel pool using the ‘Threads’ profile is shutting down.
The increased core utilization for Thread pools stays present until matlab is closed an restarted. With parpool("Processes") I did not observe this behavior.
Am I missing anything here?I tried to parallelize parts of my code via parpool("Threads"). I also use maxNumCompThreads to limit the maximum CPU utilization. I use a parfor loop which works as expected, meaning that the defined number of cores corresponds to the total cpu utilization shown in the windows taks manager (more or less).
However, if a call to the inv() function appears somewhere in the code before the thread pool is started, then the cpu utilization of the thread pool is unexpectedly higher, although the number of cores and also maxNumCompThreads is not changed. This happens reproducible, until matlab is restarted (and inv() is not called).
To obtain the unexpected behavior the input to inv() must exceed a certain size: inv(rand(10)) –> nothing happens, but inv(rand(1000)) –> CPU utilization of the following parfor loop is unexpectedly high.
A simple script to reproduce the described behavior (in matlab2023b):
maxNumCompThreads(12);
nCores = 12;
%% random parallel code
fprintf("Before inv function call:n");
pp = parpool("Threads", nCores);
for j = 1:3
tic;
parfor (i = 1:100)
A = rand(1000) / rand(1000);
end
toc
pause(2);
end
delete(pp);
%% matrix inverse
Minv = inv(rand(5000));
pause(5);
%% same random parallel code as before –> CPU Utilization goes up to 100%
fprintf("nnAfter inv function call:n");
pp = parpool("Threads", nCores);
for j = 1:3
tic;
parfor (i = 1:100)
A = rand(1000) / rand(1000);
end
toc
pause(2);
end
delete(pp);
On a 56-core machine, the first parallel block runs with < 20% CPU utilization, while the second block has ~50%.
I get the following output:
Before inv function call:
Starting parallel pool (parpool) using the ‘Threads’ profile …
Connected to parallel pool with 12 workers.
Elapsed time is 5.852217 seconds.
Elapsed time is 2.475874 seconds.
Elapsed time is 2.447292 seconds.
Parallel pool using the ‘Threads’ profile is shutting down.
After inv function call:
Starting parallel pool (parpool) using the ‘Threads’ profile …
Connected to parallel pool with 12 workers.
Elapsed time is 23.414892 seconds.
Elapsed time is 24.350276 seconds.
Elapsed time is 23.297744 seconds.
Parallel pool using the ‘Threads’ profile is shutting down.
The increased core utilization for Thread pools stays present until matlab is closed an restarted. With parpool("Processes") I did not observe this behavior.
Am I missing anything here? I tried to parallelize parts of my code via parpool("Threads"). I also use maxNumCompThreads to limit the maximum CPU utilization. I use a parfor loop which works as expected, meaning that the defined number of cores corresponds to the total cpu utilization shown in the windows taks manager (more or less).
However, if a call to the inv() function appears somewhere in the code before the thread pool is started, then the cpu utilization of the thread pool is unexpectedly higher, although the number of cores and also maxNumCompThreads is not changed. This happens reproducible, until matlab is restarted (and inv() is not called).
To obtain the unexpected behavior the input to inv() must exceed a certain size: inv(rand(10)) –> nothing happens, but inv(rand(1000)) –> CPU utilization of the following parfor loop is unexpectedly high.
A simple script to reproduce the described behavior (in matlab2023b):
maxNumCompThreads(12);
nCores = 12;
%% random parallel code
fprintf("Before inv function call:n");
pp = parpool("Threads", nCores);
for j = 1:3
tic;
parfor (i = 1:100)
A = rand(1000) / rand(1000);
end
toc
pause(2);
end
delete(pp);
%% matrix inverse
Minv = inv(rand(5000));
pause(5);
%% same random parallel code as before –> CPU Utilization goes up to 100%
fprintf("nnAfter inv function call:n");
pp = parpool("Threads", nCores);
for j = 1:3
tic;
parfor (i = 1:100)
A = rand(1000) / rand(1000);
end
toc
pause(2);
end
delete(pp);
On a 56-core machine, the first parallel block runs with < 20% CPU utilization, while the second block has ~50%.
I get the following output:
Before inv function call:
Starting parallel pool (parpool) using the ‘Threads’ profile …
Connected to parallel pool with 12 workers.
Elapsed time is 5.852217 seconds.
Elapsed time is 2.475874 seconds.
Elapsed time is 2.447292 seconds.
Parallel pool using the ‘Threads’ profile is shutting down.
After inv function call:
Starting parallel pool (parpool) using the ‘Threads’ profile …
Connected to parallel pool with 12 workers.
Elapsed time is 23.414892 seconds.
Elapsed time is 24.350276 seconds.
Elapsed time is 23.297744 seconds.
Parallel pool using the ‘Threads’ profile is shutting down.
The increased core utilization for Thread pools stays present until matlab is closed an restarted. With parpool("Processes") I did not observe this behavior.
Am I missing anything here? maxnumcompthreads, parpool, threads, inv MATLAB Answers — New Questions
Polyspace Orange Scalar Overflow error
Attached the snippet of the scalar orange overflow error reported by polyspace in the project we are working with
how to overcome this orange error as we are sure the reported operation is within sint16 data type result ?Attached the snippet of the scalar orange overflow error reported by polyspace in the project we are working with
how to overcome this orange error as we are sure the reported operation is within sint16 data type result ? Attached the snippet of the scalar orange overflow error reported by polyspace in the project we are working with
how to overcome this orange error as we are sure the reported operation is within sint16 data type result ? codeprover, overflow MATLAB Answers — New Questions
When i call and run this code it just save the Phase1 results in CSvV file not other results .
When i call and run this code it just save the Phase1 results in CSvV file not other results .When i call and run this code it just save the Phase1 results in CSvV file not other results . When i call and run this code it just save the Phase1 results in CSvV file not other results . matlab code, matlab coder MATLAB Answers — New Questions