K_UL and Kcel are matrices.
M1=4;
M2=4;
nK = size(K_UL,2);
Us=zeros(ndof,nK);
for x=-M1:1:0
for y=-M2:1:M2-1
fx=1i*pi*x/M1;
fy=1i*pi*y/M2;
u=Myfun(Kcel,M1,M2,fx,fy);
Us = Us+(1+(x>-M1&x
Thanks for your suggestion Harald Kirchsteiger
But, here I am using a function Myfun inside the loop. Which depends on a matrix (Kcell). Can we use such type of predefine function inside the parallel loop?
I would start from vectorizing your code, vectorization often works better than parfor
https://stackoverflow.com/questions/14035365/why-does-vectorized-code-run-faster-than-for-loops-in-matlab
The vector version (needs testing) is as follows:
fx=1i*pi*[-M1:1:0]/M1;
fy=1i*pi*[-M2:1:M2-1]/M2;
calculate values of
1+(x>-M1&x
As a primer for the further work please consider the following code prepared for testing of a single element from your loop:
tic
end
toc
time_loop=toc
time_vec=toc
speedup=time_loop/time_vec
The speedup is of the order of
5 for M1=4, M2=4
260 for M1=1000, M2=500
19300 for M1=10000, M2=5000
A crude extract of fungal culture using EtOH was subjected to column and TLC and partially purified compound was obtained. UV vis spectrum of the compound/s has max absorbance at 218nm. The...
11 August 2024 9,801 2 View
I am attempting to conjugate PEG to an amino acid at the C-terminus, for the purposes of producing nanoparticles. I have been told that PEG modified with amine groups can be used for this purpose,...
31 July 2024 2,033 1 View
The threshold voltage (Vth) of a MOS device plays a crucial role for its operation. At the same time, noise is an intrinsic factor. So how noise (flicker or thermal) change with the change in...
29 July 2024 3,246 0 View
Am trying to develop a lesson/lab to determine and compare antioxidant properties of soybeans of various colors. Preference would be low tech and low cost. Any assistance is greatly appreciated.
25 July 2024 7,498 2 View
In running two-dimensional gel electrophoresis on bacterial protein, some spots that appear to match a protein sequence have a significantly more acidic isoelectric point than the calculated pI....
24 July 2024 8,076 3 View
If you don't understand my question let me know
21 July 2024 563 1 View
Their is new research published in the biological control journal, and I am one of the authors. I want to add it to my account at researchgare. How can I do this?
21 July 2024 7,545 0 View
I am working on scale development in behavioral finance by undertaking a mixed-method approach using the exploratory sequential design. The phenomenon has diverse meanings in existing literature...
20 July 2024 9,153 11 View
I need to convert Available phosphorus into total phosphorus
18 July 2024 6,799 3 View
I have read that it is better to use other research methods alongside document analysis for triangulation, although it can also be used as a stand-alone method.
18 July 2024 4,218 0 View
I am new to Micromechanics and having similar problem with understanding the implementation of the formula's. I would appreciate if anyone can guide me on how to go about getting a scalar value...
30 July 2024 969 0 View
My photocatalyst from solid waste red med. Dye is methylene blue My all parameter study is showing zero order. How to prove it further that the reaction in zero order?
29 July 2024 7,404 1 View
Please, what is the memory consumption of the Matlab function quad tree decomposition procedure [S = qtdecomp(I)] with respect to the input set I?
27 July 2024 5,455 2 View
Hello, I am a research scholar currently working on a project involving image segmentation, and I am interested in using differential evolution for this purpose . I would greatly appreciate it if...
25 July 2024 9,926 1 View
Hi everyone, I am working on a curved domain in which a ship is situated in the middle (geometry is given below). In my understanding the general fluid flow is parallel to the x axis from inlet to...
25 July 2024 9,058 4 View
I know the difference between instrumental LOD and method LOD but my query is - in case of any sample whose concentration is zero or not detected by the instrumental LOD, is it possible to get...
24 July 2024 6,592 5 View
Hello!!! I want to implement the Swerling characteristics functions (CF) directly in MATLAB without using its Fourier integral pairs...the Swerling CFs are actually Laplace Transform of the signal...
23 July 2024 4,925 1 View
Currently I need to calculate detection probabilities (PD) from radar cross section (RCS) data. Beta distribution parameters for this RCS data are calculated and will be used in Swerling0...
22 July 2024 868 0 View
In cases where the rotational of the magnetic field H is zero, we can define this field as the gradient of a scalar function defined as the magnetic scalar potential (similar to the electric...
21 July 2024 9,633 4 View
Actually, I'm having trouble implementing the plot of the flutter region for the whirl prop system with 2 DOF (Influences of structural damping and propeller—pivot point distance on whirl flutter...
21 July 2024 5,047 2 View