Tag Archives: matlab
Avast detected a virus threat (IDP.ALEXA.54) in my own standalone application
Hello everyone.
Recently, I have compiled my own standalone application using Matlab Compiler – let’s say it is called JHApp.exe. Then, I tried to test the functions of my JHApp.exe file occurring in the for_redistribution_files_only folder (i.e., without installation). During each very first run (with each new compiled version), a security alert is reported by Avast. I understand the antivirus is suspicious of that new executable file and I know this is quite common – this is not the major problem.
However, after several minutes of using JHApp.exe (the app makes many calculations and can create .xls, .html and .m files), I received a new, more specific alert, something like IDP.ALEXA.54 detected, and Avast moved JHApp.exe to the carantine.
Given that I have spent a lot of time coding the app and I want to share my app in a scientific community, it is very important for me that it is trustworthy and safe. May it happen that a harmful code, e.g., from an infected PC, is accidentally and unintentionally distributed together with a Matlab standalone application?
It is quite strange for me to imagine that – my PC does not seem to be infected (according to Avast), and I don’t think some harmful code can easily attack Matlab and hide in a standalone application.
Please, what do you think about that?
Thank you very much for your answers.
Best regards, Jakub HaiflerHello everyone.
Recently, I have compiled my own standalone application using Matlab Compiler – let’s say it is called JHApp.exe. Then, I tried to test the functions of my JHApp.exe file occurring in the for_redistribution_files_only folder (i.e., without installation). During each very first run (with each new compiled version), a security alert is reported by Avast. I understand the antivirus is suspicious of that new executable file and I know this is quite common – this is not the major problem.
However, after several minutes of using JHApp.exe (the app makes many calculations and can create .xls, .html and .m files), I received a new, more specific alert, something like IDP.ALEXA.54 detected, and Avast moved JHApp.exe to the carantine.
Given that I have spent a lot of time coding the app and I want to share my app in a scientific community, it is very important for me that it is trustworthy and safe. May it happen that a harmful code, e.g., from an infected PC, is accidentally and unintentionally distributed together with a Matlab standalone application?
It is quite strange for me to imagine that – my PC does not seem to be infected (according to Avast), and I don’t think some harmful code can easily attack Matlab and hide in a standalone application.
Please, what do you think about that?
Thank you very much for your answers.
Best regards, Jakub Haifler Hello everyone.
Recently, I have compiled my own standalone application using Matlab Compiler – let’s say it is called JHApp.exe. Then, I tried to test the functions of my JHApp.exe file occurring in the for_redistribution_files_only folder (i.e., without installation). During each very first run (with each new compiled version), a security alert is reported by Avast. I understand the antivirus is suspicious of that new executable file and I know this is quite common – this is not the major problem.
However, after several minutes of using JHApp.exe (the app makes many calculations and can create .xls, .html and .m files), I received a new, more specific alert, something like IDP.ALEXA.54 detected, and Avast moved JHApp.exe to the carantine.
Given that I have spent a lot of time coding the app and I want to share my app in a scientific community, it is very important for me that it is trustworthy and safe. May it happen that a harmful code, e.g., from an infected PC, is accidentally and unintentionally distributed together with a Matlab standalone application?
It is quite strange for me to imagine that – my PC does not seem to be infected (according to Avast), and I don’t think some harmful code can easily attack Matlab and hide in a standalone application.
Please, what do you think about that?
Thank you very much for your answers.
Best regards, Jakub Haifler virus threat, standalone application, compiler, security, alert MATLAB Answers — New Questions
How do I identify the MEX function that caused MATLAB to crash?
MATLAB crashed when I tried running my code and I believe the cause of the crash was a MEX function due to the following message at the bottom on the MATLAB crash log:
This error was detected while a MEX-file was running. If the MEX-file
is not an official MathWorks function, please examine its source code
for errors. Please consult the External Interfaces Guide for information
on debugging MEX-files.
How can I determine from the crash log which MEX function caused the crash?MATLAB crashed when I tried running my code and I believe the cause of the crash was a MEX function due to the following message at the bottom on the MATLAB crash log:
This error was detected while a MEX-file was running. If the MEX-file
is not an official MathWorks function, please examine its source code
for errors. Please consult the External Interfaces Guide for information
on debugging MEX-files.
How can I determine from the crash log which MEX function caused the crash? MATLAB crashed when I tried running my code and I believe the cause of the crash was a MEX function due to the following message at the bottom on the MATLAB crash log:
This error was detected while a MEX-file was running. If the MEX-file
is not an official MathWorks function, please examine its source code
for errors. Please consult the External Interfaces Guide for information
on debugging MEX-files.
How can I determine from the crash log which MEX function caused the crash? mex, mexfunction, mexfunctionadapter MATLAB Answers — New Questions
Why do I get the error: “Error in ros.internal.utilities.checkAndGetCompatibleCompilersLocation (line 73)”?
Hi,
I’m trying to implement some ROS2 custom messages into Matlab and I’ve not found a solution yet.
I downloaded the following repo: https://github.com/ros2/common_interfaces.git
In order to recreate the errors:
download the repo (I choose to clone it in the home);
open Matlab and move to this folder;
give the following command in the command window
ros2genmsg(".")
After this, I get these errors:
>> ros2genmsg(".")
Identifying message files in folder ‘/home/alberto/common_interfaces’..Validating message files in folder ‘/home/alberto/common_interfaces’..Done.
Done.
[0/11] Generating MATLAB interfaces for custom message packages… 0%Error using ()
Key not found.
Error in ros.internal.utilities.checkAndGetCompatibleCompilersLocation (line 73)
matlabInCompatibleCompilerVer = supportedCompilerVersions(matlabLIBSTDCXXVersionNum+1);
Error in ros.internal.ROSProjectBuilder (line 453)
[h.GccLocation, h.GppLocation] = ros.internal.utilities.checkAndGetCompatibleCompilersLocation();
Error in ros.ros2.internal.ColconBuilder (line 26)
h@ros.internal.ROSProjectBuilder(varargin{:});
Error in ros2genmsg (line 278)
builder = ros.ros2.internal.ColconBuilder(genDir, pkgInfos{iPkg}, UseNinja=useNinja, SuppressOutput=suppressOutput);
I tried to recompile ROS packages and even to change compilers’ version, but I can’t find a way out.
I’m working on Ubuntu 22.04, the Matlab version that I’m using is:
MATLAB Version: 23.2.0.2599560 (R2023b) Update 8
Operating System: Linux 6.5.0-45-generic #45~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Mon Jul 15 16:40:02 UTC 2 x86_64
Java Version: Java 1.8.0_202-b08 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
Following, I’m reporting versions of gcc, g++, Python, cmake and ROS:
gcc (Ubuntu 10.5.0-1ubuntu1~22.04) 10.5.0
g++ (Ubuntu 10.5.0-1ubuntu1~22.04) 10.5.0
Python 3.10.12
cmake 3.22.1
ROS2 humble
Thanks for the help.Hi,
I’m trying to implement some ROS2 custom messages into Matlab and I’ve not found a solution yet.
I downloaded the following repo: https://github.com/ros2/common_interfaces.git
In order to recreate the errors:
download the repo (I choose to clone it in the home);
open Matlab and move to this folder;
give the following command in the command window
ros2genmsg(".")
After this, I get these errors:
>> ros2genmsg(".")
Identifying message files in folder ‘/home/alberto/common_interfaces’..Validating message files in folder ‘/home/alberto/common_interfaces’..Done.
Done.
[0/11] Generating MATLAB interfaces for custom message packages… 0%Error using ()
Key not found.
Error in ros.internal.utilities.checkAndGetCompatibleCompilersLocation (line 73)
matlabInCompatibleCompilerVer = supportedCompilerVersions(matlabLIBSTDCXXVersionNum+1);
Error in ros.internal.ROSProjectBuilder (line 453)
[h.GccLocation, h.GppLocation] = ros.internal.utilities.checkAndGetCompatibleCompilersLocation();
Error in ros.ros2.internal.ColconBuilder (line 26)
h@ros.internal.ROSProjectBuilder(varargin{:});
Error in ros2genmsg (line 278)
builder = ros.ros2.internal.ColconBuilder(genDir, pkgInfos{iPkg}, UseNinja=useNinja, SuppressOutput=suppressOutput);
I tried to recompile ROS packages and even to change compilers’ version, but I can’t find a way out.
I’m working on Ubuntu 22.04, the Matlab version that I’m using is:
MATLAB Version: 23.2.0.2599560 (R2023b) Update 8
Operating System: Linux 6.5.0-45-generic #45~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Mon Jul 15 16:40:02 UTC 2 x86_64
Java Version: Java 1.8.0_202-b08 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
Following, I’m reporting versions of gcc, g++, Python, cmake and ROS:
gcc (Ubuntu 10.5.0-1ubuntu1~22.04) 10.5.0
g++ (Ubuntu 10.5.0-1ubuntu1~22.04) 10.5.0
Python 3.10.12
cmake 3.22.1
ROS2 humble
Thanks for the help. Hi,
I’m trying to implement some ROS2 custom messages into Matlab and I’ve not found a solution yet.
I downloaded the following repo: https://github.com/ros2/common_interfaces.git
In order to recreate the errors:
download the repo (I choose to clone it in the home);
open Matlab and move to this folder;
give the following command in the command window
ros2genmsg(".")
After this, I get these errors:
>> ros2genmsg(".")
Identifying message files in folder ‘/home/alberto/common_interfaces’..Validating message files in folder ‘/home/alberto/common_interfaces’..Done.
Done.
[0/11] Generating MATLAB interfaces for custom message packages… 0%Error using ()
Key not found.
Error in ros.internal.utilities.checkAndGetCompatibleCompilersLocation (line 73)
matlabInCompatibleCompilerVer = supportedCompilerVersions(matlabLIBSTDCXXVersionNum+1);
Error in ros.internal.ROSProjectBuilder (line 453)
[h.GccLocation, h.GppLocation] = ros.internal.utilities.checkAndGetCompatibleCompilersLocation();
Error in ros.ros2.internal.ColconBuilder (line 26)
h@ros.internal.ROSProjectBuilder(varargin{:});
Error in ros2genmsg (line 278)
builder = ros.ros2.internal.ColconBuilder(genDir, pkgInfos{iPkg}, UseNinja=useNinja, SuppressOutput=suppressOutput);
I tried to recompile ROS packages and even to change compilers’ version, but I can’t find a way out.
I’m working on Ubuntu 22.04, the Matlab version that I’m using is:
MATLAB Version: 23.2.0.2599560 (R2023b) Update 8
Operating System: Linux 6.5.0-45-generic #45~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Mon Jul 15 16:40:02 UTC 2 x86_64
Java Version: Java 1.8.0_202-b08 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
Following, I’m reporting versions of gcc, g++, Python, cmake and ROS:
gcc (Ubuntu 10.5.0-1ubuntu1~22.04) 10.5.0
g++ (Ubuntu 10.5.0-1ubuntu1~22.04) 10.5.0
Python 3.10.12
cmake 3.22.1
ROS2 humble
Thanks for the help. ros2, matlab, custom messages, ros2genmsg, ubuntu2204 MATLAB Answers — New Questions
Conversion to double from cell is not possible
I’m working with a script that simulates a communication channel, and am running into a "Conversion to doube from cell is not possible". The line throing an error works normally in a script, however when I put it inside a custom defined function within my script I get an error.
R is a 1339×17 double
D is a 16384×1 double
N, Npst, and Npre are constants of 1352, 13, and 2, respectively.
How could I cast the cell into a double without having an error being thrown?
Thanks!I’m working with a script that simulates a communication channel, and am running into a "Conversion to doube from cell is not possible". The line throing an error works normally in a script, however when I put it inside a custom defined function within my script I get an error.
R is a 1339×17 double
D is a 16384×1 double
N, Npst, and Npre are constants of 1352, 13, and 2, respectively.
How could I cast the cell into a double without having an error being thrown?
Thanks! I’m working with a script that simulates a communication channel, and am running into a "Conversion to doube from cell is not possible". The line throing an error works normally in a script, however when I put it inside a custom defined function within my script I get an error.
R is a 1339×17 double
D is a 16384×1 double
N, Npst, and Npre are constants of 1352, 13, and 2, respectively.
How could I cast the cell into a double without having an error being thrown?
Thanks! matlab, cell, double, conversion error MATLAB Answers — New Questions
Finding mode of each row in an array of Strings
Currently I have an array with 3 columns and a lot of rows (about 50,000). Each value is a string I essentially want to compare the 3 values in a row and find the most common.
Say my input table looked like the following
Apple Bannana Apple
Cherry Cherry Apple
Mango Mango Mango
My outputs would be
Apple
Cherry
Mango
Please let me know if there is any advice, I have tried mode but it does not work for strings.Currently I have an array with 3 columns and a lot of rows (about 50,000). Each value is a string I essentially want to compare the 3 values in a row and find the most common.
Say my input table looked like the following
Apple Bannana Apple
Cherry Cherry Apple
Mango Mango Mango
My outputs would be
Apple
Cherry
Mango
Please let me know if there is any advice, I have tried mode but it does not work for strings. Currently I have an array with 3 columns and a lot of rows (about 50,000). Each value is a string I essentially want to compare the 3 values in a row and find the most common.
Say my input table looked like the following
Apple Bannana Apple
Cherry Cherry Apple
Mango Mango Mango
My outputs would be
Apple
Cherry
Mango
Please let me know if there is any advice, I have tried mode but it does not work for strings. table, matrices MATLAB Answers — New Questions
How to give range of cells different variable names?
Hello!
I am collecting data from a range of cells from an .xlsx file using the readmatrix function as so:
Datafiles(j).data = readmatrix(Data,’Sheet’,’Report’,’Range’,’M18:N18′,’FileType’,’spreadsheet’);
Then I populate that data into a new excel file like so:
CurrentData = {Datafiles.data}’;
TABLE_Pass = table(CurrentData);
TABLE = vertcat(TABLE_Pass);
Now, my problem is, it spits out the data in 2 columns labeled "CurrentData_1" "CurrentData_2" and I want to specify the name of the second column.
When I create a second variable name, it gives me 4 columns with the information doubled.
Any tips on how to give the data 2 separate variable names?Hello!
I am collecting data from a range of cells from an .xlsx file using the readmatrix function as so:
Datafiles(j).data = readmatrix(Data,’Sheet’,’Report’,’Range’,’M18:N18′,’FileType’,’spreadsheet’);
Then I populate that data into a new excel file like so:
CurrentData = {Datafiles.data}’;
TABLE_Pass = table(CurrentData);
TABLE = vertcat(TABLE_Pass);
Now, my problem is, it spits out the data in 2 columns labeled "CurrentData_1" "CurrentData_2" and I want to specify the name of the second column.
When I create a second variable name, it gives me 4 columns with the information doubled.
Any tips on how to give the data 2 separate variable names? Hello!
I am collecting data from a range of cells from an .xlsx file using the readmatrix function as so:
Datafiles(j).data = readmatrix(Data,’Sheet’,’Report’,’Range’,’M18:N18′,’FileType’,’spreadsheet’);
Then I populate that data into a new excel file like so:
CurrentData = {Datafiles.data}’;
TABLE_Pass = table(CurrentData);
TABLE = vertcat(TABLE_Pass);
Now, my problem is, it spits out the data in 2 columns labeled "CurrentData_1" "CurrentData_2" and I want to specify the name of the second column.
When I create a second variable name, it gives me 4 columns with the information doubled.
Any tips on how to give the data 2 separate variable names? importing excel data MATLAB Answers — New Questions
colorbar graph exceeding matrix values
So I’m plotting a 4D matrix, called Ft, that ranges from 0-1, but when I graph it and add a colorbar, it’s showing 0-2 for physical states 4-15, and (-1)-1for physical state 1-3
physical states 1-3 are 0 for every timestep in the matrix Ft, so that first graph makes sense. Why does the colorbar range change for the other graphs?
Here’s the code for the graphs. Let me know if more code is needed to create the actual Ft matrix. [[ my entire code would be needed in order to create this matrix ]]
%the setup of Ft is Ft(state,est of patch1,est of patch2,timestep)
B = permute(Ft,[2 3 1 4]);
for state= 1:15
figure(state)
sgtitle([‘physical state = ‘ num2str(state)])
time = 1;
subplot(4,5,time)
imagesc(B(:,:,state,time))
title([‘timestep : ‘ num2str(time)])
xlabel(‘est. of patch 2 quality’);
ylabel(‘est. of patch 1 quality’);
set(gca,’ydir’,’normal’)
for time = 2:19
subplot(4,5,time)
imagesc(B(:,:,state,time))
title(num2str(time))
set(gca,’ydir’,’normal’)
for time = 20
subplot(4,5,time)
imagesc(B(:,:,state,time))
title(num2str(time))
set(gca,’ydir’,’normal’)
colormap hot
colorbar
hold on
end
end
endSo I’m plotting a 4D matrix, called Ft, that ranges from 0-1, but when I graph it and add a colorbar, it’s showing 0-2 for physical states 4-15, and (-1)-1for physical state 1-3
physical states 1-3 are 0 for every timestep in the matrix Ft, so that first graph makes sense. Why does the colorbar range change for the other graphs?
Here’s the code for the graphs. Let me know if more code is needed to create the actual Ft matrix. [[ my entire code would be needed in order to create this matrix ]]
%the setup of Ft is Ft(state,est of patch1,est of patch2,timestep)
B = permute(Ft,[2 3 1 4]);
for state= 1:15
figure(state)
sgtitle([‘physical state = ‘ num2str(state)])
time = 1;
subplot(4,5,time)
imagesc(B(:,:,state,time))
title([‘timestep : ‘ num2str(time)])
xlabel(‘est. of patch 2 quality’);
ylabel(‘est. of patch 1 quality’);
set(gca,’ydir’,’normal’)
for time = 2:19
subplot(4,5,time)
imagesc(B(:,:,state,time))
title(num2str(time))
set(gca,’ydir’,’normal’)
for time = 20
subplot(4,5,time)
imagesc(B(:,:,state,time))
title(num2str(time))
set(gca,’ydir’,’normal’)
colormap hot
colorbar
hold on
end
end
end So I’m plotting a 4D matrix, called Ft, that ranges from 0-1, but when I graph it and add a colorbar, it’s showing 0-2 for physical states 4-15, and (-1)-1for physical state 1-3
physical states 1-3 are 0 for every timestep in the matrix Ft, so that first graph makes sense. Why does the colorbar range change for the other graphs?
Here’s the code for the graphs. Let me know if more code is needed to create the actual Ft matrix. [[ my entire code would be needed in order to create this matrix ]]
%the setup of Ft is Ft(state,est of patch1,est of patch2,timestep)
B = permute(Ft,[2 3 1 4]);
for state= 1:15
figure(state)
sgtitle([‘physical state = ‘ num2str(state)])
time = 1;
subplot(4,5,time)
imagesc(B(:,:,state,time))
title([‘timestep : ‘ num2str(time)])
xlabel(‘est. of patch 2 quality’);
ylabel(‘est. of patch 1 quality’);
set(gca,’ydir’,’normal’)
for time = 2:19
subplot(4,5,time)
imagesc(B(:,:,state,time))
title(num2str(time))
set(gca,’ydir’,’normal’)
for time = 20
subplot(4,5,time)
imagesc(B(:,:,state,time))
title(num2str(time))
set(gca,’ydir’,’normal’)
colormap hot
colorbar
hold on
end
end
end graph, colorbar MATLAB Answers — New Questions
code of load flow equation four buses
clc
clear all
cg =[0.86 0 0 0.6];
Pg = [0 0 0 318];
Pd = [50 170 200 80];
Qd = [30.9 105.35 123.94 49.58];
Y = [9.934-1i*44.925, -3.815+1i*19.078, -5.169+1i*25.847, 0
-3.815+1i*19.078, 8.984 – 1i*44.925, 0, -5.169+1i*25.847
-5.169+1i*25.847, 0, 8.192 – 1i*40.965, -3.023 + 1i*15.118
0, -5.169+1i*25.847, -3.023 + 1i*15.118, 8.192 – 1i*40.965];
Pg=sdpvar(1,4);
Qg = sdpvar(1,4);
objective= sum(cg.*Qg)
Qgmin=[-100 0 0 -100];
Qgmax =[100 0 0 100];
Pgmin =[0 0 0 0];
Pgmax =[318 0 0 318];
vang = sdpvar(1,4);
vmag = sdpvar(1,4);
vmin =0.9;
vmax =1.1
Constraints = [];
[Costraints,Pg(1,1)-Pd(1,1)==vmag(1,1)*[vmag(1,1)*Ymag(1,1)*cos(Yang(1,1))+…
vmag(1,2)*Ymag(2,1)*cos(Yang(2,1) + vang(1,1) – vang(1,2))+…
vmag(1,3)*Ymag(3,1)*cos(Yang(3,1) + vang(1,1) – vang(1,3))+…
vmag(1,4)*Ymag(4,1)*cos(Yang(4,1) + vang(1,1) – vang(4))];
[Costraints,Qg(1,1)-Qd(1,1)==(-vmag)(1,1)*[vmag(1,1)*Ymag(1,1)*sin(Yang(1,1))+…
vmag(1,2)*Ymag(2,1)*sin(Yang(2,1) + vang(1,1) – vang(1,2))+…
vmag(1,3)*Ymag(3,1)*sin(Yang(3,1) + vang(1,1) – vang(1,3))+…
vmag(1,4)*Ymag(4,1)*sin(Yang(4,1) + vang(1,1) – vang(4))];
% Constraints = [Constraints,sum(Pg)==sum(Pd)];
% Constraints=[Constraints,Pg(i)-Pd(i)=P(i)]
% Constraints=[Constraints,Qg(i)-Qd(i)=Q(i)]
Constraints = [Constraints,0<=Pg<=318];
Constraints = [Constraints,-100<=Qg<=100];
Constraints = [Constraints, vmin <= vmag];
Constraints = [Constraints, vmag <= vmax];
options = sdpsettings(‘solver’,’gurobi’);
sol = optimize(Constraints,objective,options);
value(objective)
reactive_power=value(Qg)
active_power=value(Pg)
voltage_mag=value(vmag)
voltage_ang=value(vang)clc
clear all
cg =[0.86 0 0 0.6];
Pg = [0 0 0 318];
Pd = [50 170 200 80];
Qd = [30.9 105.35 123.94 49.58];
Y = [9.934-1i*44.925, -3.815+1i*19.078, -5.169+1i*25.847, 0
-3.815+1i*19.078, 8.984 – 1i*44.925, 0, -5.169+1i*25.847
-5.169+1i*25.847, 0, 8.192 – 1i*40.965, -3.023 + 1i*15.118
0, -5.169+1i*25.847, -3.023 + 1i*15.118, 8.192 – 1i*40.965];
Pg=sdpvar(1,4);
Qg = sdpvar(1,4);
objective= sum(cg.*Qg)
Qgmin=[-100 0 0 -100];
Qgmax =[100 0 0 100];
Pgmin =[0 0 0 0];
Pgmax =[318 0 0 318];
vang = sdpvar(1,4);
vmag = sdpvar(1,4);
vmin =0.9;
vmax =1.1
Constraints = [];
[Costraints,Pg(1,1)-Pd(1,1)==vmag(1,1)*[vmag(1,1)*Ymag(1,1)*cos(Yang(1,1))+…
vmag(1,2)*Ymag(2,1)*cos(Yang(2,1) + vang(1,1) – vang(1,2))+…
vmag(1,3)*Ymag(3,1)*cos(Yang(3,1) + vang(1,1) – vang(1,3))+…
vmag(1,4)*Ymag(4,1)*cos(Yang(4,1) + vang(1,1) – vang(4))];
[Costraints,Qg(1,1)-Qd(1,1)==(-vmag)(1,1)*[vmag(1,1)*Ymag(1,1)*sin(Yang(1,1))+…
vmag(1,2)*Ymag(2,1)*sin(Yang(2,1) + vang(1,1) – vang(1,2))+…
vmag(1,3)*Ymag(3,1)*sin(Yang(3,1) + vang(1,1) – vang(1,3))+…
vmag(1,4)*Ymag(4,1)*sin(Yang(4,1) + vang(1,1) – vang(4))];
% Constraints = [Constraints,sum(Pg)==sum(Pd)];
% Constraints=[Constraints,Pg(i)-Pd(i)=P(i)]
% Constraints=[Constraints,Qg(i)-Qd(i)=Q(i)]
Constraints = [Constraints,0<=Pg<=318];
Constraints = [Constraints,-100<=Qg<=100];
Constraints = [Constraints, vmin <= vmag];
Constraints = [Constraints, vmag <= vmax];
options = sdpsettings(‘solver’,’gurobi’);
sol = optimize(Constraints,objective,options);
value(objective)
reactive_power=value(Qg)
active_power=value(Pg)
voltage_mag=value(vmag)
voltage_ang=value(vang) clc
clear all
cg =[0.86 0 0 0.6];
Pg = [0 0 0 318];
Pd = [50 170 200 80];
Qd = [30.9 105.35 123.94 49.58];
Y = [9.934-1i*44.925, -3.815+1i*19.078, -5.169+1i*25.847, 0
-3.815+1i*19.078, 8.984 – 1i*44.925, 0, -5.169+1i*25.847
-5.169+1i*25.847, 0, 8.192 – 1i*40.965, -3.023 + 1i*15.118
0, -5.169+1i*25.847, -3.023 + 1i*15.118, 8.192 – 1i*40.965];
Pg=sdpvar(1,4);
Qg = sdpvar(1,4);
objective= sum(cg.*Qg)
Qgmin=[-100 0 0 -100];
Qgmax =[100 0 0 100];
Pgmin =[0 0 0 0];
Pgmax =[318 0 0 318];
vang = sdpvar(1,4);
vmag = sdpvar(1,4);
vmin =0.9;
vmax =1.1
Constraints = [];
[Costraints,Pg(1,1)-Pd(1,1)==vmag(1,1)*[vmag(1,1)*Ymag(1,1)*cos(Yang(1,1))+…
vmag(1,2)*Ymag(2,1)*cos(Yang(2,1) + vang(1,1) – vang(1,2))+…
vmag(1,3)*Ymag(3,1)*cos(Yang(3,1) + vang(1,1) – vang(1,3))+…
vmag(1,4)*Ymag(4,1)*cos(Yang(4,1) + vang(1,1) – vang(4))];
[Costraints,Qg(1,1)-Qd(1,1)==(-vmag)(1,1)*[vmag(1,1)*Ymag(1,1)*sin(Yang(1,1))+…
vmag(1,2)*Ymag(2,1)*sin(Yang(2,1) + vang(1,1) – vang(1,2))+…
vmag(1,3)*Ymag(3,1)*sin(Yang(3,1) + vang(1,1) – vang(1,3))+…
vmag(1,4)*Ymag(4,1)*sin(Yang(4,1) + vang(1,1) – vang(4))];
% Constraints = [Constraints,sum(Pg)==sum(Pd)];
% Constraints=[Constraints,Pg(i)-Pd(i)=P(i)]
% Constraints=[Constraints,Qg(i)-Qd(i)=Q(i)]
Constraints = [Constraints,0<=Pg<=318];
Constraints = [Constraints,-100<=Qg<=100];
Constraints = [Constraints, vmin <= vmag];
Constraints = [Constraints, vmag <= vmax];
options = sdpsettings(‘solver’,’gurobi’);
sol = optimize(Constraints,objective,options);
value(objective)
reactive_power=value(Qg)
active_power=value(Pg)
voltage_mag=value(vmag)
voltage_ang=value(vang) optimization cost of reactive power MATLAB Answers — New Questions
With Simulink Embedded Coder is it possible to change base workspace variables?
Hi all,
We are developing a standalone application for an inverter using MATLAB/Simulink R2022b with Embedded Coder and TIs package for C2000 development. Our target is TIs Launchpad XL based on the F28379D CPU. My goal is to write a Simulink model that can modify onboard flash during runtime, so when power is lost certain calibration values are maintained.
My model currently implements a Simulink reference example: https://nl.mathworks.com/matlabcentral/fileexchange/92788-simulink-reference-application-examples-for-ti-c2000?s_tid=FX_rc1_behav
This works well, but has a major downside: it is only possible to modify the variables in the matlab workspace and then press Ctrl+d to update them on the target machine while connected in external mode over a serial connection. For our devices in the field, we want to get rid of the mandatory external mode and achieve the same over CAN bus.
I have already tried a bunch of things, but none of them yield the desired behavior:
set_param(): will not work as the calibration values are stored in the MATLAB base workspace. I am not changing blocks.
assignin(): gives the following error: The function <function_name> is not supported for code generation. Declaring the function as extrinsic via coder.extrinsic does not solve the problem.
Parameter Writer block: In R2022b this can only modify variables in the model workspace, so I moved the flash related parameters accordingly. However, somehow the parameter writer block just won’t find them. My guess is that it is because the parameters are defined in the base workspace as a specific storage class based on the tic2000demospkg.Parameter. In the Code Mappings interface they therefore show up as ‘External Parameter Objects’ instead of ‘Model Parameters.’ Based on this article: https://blogs.mathworks.com/simulink/2023/09/27/signals-vs-parameters-in-simulink-and-the-parameter-writer-block/
MATLAB function block: I was hoping the parameters I defined in the base workspace could be called in a global context. Calling the matlab routine from Simulink showed me this is unfortunately not the case. Implicitly the variable was defined in local context and base variable remained unchanged. Inspecting gave clarity on this.
For a fact I know that the variables that I want to tune are defined with the mp_ prefix because I configured the identifier for the custom storage class. However, I don’t understand on how I want to change these.
Is it at all possible to modify variables? Can someone give me a heads up on how?
Thanks a lot in advance!
Kind regards,
RemiHi all,
We are developing a standalone application for an inverter using MATLAB/Simulink R2022b with Embedded Coder and TIs package for C2000 development. Our target is TIs Launchpad XL based on the F28379D CPU. My goal is to write a Simulink model that can modify onboard flash during runtime, so when power is lost certain calibration values are maintained.
My model currently implements a Simulink reference example: https://nl.mathworks.com/matlabcentral/fileexchange/92788-simulink-reference-application-examples-for-ti-c2000?s_tid=FX_rc1_behav
This works well, but has a major downside: it is only possible to modify the variables in the matlab workspace and then press Ctrl+d to update them on the target machine while connected in external mode over a serial connection. For our devices in the field, we want to get rid of the mandatory external mode and achieve the same over CAN bus.
I have already tried a bunch of things, but none of them yield the desired behavior:
set_param(): will not work as the calibration values are stored in the MATLAB base workspace. I am not changing blocks.
assignin(): gives the following error: The function <function_name> is not supported for code generation. Declaring the function as extrinsic via coder.extrinsic does not solve the problem.
Parameter Writer block: In R2022b this can only modify variables in the model workspace, so I moved the flash related parameters accordingly. However, somehow the parameter writer block just won’t find them. My guess is that it is because the parameters are defined in the base workspace as a specific storage class based on the tic2000demospkg.Parameter. In the Code Mappings interface they therefore show up as ‘External Parameter Objects’ instead of ‘Model Parameters.’ Based on this article: https://blogs.mathworks.com/simulink/2023/09/27/signals-vs-parameters-in-simulink-and-the-parameter-writer-block/
MATLAB function block: I was hoping the parameters I defined in the base workspace could be called in a global context. Calling the matlab routine from Simulink showed me this is unfortunately not the case. Implicitly the variable was defined in local context and base variable remained unchanged. Inspecting gave clarity on this.
For a fact I know that the variables that I want to tune are defined with the mp_ prefix because I configured the identifier for the custom storage class. However, I don’t understand on how I want to change these.
Is it at all possible to modify variables? Can someone give me a heads up on how?
Thanks a lot in advance!
Kind regards,
Remi Hi all,
We are developing a standalone application for an inverter using MATLAB/Simulink R2022b with Embedded Coder and TIs package for C2000 development. Our target is TIs Launchpad XL based on the F28379D CPU. My goal is to write a Simulink model that can modify onboard flash during runtime, so when power is lost certain calibration values are maintained.
My model currently implements a Simulink reference example: https://nl.mathworks.com/matlabcentral/fileexchange/92788-simulink-reference-application-examples-for-ti-c2000?s_tid=FX_rc1_behav
This works well, but has a major downside: it is only possible to modify the variables in the matlab workspace and then press Ctrl+d to update them on the target machine while connected in external mode over a serial connection. For our devices in the field, we want to get rid of the mandatory external mode and achieve the same over CAN bus.
I have already tried a bunch of things, but none of them yield the desired behavior:
set_param(): will not work as the calibration values are stored in the MATLAB base workspace. I am not changing blocks.
assignin(): gives the following error: The function <function_name> is not supported for code generation. Declaring the function as extrinsic via coder.extrinsic does not solve the problem.
Parameter Writer block: In R2022b this can only modify variables in the model workspace, so I moved the flash related parameters accordingly. However, somehow the parameter writer block just won’t find them. My guess is that it is because the parameters are defined in the base workspace as a specific storage class based on the tic2000demospkg.Parameter. In the Code Mappings interface they therefore show up as ‘External Parameter Objects’ instead of ‘Model Parameters.’ Based on this article: https://blogs.mathworks.com/simulink/2023/09/27/signals-vs-parameters-in-simulink-and-the-parameter-writer-block/
MATLAB function block: I was hoping the parameters I defined in the base workspace could be called in a global context. Calling the matlab routine from Simulink showed me this is unfortunately not the case. Implicitly the variable was defined in local context and base variable remained unchanged. Inspecting gave clarity on this.
For a fact I know that the variables that I want to tune are defined with the mp_ prefix because I configured the identifier for the custom storage class. However, I don’t understand on how I want to change these.
Is it at all possible to modify variables? Can someone give me a heads up on how?
Thanks a lot in advance!
Kind regards,
Remi ti, embedded coder, simulink, variables, code generation, matlab code MATLAB Answers — New Questions
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