Month: October 2024
Question about ‘get-childitem | rename-item’ have a bug
If i have 20 .txt file 。
1..20 | foreach-object {new-item -type file .$_.txt}
get-childitem | rename-item -newname {“newfile$_”}
You will get picture 1 .
But if you have 50 .txt file . you will have a bug.
1..50 | foreach-object {new-item -type file .$_.txt}
get-childitem | rename-item -newname {“newfile$_”}
Look at picture 2.
why ??
If i have 20 .txt file 。 1..20 | foreach-object {new-item -type file .$_.txt}
get-childitem | rename-item -newname {“newfile$_”} You will get picture 1 .But if you have 50 .txt file . you will have a bug. 1..50 | foreach-object {new-item -type file .$_.txt}
get-childitem | rename-item -newname {“newfile$_”} Look at picture 2. why ?? Read More
Exporting a code from Maple to Matlab
I use Matlab for numerical calculations.
But I use Maple for symbolic calculations and after the calculations I usually get piecewise functions in my maple codes.
I think the 3d plots in Matlab is very attractive more than Maple plots. So, I want to export piecewise functions in maple to a Matlab code in order to utilize advantages of plots of Matlab.
MAPLE CODE
restart:
u:=1/(1. + exp(x))^2 + 1/(1. + exp(-5.*t))^2 – 0.2500000000 + x*(1/(1. + exp(1 – 5*t))^2 – 1./((1. + exp(-5*t))^2) + 0.1776705118 + 0.0415431679756514*piecewise(0. <= t and t <= 0.5000000000, 1.732050808, 0.) + 0.00922094377856479*piecewise(0. <= t and t <= 0.5000000000, 30.98386677*t – 7.745966692, 0.) + 0.0603742508215732*piecewise(0.5000000000 <= t and t <= 1., 1.732050808, 0.) – 0.00399645630498528*piecewise(0.5000000000 <= t and t <= 1., 30.98386677*t – 23.23790008, 0.)) + (-0.00243051684581302*piecewise(0. <= x and x <= 0.5000000000, 1.732050808, 0.) – 0.000809061198761621*piecewise(0. <= x and x <= 0.5000000000, 30.98386677*x – 7.745966692, 0.) – 0.0152377552205917*piecewise(0.5000000000 <= x and x <= 1., 1.732050808, 0.) – 0.00195593427342862*piecewise(0.5000000000 <= x and x <= 1., 30.98386677*x – 23.23790008, 0.))*piecewise(0. <= t and t <= 0.5000000000, 1.732050808, 0.) + (-0.000433590063316381*piecewise(0. <= x and x <= 0.5000000000, 1.732050808, 0.) – 0.000146112803263678*piecewise(0. <= x and x <= 0.5000000000, 30.98386677*x – 7.745966692, 0.) – 0.00319022339097685*piecewise(0.5000000000 <= x and x <= 1., 1.732050808, 0.) – 0.000477063086307787*piecewise(0.5000000000 <= x and x <= 1., 30.98386677*x – 23.23790008, 0.))*piecewise(0. <= t and t <= 0.5000000000, 30.98386677*t – 7.745966692, 0.) + (-0.00276114805649180*piecewise(0. <= x and x <= 0.5000000000, 1.732050808, 0.) – 0.000933166016624500*piecewise(0. <= x and x <= 0.5000000000, 30.98386677*x – 7.745966692, 0.) – 0.0207984584912892*piecewise(0.5000000000 <= x and x <= 1., 1.732050808, 0.) – 0.00314360556336114*piecewise(0.5000000000 <= x and x <= 1., 30.98386677*x – 23.23790008, 0.))*piecewise(0.5000000000 <= t and t <= 1., 1.732050808, 0.) + (0.000172746997599710*piecewise(0. <= x and x <= 0.5000000000, 1.732050808, 0.) + 0.0000586775450031145*piecewise(0. <= x and x <= 0.5000000000, 30.98386677*x – 7.745966692, 0.) + 0.00136190009033518*piecewise(0.5000000000 <= x and x <= 1., 1.732050808, 0.) + 0.000211410172315387*piecewise(0.5000000000 <= x and x <= 1., 30.98386677*x – 23.23790008, 0.))*piecewise(0.5000000000 <= t and t <= 1., 30.98386677*t – 23.23790008, 0.):
>
plot3d( u,
x=0..1,
t=0..1,
style=surface,
axes=boxed,
colorscheme=[yellow, red]
);
We can transform a maple code to Matlab code by using
with(CodeGeneration):
Matlab(u,resultname="w");
. But The code can’ t properly transform to Matlab code.
Could you help me plsI use Matlab for numerical calculations.
But I use Maple for symbolic calculations and after the calculations I usually get piecewise functions in my maple codes.
I think the 3d plots in Matlab is very attractive more than Maple plots. So, I want to export piecewise functions in maple to a Matlab code in order to utilize advantages of plots of Matlab.
MAPLE CODE
restart:
u:=1/(1. + exp(x))^2 + 1/(1. + exp(-5.*t))^2 – 0.2500000000 + x*(1/(1. + exp(1 – 5*t))^2 – 1./((1. + exp(-5*t))^2) + 0.1776705118 + 0.0415431679756514*piecewise(0. <= t and t <= 0.5000000000, 1.732050808, 0.) + 0.00922094377856479*piecewise(0. <= t and t <= 0.5000000000, 30.98386677*t – 7.745966692, 0.) + 0.0603742508215732*piecewise(0.5000000000 <= t and t <= 1., 1.732050808, 0.) – 0.00399645630498528*piecewise(0.5000000000 <= t and t <= 1., 30.98386677*t – 23.23790008, 0.)) + (-0.00243051684581302*piecewise(0. <= x and x <= 0.5000000000, 1.732050808, 0.) – 0.000809061198761621*piecewise(0. <= x and x <= 0.5000000000, 30.98386677*x – 7.745966692, 0.) – 0.0152377552205917*piecewise(0.5000000000 <= x and x <= 1., 1.732050808, 0.) – 0.00195593427342862*piecewise(0.5000000000 <= x and x <= 1., 30.98386677*x – 23.23790008, 0.))*piecewise(0. <= t and t <= 0.5000000000, 1.732050808, 0.) + (-0.000433590063316381*piecewise(0. <= x and x <= 0.5000000000, 1.732050808, 0.) – 0.000146112803263678*piecewise(0. <= x and x <= 0.5000000000, 30.98386677*x – 7.745966692, 0.) – 0.00319022339097685*piecewise(0.5000000000 <= x and x <= 1., 1.732050808, 0.) – 0.000477063086307787*piecewise(0.5000000000 <= x and x <= 1., 30.98386677*x – 23.23790008, 0.))*piecewise(0. <= t and t <= 0.5000000000, 30.98386677*t – 7.745966692, 0.) + (-0.00276114805649180*piecewise(0. <= x and x <= 0.5000000000, 1.732050808, 0.) – 0.000933166016624500*piecewise(0. <= x and x <= 0.5000000000, 30.98386677*x – 7.745966692, 0.) – 0.0207984584912892*piecewise(0.5000000000 <= x and x <= 1., 1.732050808, 0.) – 0.00314360556336114*piecewise(0.5000000000 <= x and x <= 1., 30.98386677*x – 23.23790008, 0.))*piecewise(0.5000000000 <= t and t <= 1., 1.732050808, 0.) + (0.000172746997599710*piecewise(0. <= x and x <= 0.5000000000, 1.732050808, 0.) + 0.0000586775450031145*piecewise(0. <= x and x <= 0.5000000000, 30.98386677*x – 7.745966692, 0.) + 0.00136190009033518*piecewise(0.5000000000 <= x and x <= 1., 1.732050808, 0.) + 0.000211410172315387*piecewise(0.5000000000 <= x and x <= 1., 30.98386677*x – 23.23790008, 0.))*piecewise(0.5000000000 <= t and t <= 1., 30.98386677*t – 23.23790008, 0.):
>
plot3d( u,
x=0..1,
t=0..1,
style=surface,
axes=boxed,
colorscheme=[yellow, red]
);
We can transform a maple code to Matlab code by using
with(CodeGeneration):
Matlab(u,resultname="w");
. But The code can’ t properly transform to Matlab code.
Could you help me pls I use Matlab for numerical calculations.
But I use Maple for symbolic calculations and after the calculations I usually get piecewise functions in my maple codes.
I think the 3d plots in Matlab is very attractive more than Maple plots. So, I want to export piecewise functions in maple to a Matlab code in order to utilize advantages of plots of Matlab.
MAPLE CODE
restart:
u:=1/(1. + exp(x))^2 + 1/(1. + exp(-5.*t))^2 – 0.2500000000 + x*(1/(1. + exp(1 – 5*t))^2 – 1./((1. + exp(-5*t))^2) + 0.1776705118 + 0.0415431679756514*piecewise(0. <= t and t <= 0.5000000000, 1.732050808, 0.) + 0.00922094377856479*piecewise(0. <= t and t <= 0.5000000000, 30.98386677*t – 7.745966692, 0.) + 0.0603742508215732*piecewise(0.5000000000 <= t and t <= 1., 1.732050808, 0.) – 0.00399645630498528*piecewise(0.5000000000 <= t and t <= 1., 30.98386677*t – 23.23790008, 0.)) + (-0.00243051684581302*piecewise(0. <= x and x <= 0.5000000000, 1.732050808, 0.) – 0.000809061198761621*piecewise(0. <= x and x <= 0.5000000000, 30.98386677*x – 7.745966692, 0.) – 0.0152377552205917*piecewise(0.5000000000 <= x and x <= 1., 1.732050808, 0.) – 0.00195593427342862*piecewise(0.5000000000 <= x and x <= 1., 30.98386677*x – 23.23790008, 0.))*piecewise(0. <= t and t <= 0.5000000000, 1.732050808, 0.) + (-0.000433590063316381*piecewise(0. <= x and x <= 0.5000000000, 1.732050808, 0.) – 0.000146112803263678*piecewise(0. <= x and x <= 0.5000000000, 30.98386677*x – 7.745966692, 0.) – 0.00319022339097685*piecewise(0.5000000000 <= x and x <= 1., 1.732050808, 0.) – 0.000477063086307787*piecewise(0.5000000000 <= x and x <= 1., 30.98386677*x – 23.23790008, 0.))*piecewise(0. <= t and t <= 0.5000000000, 30.98386677*t – 7.745966692, 0.) + (-0.00276114805649180*piecewise(0. <= x and x <= 0.5000000000, 1.732050808, 0.) – 0.000933166016624500*piecewise(0. <= x and x <= 0.5000000000, 30.98386677*x – 7.745966692, 0.) – 0.0207984584912892*piecewise(0.5000000000 <= x and x <= 1., 1.732050808, 0.) – 0.00314360556336114*piecewise(0.5000000000 <= x and x <= 1., 30.98386677*x – 23.23790008, 0.))*piecewise(0.5000000000 <= t and t <= 1., 1.732050808, 0.) + (0.000172746997599710*piecewise(0. <= x and x <= 0.5000000000, 1.732050808, 0.) + 0.0000586775450031145*piecewise(0. <= x and x <= 0.5000000000, 30.98386677*x – 7.745966692, 0.) + 0.00136190009033518*piecewise(0.5000000000 <= x and x <= 1., 1.732050808, 0.) + 0.000211410172315387*piecewise(0.5000000000 <= x and x <= 1., 30.98386677*x – 23.23790008, 0.))*piecewise(0.5000000000 <= t and t <= 1., 30.98386677*t – 23.23790008, 0.):
>
plot3d( u,
x=0..1,
t=0..1,
style=surface,
axes=boxed,
colorscheme=[yellow, red]
);
We can transform a maple code to Matlab code by using
with(CodeGeneration):
Matlab(u,resultname="w");
. But The code can’ t properly transform to Matlab code.
Could you help me pls maple, matlab MATLAB Answers — New Questions
Connect to Outlook not available in Modern SharePoint
Our company has been using this function for years and it has been a crucial part of our SharePoint and Outlook experience. Since we’ve moved from Classic to Modern SharePoint, the option is no longer there for our contact lists. Is there any way to get it back? I’ve even tried adding the ‘contacts’ app to one of the site collections that is still classic and the option is still not there. (also set the classic site list to show in the ‘classic experience).
Thank you, in advance.
~ L
Our company has been using this function for years and it has been a crucial part of our SharePoint and Outlook experience. Since we’ve moved from Classic to Modern SharePoint, the option is no longer there for our contact lists. Is there any way to get it back? I’ve even tried adding the ‘contacts’ app to one of the site collections that is still classic and the option is still not there. (also set the classic site list to show in the ‘classic experience). Thank you, in advance.~ L Read More
Benefits of having a hybrid SharePoint between (SharePoint online & SharePoint onpremises)
I am working on a new project where the customer has E5 licenses. So, they have 3 options for using SharePoint: –
Online onlyOn-premisesHybrid
This is the first time the customer will be using SharePoint, and we need to build this basic setup for phase one: –
Home site for all users, to access Company-wide News/Announcements & company-wide Templates/Documents.The home site will have links to each department site.Each department site will have its own News/Announcement and Templates/Documents.We will start by 3 departments: HR, IT & Finance.
We need to decide if we should go with SharePoint Online only, on-premises only or build a hybrid environment?
I am suggesting these Points/Approach:-
Since we need a basic setup and there are not any compliance requirements to use on-premises, we can do all the above inside SharePoint Online.in the future if certain departments have specific compliance requirements, we can set up the SharePoint subscription server edition and build a hybrid environment with the available online
Can anyone advice on which approach to follow? and does my suggested approach makes sense?
Thanks
I am working on a new project where the customer has E5 licenses. So, they have 3 options for using SharePoint: -Online onlyOn-premisesHybridThis is the first time the customer will be using SharePoint, and we need to build this basic setup for phase one: -Home site for all users, to access Company-wide News/Announcements & company-wide Templates/Documents.The home site will have links to each department site.Each department site will have its own News/Announcement and Templates/Documents.We will start by 3 departments: HR, IT & Finance.We need to decide if we should go with SharePoint Online only, on-premises only or build a hybrid environment?I am suggesting these Points/Approach:-Since we need a basic setup and there are not any compliance requirements to use on-premises, we can do all the above inside SharePoint Online.in the future if certain departments have specific compliance requirements, we can set up the SharePoint subscription server edition and build a hybrid environment with the available onlineCan anyone advice on which approach to follow? and does my suggested approach makes sense?Thanks Read More
Shuffle method on custom datastore written for a single binary file
I am writing a custom datastore and am seeking some assistance. My datasets consist of stacks of 2D images (frames) stored sequentially in a single binary file. While it’s very straight forward to read in the binary stream using fread, each full dataset itself can easily be on the order of 50+ GB, making it infeasible to load everything at once on the hardware equipment I have available. This was my original motivation for exploring the use of a datastore.
In addition to the need for managing out-of-memory data, I also would like to partition the data into chunks where each chunk contains a random collection of frames from this binary file. If possible, I would like to use the shuffle method for the datastore superclass to accomplish this, as this seems to be the "proper" approach (although I’m very open to alternatives).
The problem I am currently having is that the default datastore shuffle method appears only to randomize the order of files in a datastore directory. However, since I only have one (very large) binary file, it doesn’t seem to "shuffle" anything at all – running readall on the shuffled datastore returns the exact same data as if I were to run it on the original datastore. I would rather need it to "shuffle" the frames within the binary file. Presumably, if I were to save each frame as an individual image file on disk, then I could get this to work using imageDatastore or fileDatastore. However, then I would have to go through all my files and save them to disk again as individual files, which seems rather silly.
I have written code to load a chunk of the data manually by jumping around the file using fseek. However, then I lose access to the datastore object as well as its built-in functionality. So I thought I would throw this question out there to see if anyone could offer some help.I am writing a custom datastore and am seeking some assistance. My datasets consist of stacks of 2D images (frames) stored sequentially in a single binary file. While it’s very straight forward to read in the binary stream using fread, each full dataset itself can easily be on the order of 50+ GB, making it infeasible to load everything at once on the hardware equipment I have available. This was my original motivation for exploring the use of a datastore.
In addition to the need for managing out-of-memory data, I also would like to partition the data into chunks where each chunk contains a random collection of frames from this binary file. If possible, I would like to use the shuffle method for the datastore superclass to accomplish this, as this seems to be the "proper" approach (although I’m very open to alternatives).
The problem I am currently having is that the default datastore shuffle method appears only to randomize the order of files in a datastore directory. However, since I only have one (very large) binary file, it doesn’t seem to "shuffle" anything at all – running readall on the shuffled datastore returns the exact same data as if I were to run it on the original datastore. I would rather need it to "shuffle" the frames within the binary file. Presumably, if I were to save each frame as an individual image file on disk, then I could get this to work using imageDatastore or fileDatastore. However, then I would have to go through all my files and save them to disk again as individual files, which seems rather silly.
I have written code to load a chunk of the data manually by jumping around the file using fseek. However, then I lose access to the datastore object as well as its built-in functionality. So I thought I would throw this question out there to see if anyone could offer some help. I am writing a custom datastore and am seeking some assistance. My datasets consist of stacks of 2D images (frames) stored sequentially in a single binary file. While it’s very straight forward to read in the binary stream using fread, each full dataset itself can easily be on the order of 50+ GB, making it infeasible to load everything at once on the hardware equipment I have available. This was my original motivation for exploring the use of a datastore.
In addition to the need for managing out-of-memory data, I also would like to partition the data into chunks where each chunk contains a random collection of frames from this binary file. If possible, I would like to use the shuffle method for the datastore superclass to accomplish this, as this seems to be the "proper" approach (although I’m very open to alternatives).
The problem I am currently having is that the default datastore shuffle method appears only to randomize the order of files in a datastore directory. However, since I only have one (very large) binary file, it doesn’t seem to "shuffle" anything at all – running readall on the shuffled datastore returns the exact same data as if I were to run it on the original datastore. I would rather need it to "shuffle" the frames within the binary file. Presumably, if I were to save each frame as an individual image file on disk, then I could get this to work using imageDatastore or fileDatastore. However, then I would have to go through all my files and save them to disk again as individual files, which seems rather silly.
I have written code to load a chunk of the data manually by jumping around the file using fseek. However, then I lose access to the datastore object as well as its built-in functionality. So I thought I would throw this question out there to see if anyone could offer some help. datastore, binary, shuffle, image stack, big data, large file, data import MATLAB Answers — New Questions
i need help code worksheet to userform without type in manually.
I have a worksheet called Bye weeks. I also have a user form called NFL Scores form. I help create VBA code to look at the bye week worksheet and also look on user form team bye which match on worksheet and user. form.
Thanks You
I have a worksheet called Bye weeks. I also have a user form called NFL Scores form. I help create VBA code to look at the bye week worksheet and also look on user form team bye which match on worksheet and user. form. Thanks You Read More
Hi, Why the error curve is not the subtraction of the Vin and Vout?
Post Content Post Content adc MATLAB Answers — New Questions
New Windows 11 update crashing my computer
I just installed the newest Windows 11 update on my Asus Vivobook S410 and now it keeps crashing. I’ve tried restarting it and uninstalling the update. Restarting does nothing. When I try to uninstall the update, it says that there is a problem resetting the PC. What do I do?
I just installed the newest Windows 11 update on my Asus Vivobook S410 and now it keeps crashing. I’ve tried restarting it and uninstalling the update. Restarting does nothing. When I try to uninstall the update, it says that there is a problem resetting the PC. What do I do? Read More
How to get the longest consecutive values in a column vector and the position at which it starts
Hello,
Suppose i have a single column vector A’=[0 0 0 1 0 1 1 1 0 0 0 0 0 1 1 1 1 1 1 1 1 1]
I only want the longest consecutive values of 1’s and display only that.
I’d really appreciate any help!Hello,
Suppose i have a single column vector A’=[0 0 0 1 0 1 1 1 0 0 0 0 0 1 1 1 1 1 1 1 1 1]
I only want the longest consecutive values of 1’s and display only that.
I’d really appreciate any help! Hello,
Suppose i have a single column vector A’=[0 0 0 1 0 1 1 1 0 0 0 0 0 1 1 1 1 1 1 1 1 1]
I only want the longest consecutive values of 1’s and display only that.
I’d really appreciate any help! consecutive, longest, identical MATLAB Answers — New Questions
Why is my hamming window and rectangular window values the same for sigma_omega when I make L = 21?
I have this code that produces the same value for both the hamming window and the rectangular window when I try to solve for sigma_omega for given L (L = 21, 51, and 101). For the sake of the code I will only be testing for L = 21.
Here is the equation for sigma_omega:
Here is the code I have:
% Set window length L = 21
L = 21;
% Generate rectangular and Hamming windows
rect_window = window(@rectwin, L);
hamming_window = window(@hamming, L);
% Calculate the frequency spread for each window
sigma_omega_rect = calc_freq_spread(rect_window);
sigma_omega_hamming = calc_freq_spread(hamming_window);
% Display the frequency spread for rectangular and Hamming windows for L = 21
fprintf(‘L = 21: sigma_omega (Rectangular) = %.4fn’, sigma_omega_rect);
fprintf(‘L = 21: sigma_omega (Hamming) = %.4fnn’, sigma_omega_hamming);
% Function to calculate frequency spread
function sigma_omega = calc_freq_spread(w)
L = length(w);
% Calculate DTFT (using FFT as an approximation)
N = 1024; % Length of the FFT to improve frequency resolution
W = fft(w, N); % Compute the FFT of the window
% Frequency axis (normalized frequency ω from -π to π)
omega_hat = linspace(-pi, pi, N);
% Magnitude squared of DTFT
W_mag_sq = abs(W).^2;
% Numerator: Sum of ω^2 * |W(e^jω)|^2 (approximating the integral)
numerator = sum((omega_hat.^2) .* W_mag_sq);
% Denominator: Sum of |W(e^jω)|^2 (approximating the integral)
denominator = sum(W_mag_sq);
% Calculate the frequency spread (σ_ω)
sigma_omega = sqrt(sum(numerator) / sum(denominator)); % Summing the whole thing to a scalar
end
My question is what is wrong with my code for producing the same output? The same exact output for both rectangular and hamming window is also the same 58.0983 when I change L to either 51 or 101. Please advise.
Thank you.I have this code that produces the same value for both the hamming window and the rectangular window when I try to solve for sigma_omega for given L (L = 21, 51, and 101). For the sake of the code I will only be testing for L = 21.
Here is the equation for sigma_omega:
Here is the code I have:
% Set window length L = 21
L = 21;
% Generate rectangular and Hamming windows
rect_window = window(@rectwin, L);
hamming_window = window(@hamming, L);
% Calculate the frequency spread for each window
sigma_omega_rect = calc_freq_spread(rect_window);
sigma_omega_hamming = calc_freq_spread(hamming_window);
% Display the frequency spread for rectangular and Hamming windows for L = 21
fprintf(‘L = 21: sigma_omega (Rectangular) = %.4fn’, sigma_omega_rect);
fprintf(‘L = 21: sigma_omega (Hamming) = %.4fnn’, sigma_omega_hamming);
% Function to calculate frequency spread
function sigma_omega = calc_freq_spread(w)
L = length(w);
% Calculate DTFT (using FFT as an approximation)
N = 1024; % Length of the FFT to improve frequency resolution
W = fft(w, N); % Compute the FFT of the window
% Frequency axis (normalized frequency ω from -π to π)
omega_hat = linspace(-pi, pi, N);
% Magnitude squared of DTFT
W_mag_sq = abs(W).^2;
% Numerator: Sum of ω^2 * |W(e^jω)|^2 (approximating the integral)
numerator = sum((omega_hat.^2) .* W_mag_sq);
% Denominator: Sum of |W(e^jω)|^2 (approximating the integral)
denominator = sum(W_mag_sq);
% Calculate the frequency spread (σ_ω)
sigma_omega = sqrt(sum(numerator) / sum(denominator)); % Summing the whole thing to a scalar
end
My question is what is wrong with my code for producing the same output? The same exact output for both rectangular and hamming window is also the same 58.0983 when I change L to either 51 or 101. Please advise.
Thank you. I have this code that produces the same value for both the hamming window and the rectangular window when I try to solve for sigma_omega for given L (L = 21, 51, and 101). For the sake of the code I will only be testing for L = 21.
Here is the equation for sigma_omega:
Here is the code I have:
% Set window length L = 21
L = 21;
% Generate rectangular and Hamming windows
rect_window = window(@rectwin, L);
hamming_window = window(@hamming, L);
% Calculate the frequency spread for each window
sigma_omega_rect = calc_freq_spread(rect_window);
sigma_omega_hamming = calc_freq_spread(hamming_window);
% Display the frequency spread for rectangular and Hamming windows for L = 21
fprintf(‘L = 21: sigma_omega (Rectangular) = %.4fn’, sigma_omega_rect);
fprintf(‘L = 21: sigma_omega (Hamming) = %.4fnn’, sigma_omega_hamming);
% Function to calculate frequency spread
function sigma_omega = calc_freq_spread(w)
L = length(w);
% Calculate DTFT (using FFT as an approximation)
N = 1024; % Length of the FFT to improve frequency resolution
W = fft(w, N); % Compute the FFT of the window
% Frequency axis (normalized frequency ω from -π to π)
omega_hat = linspace(-pi, pi, N);
% Magnitude squared of DTFT
W_mag_sq = abs(W).^2;
% Numerator: Sum of ω^2 * |W(e^jω)|^2 (approximating the integral)
numerator = sum((omega_hat.^2) .* W_mag_sq);
% Denominator: Sum of |W(e^jω)|^2 (approximating the integral)
denominator = sum(W_mag_sq);
% Calculate the frequency spread (σ_ω)
sigma_omega = sqrt(sum(numerator) / sum(denominator)); % Summing the whole thing to a scalar
end
My question is what is wrong with my code for producing the same output? The same exact output for both rectangular and hamming window is also the same 58.0983 when I change L to either 51 or 101. Please advise.
Thank you. digital signal processing, frequency, mathematics MATLAB Answers — New Questions
windows explorer navigation issue
Dears,
I have an issue with windows explorer that has been there for a long time even with 24h2, related to opening the windows explorer using windows + e, after opening the file explorer I use the arrow keys for navigation am not able to navigate to e.g. D:// driver using arrows in the following cases
– if i opened windows media player then clicked windows + e
– if i opened windows settings windows + i , then after it click windows + e
it seems that windows explorer lose focus if it was running at the top of these apps, I need to click on the windows explorer active window in order to regain the focus.
very annoying issue hope it will be fixed soon, it keeps me from upgrading to windows 11.
Thanks
Dears, I have an issue with windows explorer that has been there for a long time even with 24h2, related to opening the windows explorer using windows + e, after opening the file explorer I use the arrow keys for navigation am not able to navigate to e.g. D:// driver using arrows in the following cases- if i opened windows media player then clicked windows + e – if i opened windows settings windows + i , then after it click windows + e it seems that windows explorer lose focus if it was running at the top of these apps, I need to click on the windows explorer active window in order to regain the focus.very annoying issue hope it will be fixed soon, it keeps me from upgrading to windows 11.Thanks Read More
Code generation information file does not exist
Hello everyone
After I made the configuration of the matlab and simulink packages for Arduino,and when I connected my arduino to my laptop I got this error when I clicked on run in the simulink program in the part of hardware :
Starting build procedure for: ControlMotor Página de códigos activa: 1252 gmake: wrapper.mk: No such file or directory gmake: *** No rule to make target `wrapper.mk’. Stop. The make command returned an error of 2 ### Build procedure for ControlMotor aborted due to an error.
And also I got this last one:
Top model targets built: Model Action Rebuild Reason ======================================================================== ControlMotor Failed Code generation information file does not exist. 0 of 1 models built (0 models alr
Honestly I don’t know how to fix those errors .
Best regardsHello everyone
After I made the configuration of the matlab and simulink packages for Arduino,and when I connected my arduino to my laptop I got this error when I clicked on run in the simulink program in the part of hardware :
Starting build procedure for: ControlMotor Página de códigos activa: 1252 gmake: wrapper.mk: No such file or directory gmake: *** No rule to make target `wrapper.mk’. Stop. The make command returned an error of 2 ### Build procedure for ControlMotor aborted due to an error.
And also I got this last one:
Top model targets built: Model Action Rebuild Reason ======================================================================== ControlMotor Failed Code generation information file does not exist. 0 of 1 models built (0 models alr
Honestly I don’t know how to fix those errors .
Best regards Hello everyone
After I made the configuration of the matlab and simulink packages for Arduino,and when I connected my arduino to my laptop I got this error when I clicked on run in the simulink program in the part of hardware :
Starting build procedure for: ControlMotor Página de códigos activa: 1252 gmake: wrapper.mk: No such file or directory gmake: *** No rule to make target `wrapper.mk’. Stop. The make command returned an error of 2 ### Build procedure for ControlMotor aborted due to an error.
And also I got this last one:
Top model targets built: Model Action Rebuild Reason ======================================================================== ControlMotor Failed Code generation information file does not exist. 0 of 1 models built (0 models alr
Honestly I don’t know how to fix those errors .
Best regards wrapper.mk MATLAB Answers — New Questions
Azure Innovators Hub Presents: Azure IaC
Join us on Monday October 21st at 7.00 p.m. GMT+3 for a duo of Live Sessions on Azure IaC, DevOps and Infrastructure Management !
The Event is hosted by Azure Innovators Hub a Meetup child of Microsoft Tech Groups Community
Christos Galanopoulos a Microsoft MVP will take us on a journey into IaC and Policy Driven Governance with OPA and we will have the opportunity to see actual real world scenarios with Terraform & Azure DevOps.
George Markou a Microsoft MVP Alumni will showcase Image provisoning with Packer for Azure Custom Images and the automation capabilities with consistency and reliability for our Infrastructure.
The Event is for everyone interested in Azure Technologies, Infrastructure as Code and Enterprise level automation and Governance, as well as Technology Professionals starting their Cloud Journey with Azure and IaC.
The event does not require registration
The event will be recorded
Language: English
Join us on Monday October 21st at 7.00 p.m. GMT+3 for a duo of Live Sessions on Azure IaC, DevOps and Infrastructure Management !The Event is hosted by Azure Innovators Hub a Meetup child of Microsoft Tech Groups CommunityChristos Galanopoulos a Microsoft MVP will take us on a journey into IaC and Policy Driven Governance with OPA and we will have the opportunity to see actual real world scenarios with Terraform & Azure DevOps.George Markou a Microsoft MVP Alumni will showcase Image provisoning with Packer for Azure Custom Images and the automation capabilities with consistency and reliability for our Infrastructure.The Event is for everyone interested in Azure Technologies, Infrastructure as Code and Enterprise level automation and Governance, as well as Technology Professionals starting their Cloud Journey with Azure and IaC.The event does not require registrationThe event will be recordedLanguage: English Read More
Receiving outlook emails on another account using POP
So for years i’ve checked my outlook emails (an old @msn.com account) using my gmail account via POP3. To authenticate i simply used my email and password, but this stopped working since 25th of September as the outlook server refuses the authentication. Checking in the support pages about pop and imap, i can read that now OnAuth2 is required to authenticate. The only thing i can find on how use this new authentication method is this one: https://learn.microsoft.com/en-us/exchange/client-developer/legacy-protocols/how-to-authenticate-an-imap-pop-smtp-application-by-using-oauth#register-your-application
If i’m reading this correctly, this means that i need to have an azure account and i should create an acess token to use on my gmail acocunt. My questions are:
1. Is there another way to do what has been so easy in the past years?
2. Is this one of the always free services of azure?
3. do i need to do the same if i would use thunderbird as a client?
So for years i’ve checked my outlook emails (an old @msn.com account) using my gmail account via POP3. To authenticate i simply used my email and password, but this stopped working since 25th of September as the outlook server refuses the authentication. Checking in the support pages about pop and imap, i can read that now OnAuth2 is required to authenticate. The only thing i can find on how use this new authentication method is this one: https://learn.microsoft.com/en-us/exchange/client-developer/legacy-protocols/how-to-authenticate-an-imap-pop-smtp-application-by-using-oauth#register-your-applicationIf i’m reading this correctly, this means that i need to have an azure account and i should create an acess token to use on my gmail acocunt. My questions are:1. Is there another way to do what has been so easy in the past years?2. Is this one of the always free services of azure?3. do i need to do the same if i would use thunderbird as a client? Read More
Need help with waypoint navigation code
Hello,
I’m having issues getting a simple waypoint navigation code to work. I am simulating the movement of an RC boat that should navigate from its current location and move to waypoints. Current location and waypoints are inputs and the distance to the waypoint and bearing are outputs. Once the last waypoint is reached, I want the boat to circle back to the first waypoint and the loop continues. What I have is as follows:
function [s, bearing] = waypoint_navigation(lat1, lon1, waypoints)
s=zeros(1);
bearing=zeros(1);
R = 6371e3; % Earth’s radius in meters
lat1 = deg2rad(lat1);
lon1 = deg2rad(lon1);
for i=1:length(waypoints)
lat2 = deg2rad(waypoints(i, 1));
lon2 = deg2rad(waypoints(i, 2));
[s(i), bearing(i)] = haversine_distance_and_bearing(lat1, lon1, lat2(i,1), lon2(i,1)); % haversine_distance_and_bearing is a custom function I’ve created
if s < 5 % Distance threshold
% Increment the waypoint index to go to the next waypoint
i = i + 1;
end
% Loop back to the first waypoint if at the last waypoint
if i > length(waypoints)
i = 1;
end
end
end
Running this results in the error: Error:An error occurred during simulation and the simulation was terminated
Caused by:
Index exceeds array dimensions. Index value 2 exceeds valid range [1-1] for array ‘lat2’.
Error in ‘Test_PlantID/Waypoint Navigation’ (line 11)
[s(i), bearing(i)] = haversine_distance_and_bearing(lat1, lon1, lat2(i,1), lon2(i,1));
I’d appreciate some help on this, I feel like I’m missing something very basic here. Thanks in advance!Hello,
I’m having issues getting a simple waypoint navigation code to work. I am simulating the movement of an RC boat that should navigate from its current location and move to waypoints. Current location and waypoints are inputs and the distance to the waypoint and bearing are outputs. Once the last waypoint is reached, I want the boat to circle back to the first waypoint and the loop continues. What I have is as follows:
function [s, bearing] = waypoint_navigation(lat1, lon1, waypoints)
s=zeros(1);
bearing=zeros(1);
R = 6371e3; % Earth’s radius in meters
lat1 = deg2rad(lat1);
lon1 = deg2rad(lon1);
for i=1:length(waypoints)
lat2 = deg2rad(waypoints(i, 1));
lon2 = deg2rad(waypoints(i, 2));
[s(i), bearing(i)] = haversine_distance_and_bearing(lat1, lon1, lat2(i,1), lon2(i,1)); % haversine_distance_and_bearing is a custom function I’ve created
if s < 5 % Distance threshold
% Increment the waypoint index to go to the next waypoint
i = i + 1;
end
% Loop back to the first waypoint if at the last waypoint
if i > length(waypoints)
i = 1;
end
end
end
Running this results in the error: Error:An error occurred during simulation and the simulation was terminated
Caused by:
Index exceeds array dimensions. Index value 2 exceeds valid range [1-1] for array ‘lat2’.
Error in ‘Test_PlantID/Waypoint Navigation’ (line 11)
[s(i), bearing(i)] = haversine_distance_and_bearing(lat1, lon1, lat2(i,1), lon2(i,1));
I’d appreciate some help on this, I feel like I’m missing something very basic here. Thanks in advance! Hello,
I’m having issues getting a simple waypoint navigation code to work. I am simulating the movement of an RC boat that should navigate from its current location and move to waypoints. Current location and waypoints are inputs and the distance to the waypoint and bearing are outputs. Once the last waypoint is reached, I want the boat to circle back to the first waypoint and the loop continues. What I have is as follows:
function [s, bearing] = waypoint_navigation(lat1, lon1, waypoints)
s=zeros(1);
bearing=zeros(1);
R = 6371e3; % Earth’s radius in meters
lat1 = deg2rad(lat1);
lon1 = deg2rad(lon1);
for i=1:length(waypoints)
lat2 = deg2rad(waypoints(i, 1));
lon2 = deg2rad(waypoints(i, 2));
[s(i), bearing(i)] = haversine_distance_and_bearing(lat1, lon1, lat2(i,1), lon2(i,1)); % haversine_distance_and_bearing is a custom function I’ve created
if s < 5 % Distance threshold
% Increment the waypoint index to go to the next waypoint
i = i + 1;
end
% Loop back to the first waypoint if at the last waypoint
if i > length(waypoints)
i = 1;
end
end
end
Running this results in the error: Error:An error occurred during simulation and the simulation was terminated
Caused by:
Index exceeds array dimensions. Index value 2 exceeds valid range [1-1] for array ‘lat2’.
Error in ‘Test_PlantID/Waypoint Navigation’ (line 11)
[s(i), bearing(i)] = haversine_distance_and_bearing(lat1, lon1, lat2(i,1), lon2(i,1));
I’d appreciate some help on this, I feel like I’m missing something very basic here. Thanks in advance! matlab, simulink, waypoints MATLAB Answers — New Questions
My Taskbar keeps refreshing
It refreshes every 5 seconds and I don’t know what to do because the I can’t click anything and it becomes unresponsive. I can only open Task Manager.
It refreshes every 5 seconds and I don’t know what to do because the I can’t click anything and it becomes unresponsive. I can only open Task Manager. Read More
جـلـب الـحيبيب عبر الثقة493.7 59520 966 الشفاء من الأمراض الروحــية
جـلـب الـحيبيب عبر الثقة493.7 59520 966 الشفاء من الأمراض الروحــية
جـلـب الـحيبيب عبر الثقة493.7 59520 966 الشفاء من الأمراض الروحــية Read More
How to extract specific information from a table, an output when fitlm() function in sued
Hello, am curretly trying to compare several models to determine which one best explains the physical phenomenon. To do this, am using regression analysis to compare each model against the actual experimental data. In each comparsison, I get a table similar to the one below. I would like to pick each R-squared value for each model and store it in a matrix to allow me perform further analaysis.How do I go about this?Hello, am curretly trying to compare several models to determine which one best explains the physical phenomenon. To do this, am using regression analysis to compare each model against the actual experimental data. In each comparsison, I get a table similar to the one below. I would like to pick each R-squared value for each model and store it in a matrix to allow me perform further analaysis.How do I go about this? Hello, am curretly trying to compare several models to determine which one best explains the physical phenomenon. To do this, am using regression analysis to compare each model against the actual experimental data. In each comparsison, I get a table similar to the one below. I would like to pick each R-squared value for each model and store it in a matrix to allow me perform further analaysis.How do I go about this? how to extract info from table MATLAB Answers — New Questions
How to send simulink video viewer live footage to python script and send output of python script back to simulink?
Im doing a project on human detection, so for that is there any way to send live video of simulink simulation (from video viewer) to python scripts which uses deep learning models to identify humans and send python output to simulink in real time?
tried using udp send recieve blocks, but there’s no output from udp recieve block.(using 2024b)Im doing a project on human detection, so for that is there any way to send live video of simulink simulation (from video viewer) to python scripts which uses deep learning models to identify humans and send python output to simulink in real time?
tried using udp send recieve blocks, but there’s no output from udp recieve block.(using 2024b) Im doing a project on human detection, so for that is there any way to send live video of simulink simulation (from video viewer) to python scripts which uses deep learning models to identify humans and send python output to simulink in real time?
tried using udp send recieve blocks, but there’s no output from udp recieve block.(using 2024b) simulink, python, video processing, communication MATLAB Answers — New Questions
BinaryFormat.Binary , BinaryFormat.Byte,BinaryFormat.ByteOrder,BinaryFormat.Group,BinaryFormat.Lengt
Dear Experts,
Greetings,
I have a data like below( Most interesting is the Column “E”-> rat0BitMap:-
The max size of the Column “E” is 11 bits ( which is max numOfPRB == 162),
I want to perform the above functions in this Column “F” which is the BIN of Column “E”, but getting Errors in all functions, in PQ microsoft page, their example also I can’t see.
Could you please educate me/Perform the above 5 functions in Column “F”, using PQ,
Thanks in Advance,
Br,
Anupam
Dear Experts, Greetings,I have a data like below( Most interesting is the Column “E”-> rat0BitMap:- The max size of the Column “E” is 11 bits ( which is max numOfPRB == 162),I want to perform the above functions in this Column “F” which is the BIN of Column “E”, but getting Errors in all functions, in PQ microsoft page, their example also I can’t see. Could you please educate me/Perform the above 5 functions in Column “F”, using PQ, Thanks in Advance,Br,Anupam Read More