Month: February 2026
How to do 1D signal analysis?
I just need an example:
%% =========================
% [2.1] FFT calculation & plotting
% [2.5] Band power computation
% [1.1] Numerical integration (trapz)
% Custom PSD function (FFT-based periodogram)
% =========================
function [f, PSD] = myPSD(x, Fs)
x = x(:); % force column vector
x = x – mean(x); % remove DC offset
N = length(x);
X = fft(x);
K = floor(N/2); % one-sided spectrum length index
X = X(1:K+1);
% One-sided PSD estimate
PSD = (1/(Fs*N)) * abs(X).^2;
% Double interior bins (not DC / Nyquist)
if K > 1
PSD(2:end-1) = 2*PSD(2:end-1);
end
% Frequency vector (matches PSD length exactly)
f = (0:K)’ * (Fs/N);
end
%% Compute PSDs for original signals
[f1, PSD1] = myPSD(sig1, Fs);
[f2, PSD2] = myPSD(sig2, Fs);
%% Plot PSDs (same axes is what the lab asks)
% NOTE: If plotting linear PSD, ylabel should NOT be dB/Hz.
figure;
plot(f1, PSD1, ‘LineWidth’, 1.1); hold on;
plot(f2, PSD2, ‘LineWidth’, 1.1);
grid on;
xlim([0 200]);
xlabel("Frequency (Hz)");
ylabel("Power/Frequency (linear)");
title("PSD of Signal 1 and Signal 2");
legend("sig1","sig2");
% Optional dB version (more readable visually)
figure;
plot(f1, pow2db(PSD1), ‘LineWidth’, 1.1); hold on;
plot(f2, pow2db(PSD2), ‘LineWidth’, 1.1);
grid on;
xlim([0 200]);
xlabel("Frequency (Hz)");
ylabel("Power/Frequency (dB/Hz)");
title("PSD of Signal 1 and Signal 2 (dB)");
%% 20-100 Hz Bandpower using trapz
% [2.5] Band power computation
% [1.1] Numerical integration (trapz)
idx1 = (f1 >= 20) & (f1 <= 100);
idx2 = (f2 >= 20) & (f2 <= 100);
bandpower1 = trapz(f1(idx1), PSD1(idx1));
bandpower2 = trapz(f2(idx2), PSD2(idx2));
fprintf(‘Original bandpower (20-100 Hz): sig1 = %.6g, sig2 = %.6gn’, bandpower1, bandpower2);
%% =========================
% [1.5] Down-sampling
% Anti-aliasing before downsampling (Butterworth lowpass)
% =========================
Fs_down = 200; % new sampling rate (Nyquist = 100 Hz)
downFactor = Fs / Fs_down; % should be integer for downsample()
% Anti-alias lowpass filter (remove content above new Nyquist)
fc = 90; % use < 100 Hz for safety
order = 4;
Wn = fc / (Fs/2); % normalized cutoff
[b, a] = butter(order, Wn, ‘low’);
sig1_filt = filtfilt(b, a, sig1); % zero-phase filtering
sig2_filt = filtfilt(b, a, sig2);
% Downsample filtered signals
sig1_down = downsample(sig1_filt, downFactor);
sig2_down = downsample(sig2_filt, downFactor);
%% PSDs of anti-aliased + downsampled signals
[f1_down, PSD1_down] = myPSD(sig1_down, Fs_down);
[f2_down, PSD2_down] = myPSD(sig2_down, Fs_down);
figure;
plot(f1_down, PSD1_down, ‘LineWidth’, 1.1); hold on;
plot(f2_down, PSD2_down, ‘LineWidth’, 1.1);
grid on;
xlim([0 100]);
xlabel("Frequency (Hz)");
ylabel("Power/Frequency (linear)");
title("PSD of Downsampled Signals");
legend("sig1 down","sig2 down");
%% Bandpower (20-100 Hz) after anti-aliasing + downsampling
idx1_down = (f1_down >= 20) & (f1_down <= 100);
idx2_down = (f2_down >= 20) & (f2_down <= 100);
bandpower1_down = trapz(f1_down(idx1_down), PSD1_down(idx1_down));
bandpower2_down = trapz(f2_down(idx2_down), PSD2_down(idx2_down));
fprintf(‘Downsampled+AA bandpower (20-100 Hz): sig1 = %.6g, sig2 = %.6gn’, bandpower1_down, bandpower2_down);
%% =========================
% [1.4] Signal rectification & enveloping
% =========================
% Lab asks: rectify, then lowpass at 2 Hz to create heartbeat envelope
sig1_rect = abs(sig1_down);
sig2_rect = abs(sig2_down);
fc_env = 2; % envelope lowpass cutoff
order_env = 4;
Wn_env = fc_env / (Fs_down/2);
[b_env, a_env] = butter(order_env, Wn_env, ‘low’);
env1 = filtfilt(b_env, a_env, sig1_rect);
env2 = filtfilt(b_env, a_env, sig2_rect);
t1 = (0:length(env1)-1)’/Fs_down;
t2 = (0:length(env2)-1)’/Fs_down;
figure;
plot(t1, env1); grid on;
xlabel("Time (s)"); ylabel("Envelope amplitude");
title("Envelope of Signal 1");
figure;
plot(t2, env2); grid on;
xlabel("Time (s)"); ylabel("Envelope amplitude");
title("Envelope of Signal 2");
%% Rescale envelopes to [0,1] (helps peak detection)
env1_scaled = rescale(env1);
env2_scaled = rescale(env2);
figure;
plot(t1, env1_scaled); grid on;
xlabel("Time (s)"); ylabel("Scaled envelope");
title("Scaled Envelope of Signal 1");
figure;
plot(t2, env2_scaled); grid on;
xlabel("Time (s)"); ylabel("Scaled envelope");
title("Scaled Envelope of Signal 2");
%% =========================
% [1.2] Peak identification
% =========================
[pks1, locs1] = findpeaks(env1_scaled, ‘MinPeakProminence’, 0.1);
[pks2, locs2] = findpeaks(env2_scaled, ‘MinPeakProminence’, 0.1);
% Optional visualization of peaks
figure;
plot(t1, env1_scaled); hold on; grid on;
plot(locs1/Fs_down, pks1, ‘o’);
xlabel("Time (s)"); ylabel("Scaled envelope");
title("Signal 1 Peaks");
figure;
plot(t2, env2_scaled); hold on; grid on;
plot(locs2/Fs_down, pks2, ‘o’);
xlabel("Time (s)"); ylabel("Scaled envelope");
title("Signal 2 Peaks");
%% =========================
% [1.2] Peak timing -> Heart rate + beat-to-beat timing
% =========================
tpeaks1 = locs1 / Fs_down; % seconds
tpeaks2 = locs2 / Fs_down;
IBI1 = diff(tpeaks1); % inter-beat intervals (s)
IBI2 = diff(tpeaks2);
HR1_bpm = 60 / mean(IBI1); % average heart rate
HR2_bpm = 60 / mean(IBI2);
% Lab also asks for beat-to-beat timing variance
IBIvar1 = var(IBI1);
IBIvar2 = var(IBI2);
fprintf(‘HR sig1 = %.2f bpm, HR sig2 = %.2f bpmn’, HR1_bpm, HR2_bpm);
fprintf(‘Beat-to-beat variance: sig1 = %.6g s^2, sig2 = %.6g s^2n’, IBIvar1, IBIvar2);
%% =========================
% [1.5] Interpolation (recreate original sig1 from downsampled)
% Compare methods using RMSE
% =========================
t_down = (0:length(sig1_down)-1)’ / Fs_down;
t_orig = (0:length(sig1)-1)’ / Fs;
% Try a few methods (lab says experiment with interp1 methods)
methods = ["nearest","linear","spline","pchip","cubic"];
rmseVals = zeros(size(methods));
for k = 1:length(methods)
sig1_int = interp1(t_down, sig1_down, t_orig, methods(k))’;
rmseVals(k) = sqrt(mean((sig1 – sig1_int).^2, ‘omitnan’));
end
% Show RMSEs
disp(table(methods’, rmseVals’, ‘VariableNames’, {‘Method’,’RMSE’}));
% Pick best method (lowest RMSE)
[bestRMSE, idxBest] = min(rmseVals);
bestMethod = methods(idxBest);
% Recompute best interpolation for plotting
sig1_best = interp1(t_down, sig1_down, t_orig, bestMethod)’;
fprintf(‘Best interpolation method: %s (RMSE = %.6g)n’, bestMethod, bestRMSE);
% Plot original vs best interpolated (short window for visibility)
figure;
plot(t_orig, sig1, ‘LineWidth’, 1); hold on; grid on;
plot(t_orig, sig1_best, ‘–‘, ‘LineWidth’, 1);
xlim([0 2]); % zoom into first 2 s so differences are visible
xlabel("Time (s)"); ylabel("Amplitude");
title("Original sig1 vs Interpolated sig1");
legend("Original","Interpolated");I just need an example:
%% =========================
% [2.1] FFT calculation & plotting
% [2.5] Band power computation
% [1.1] Numerical integration (trapz)
% Custom PSD function (FFT-based periodogram)
% =========================
function [f, PSD] = myPSD(x, Fs)
x = x(:); % force column vector
x = x – mean(x); % remove DC offset
N = length(x);
X = fft(x);
K = floor(N/2); % one-sided spectrum length index
X = X(1:K+1);
% One-sided PSD estimate
PSD = (1/(Fs*N)) * abs(X).^2;
% Double interior bins (not DC / Nyquist)
if K > 1
PSD(2:end-1) = 2*PSD(2:end-1);
end
% Frequency vector (matches PSD length exactly)
f = (0:K)’ * (Fs/N);
end
%% Compute PSDs for original signals
[f1, PSD1] = myPSD(sig1, Fs);
[f2, PSD2] = myPSD(sig2, Fs);
%% Plot PSDs (same axes is what the lab asks)
% NOTE: If plotting linear PSD, ylabel should NOT be dB/Hz.
figure;
plot(f1, PSD1, ‘LineWidth’, 1.1); hold on;
plot(f2, PSD2, ‘LineWidth’, 1.1);
grid on;
xlim([0 200]);
xlabel("Frequency (Hz)");
ylabel("Power/Frequency (linear)");
title("PSD of Signal 1 and Signal 2");
legend("sig1","sig2");
% Optional dB version (more readable visually)
figure;
plot(f1, pow2db(PSD1), ‘LineWidth’, 1.1); hold on;
plot(f2, pow2db(PSD2), ‘LineWidth’, 1.1);
grid on;
xlim([0 200]);
xlabel("Frequency (Hz)");
ylabel("Power/Frequency (dB/Hz)");
title("PSD of Signal 1 and Signal 2 (dB)");
%% 20-100 Hz Bandpower using trapz
% [2.5] Band power computation
% [1.1] Numerical integration (trapz)
idx1 = (f1 >= 20) & (f1 <= 100);
idx2 = (f2 >= 20) & (f2 <= 100);
bandpower1 = trapz(f1(idx1), PSD1(idx1));
bandpower2 = trapz(f2(idx2), PSD2(idx2));
fprintf(‘Original bandpower (20-100 Hz): sig1 = %.6g, sig2 = %.6gn’, bandpower1, bandpower2);
%% =========================
% [1.5] Down-sampling
% Anti-aliasing before downsampling (Butterworth lowpass)
% =========================
Fs_down = 200; % new sampling rate (Nyquist = 100 Hz)
downFactor = Fs / Fs_down; % should be integer for downsample()
% Anti-alias lowpass filter (remove content above new Nyquist)
fc = 90; % use < 100 Hz for safety
order = 4;
Wn = fc / (Fs/2); % normalized cutoff
[b, a] = butter(order, Wn, ‘low’);
sig1_filt = filtfilt(b, a, sig1); % zero-phase filtering
sig2_filt = filtfilt(b, a, sig2);
% Downsample filtered signals
sig1_down = downsample(sig1_filt, downFactor);
sig2_down = downsample(sig2_filt, downFactor);
%% PSDs of anti-aliased + downsampled signals
[f1_down, PSD1_down] = myPSD(sig1_down, Fs_down);
[f2_down, PSD2_down] = myPSD(sig2_down, Fs_down);
figure;
plot(f1_down, PSD1_down, ‘LineWidth’, 1.1); hold on;
plot(f2_down, PSD2_down, ‘LineWidth’, 1.1);
grid on;
xlim([0 100]);
xlabel("Frequency (Hz)");
ylabel("Power/Frequency (linear)");
title("PSD of Downsampled Signals");
legend("sig1 down","sig2 down");
%% Bandpower (20-100 Hz) after anti-aliasing + downsampling
idx1_down = (f1_down >= 20) & (f1_down <= 100);
idx2_down = (f2_down >= 20) & (f2_down <= 100);
bandpower1_down = trapz(f1_down(idx1_down), PSD1_down(idx1_down));
bandpower2_down = trapz(f2_down(idx2_down), PSD2_down(idx2_down));
fprintf(‘Downsampled+AA bandpower (20-100 Hz): sig1 = %.6g, sig2 = %.6gn’, bandpower1_down, bandpower2_down);
%% =========================
% [1.4] Signal rectification & enveloping
% =========================
% Lab asks: rectify, then lowpass at 2 Hz to create heartbeat envelope
sig1_rect = abs(sig1_down);
sig2_rect = abs(sig2_down);
fc_env = 2; % envelope lowpass cutoff
order_env = 4;
Wn_env = fc_env / (Fs_down/2);
[b_env, a_env] = butter(order_env, Wn_env, ‘low’);
env1 = filtfilt(b_env, a_env, sig1_rect);
env2 = filtfilt(b_env, a_env, sig2_rect);
t1 = (0:length(env1)-1)’/Fs_down;
t2 = (0:length(env2)-1)’/Fs_down;
figure;
plot(t1, env1); grid on;
xlabel("Time (s)"); ylabel("Envelope amplitude");
title("Envelope of Signal 1");
figure;
plot(t2, env2); grid on;
xlabel("Time (s)"); ylabel("Envelope amplitude");
title("Envelope of Signal 2");
%% Rescale envelopes to [0,1] (helps peak detection)
env1_scaled = rescale(env1);
env2_scaled = rescale(env2);
figure;
plot(t1, env1_scaled); grid on;
xlabel("Time (s)"); ylabel("Scaled envelope");
title("Scaled Envelope of Signal 1");
figure;
plot(t2, env2_scaled); grid on;
xlabel("Time (s)"); ylabel("Scaled envelope");
title("Scaled Envelope of Signal 2");
%% =========================
% [1.2] Peak identification
% =========================
[pks1, locs1] = findpeaks(env1_scaled, ‘MinPeakProminence’, 0.1);
[pks2, locs2] = findpeaks(env2_scaled, ‘MinPeakProminence’, 0.1);
% Optional visualization of peaks
figure;
plot(t1, env1_scaled); hold on; grid on;
plot(locs1/Fs_down, pks1, ‘o’);
xlabel("Time (s)"); ylabel("Scaled envelope");
title("Signal 1 Peaks");
figure;
plot(t2, env2_scaled); hold on; grid on;
plot(locs2/Fs_down, pks2, ‘o’);
xlabel("Time (s)"); ylabel("Scaled envelope");
title("Signal 2 Peaks");
%% =========================
% [1.2] Peak timing -> Heart rate + beat-to-beat timing
% =========================
tpeaks1 = locs1 / Fs_down; % seconds
tpeaks2 = locs2 / Fs_down;
IBI1 = diff(tpeaks1); % inter-beat intervals (s)
IBI2 = diff(tpeaks2);
HR1_bpm = 60 / mean(IBI1); % average heart rate
HR2_bpm = 60 / mean(IBI2);
% Lab also asks for beat-to-beat timing variance
IBIvar1 = var(IBI1);
IBIvar2 = var(IBI2);
fprintf(‘HR sig1 = %.2f bpm, HR sig2 = %.2f bpmn’, HR1_bpm, HR2_bpm);
fprintf(‘Beat-to-beat variance: sig1 = %.6g s^2, sig2 = %.6g s^2n’, IBIvar1, IBIvar2);
%% =========================
% [1.5] Interpolation (recreate original sig1 from downsampled)
% Compare methods using RMSE
% =========================
t_down = (0:length(sig1_down)-1)’ / Fs_down;
t_orig = (0:length(sig1)-1)’ / Fs;
% Try a few methods (lab says experiment with interp1 methods)
methods = ["nearest","linear","spline","pchip","cubic"];
rmseVals = zeros(size(methods));
for k = 1:length(methods)
sig1_int = interp1(t_down, sig1_down, t_orig, methods(k))’;
rmseVals(k) = sqrt(mean((sig1 – sig1_int).^2, ‘omitnan’));
end
% Show RMSEs
disp(table(methods’, rmseVals’, ‘VariableNames’, {‘Method’,’RMSE’}));
% Pick best method (lowest RMSE)
[bestRMSE, idxBest] = min(rmseVals);
bestMethod = methods(idxBest);
% Recompute best interpolation for plotting
sig1_best = interp1(t_down, sig1_down, t_orig, bestMethod)’;
fprintf(‘Best interpolation method: %s (RMSE = %.6g)n’, bestMethod, bestRMSE);
% Plot original vs best interpolated (short window for visibility)
figure;
plot(t_orig, sig1, ‘LineWidth’, 1); hold on; grid on;
plot(t_orig, sig1_best, ‘–‘, ‘LineWidth’, 1);
xlim([0 2]); % zoom into first 2 s so differences are visible
xlabel("Time (s)"); ylabel("Amplitude");
title("Original sig1 vs Interpolated sig1");
legend("Original","Interpolated"); I just need an example:
%% =========================
% [2.1] FFT calculation & plotting
% [2.5] Band power computation
% [1.1] Numerical integration (trapz)
% Custom PSD function (FFT-based periodogram)
% =========================
function [f, PSD] = myPSD(x, Fs)
x = x(:); % force column vector
x = x – mean(x); % remove DC offset
N = length(x);
X = fft(x);
K = floor(N/2); % one-sided spectrum length index
X = X(1:K+1);
% One-sided PSD estimate
PSD = (1/(Fs*N)) * abs(X).^2;
% Double interior bins (not DC / Nyquist)
if K > 1
PSD(2:end-1) = 2*PSD(2:end-1);
end
% Frequency vector (matches PSD length exactly)
f = (0:K)’ * (Fs/N);
end
%% Compute PSDs for original signals
[f1, PSD1] = myPSD(sig1, Fs);
[f2, PSD2] = myPSD(sig2, Fs);
%% Plot PSDs (same axes is what the lab asks)
% NOTE: If plotting linear PSD, ylabel should NOT be dB/Hz.
figure;
plot(f1, PSD1, ‘LineWidth’, 1.1); hold on;
plot(f2, PSD2, ‘LineWidth’, 1.1);
grid on;
xlim([0 200]);
xlabel("Frequency (Hz)");
ylabel("Power/Frequency (linear)");
title("PSD of Signal 1 and Signal 2");
legend("sig1","sig2");
% Optional dB version (more readable visually)
figure;
plot(f1, pow2db(PSD1), ‘LineWidth’, 1.1); hold on;
plot(f2, pow2db(PSD2), ‘LineWidth’, 1.1);
grid on;
xlim([0 200]);
xlabel("Frequency (Hz)");
ylabel("Power/Frequency (dB/Hz)");
title("PSD of Signal 1 and Signal 2 (dB)");
%% 20-100 Hz Bandpower using trapz
% [2.5] Band power computation
% [1.1] Numerical integration (trapz)
idx1 = (f1 >= 20) & (f1 <= 100);
idx2 = (f2 >= 20) & (f2 <= 100);
bandpower1 = trapz(f1(idx1), PSD1(idx1));
bandpower2 = trapz(f2(idx2), PSD2(idx2));
fprintf(‘Original bandpower (20-100 Hz): sig1 = %.6g, sig2 = %.6gn’, bandpower1, bandpower2);
%% =========================
% [1.5] Down-sampling
% Anti-aliasing before downsampling (Butterworth lowpass)
% =========================
Fs_down = 200; % new sampling rate (Nyquist = 100 Hz)
downFactor = Fs / Fs_down; % should be integer for downsample()
% Anti-alias lowpass filter (remove content above new Nyquist)
fc = 90; % use < 100 Hz for safety
order = 4;
Wn = fc / (Fs/2); % normalized cutoff
[b, a] = butter(order, Wn, ‘low’);
sig1_filt = filtfilt(b, a, sig1); % zero-phase filtering
sig2_filt = filtfilt(b, a, sig2);
% Downsample filtered signals
sig1_down = downsample(sig1_filt, downFactor);
sig2_down = downsample(sig2_filt, downFactor);
%% PSDs of anti-aliased + downsampled signals
[f1_down, PSD1_down] = myPSD(sig1_down, Fs_down);
[f2_down, PSD2_down] = myPSD(sig2_down, Fs_down);
figure;
plot(f1_down, PSD1_down, ‘LineWidth’, 1.1); hold on;
plot(f2_down, PSD2_down, ‘LineWidth’, 1.1);
grid on;
xlim([0 100]);
xlabel("Frequency (Hz)");
ylabel("Power/Frequency (linear)");
title("PSD of Downsampled Signals");
legend("sig1 down","sig2 down");
%% Bandpower (20-100 Hz) after anti-aliasing + downsampling
idx1_down = (f1_down >= 20) & (f1_down <= 100);
idx2_down = (f2_down >= 20) & (f2_down <= 100);
bandpower1_down = trapz(f1_down(idx1_down), PSD1_down(idx1_down));
bandpower2_down = trapz(f2_down(idx2_down), PSD2_down(idx2_down));
fprintf(‘Downsampled+AA bandpower (20-100 Hz): sig1 = %.6g, sig2 = %.6gn’, bandpower1_down, bandpower2_down);
%% =========================
% [1.4] Signal rectification & enveloping
% =========================
% Lab asks: rectify, then lowpass at 2 Hz to create heartbeat envelope
sig1_rect = abs(sig1_down);
sig2_rect = abs(sig2_down);
fc_env = 2; % envelope lowpass cutoff
order_env = 4;
Wn_env = fc_env / (Fs_down/2);
[b_env, a_env] = butter(order_env, Wn_env, ‘low’);
env1 = filtfilt(b_env, a_env, sig1_rect);
env2 = filtfilt(b_env, a_env, sig2_rect);
t1 = (0:length(env1)-1)’/Fs_down;
t2 = (0:length(env2)-1)’/Fs_down;
figure;
plot(t1, env1); grid on;
xlabel("Time (s)"); ylabel("Envelope amplitude");
title("Envelope of Signal 1");
figure;
plot(t2, env2); grid on;
xlabel("Time (s)"); ylabel("Envelope amplitude");
title("Envelope of Signal 2");
%% Rescale envelopes to [0,1] (helps peak detection)
env1_scaled = rescale(env1);
env2_scaled = rescale(env2);
figure;
plot(t1, env1_scaled); grid on;
xlabel("Time (s)"); ylabel("Scaled envelope");
title("Scaled Envelope of Signal 1");
figure;
plot(t2, env2_scaled); grid on;
xlabel("Time (s)"); ylabel("Scaled envelope");
title("Scaled Envelope of Signal 2");
%% =========================
% [1.2] Peak identification
% =========================
[pks1, locs1] = findpeaks(env1_scaled, ‘MinPeakProminence’, 0.1);
[pks2, locs2] = findpeaks(env2_scaled, ‘MinPeakProminence’, 0.1);
% Optional visualization of peaks
figure;
plot(t1, env1_scaled); hold on; grid on;
plot(locs1/Fs_down, pks1, ‘o’);
xlabel("Time (s)"); ylabel("Scaled envelope");
title("Signal 1 Peaks");
figure;
plot(t2, env2_scaled); hold on; grid on;
plot(locs2/Fs_down, pks2, ‘o’);
xlabel("Time (s)"); ylabel("Scaled envelope");
title("Signal 2 Peaks");
%% =========================
% [1.2] Peak timing -> Heart rate + beat-to-beat timing
% =========================
tpeaks1 = locs1 / Fs_down; % seconds
tpeaks2 = locs2 / Fs_down;
IBI1 = diff(tpeaks1); % inter-beat intervals (s)
IBI2 = diff(tpeaks2);
HR1_bpm = 60 / mean(IBI1); % average heart rate
HR2_bpm = 60 / mean(IBI2);
% Lab also asks for beat-to-beat timing variance
IBIvar1 = var(IBI1);
IBIvar2 = var(IBI2);
fprintf(‘HR sig1 = %.2f bpm, HR sig2 = %.2f bpmn’, HR1_bpm, HR2_bpm);
fprintf(‘Beat-to-beat variance: sig1 = %.6g s^2, sig2 = %.6g s^2n’, IBIvar1, IBIvar2);
%% =========================
% [1.5] Interpolation (recreate original sig1 from downsampled)
% Compare methods using RMSE
% =========================
t_down = (0:length(sig1_down)-1)’ / Fs_down;
t_orig = (0:length(sig1)-1)’ / Fs;
% Try a few methods (lab says experiment with interp1 methods)
methods = ["nearest","linear","spline","pchip","cubic"];
rmseVals = zeros(size(methods));
for k = 1:length(methods)
sig1_int = interp1(t_down, sig1_down, t_orig, methods(k))’;
rmseVals(k) = sqrt(mean((sig1 – sig1_int).^2, ‘omitnan’));
end
% Show RMSEs
disp(table(methods’, rmseVals’, ‘VariableNames’, {‘Method’,’RMSE’}));
% Pick best method (lowest RMSE)
[bestRMSE, idxBest] = min(rmseVals);
bestMethod = methods(idxBest);
% Recompute best interpolation for plotting
sig1_best = interp1(t_down, sig1_down, t_orig, bestMethod)’;
fprintf(‘Best interpolation method: %s (RMSE = %.6g)n’, bestMethod, bestRMSE);
% Plot original vs best interpolated (short window for visibility)
figure;
plot(t_orig, sig1, ‘LineWidth’, 1); hold on; grid on;
plot(t_orig, sig1_best, ‘–‘, ‘LineWidth’, 1);
xlim([0 2]); % zoom into first 2 s so differences are visible
xlabel("Time (s)"); ylabel("Amplitude");
title("Original sig1 vs Interpolated sig1");
legend("Original","Interpolated"); signal processing MATLAB Answers — New Questions
Why Does ifourier Not Return Equivalent Results for Equivalent Transforms?
Consider two expressions of a Fourier transform
syms t omega real
HU(omega) = -(exp(-omega*1i)*(exp(omega*1i) – 1)*(omega + 1i))/(omega*(omega^2 + 1))
Y(omega) = (exp(-omega*1i)*1i – 1i)/(omega*(1 + omega*1i))
The transforms are equivalent
simplify(HU(omega)-Y(omega))
so I would expect the inverse transforms to be equivalent.
Inverse transform of Y(omega)
y(t) = ifourier(Y(omega),omega,t)
Inverse transform of HU(omega)
hu(t) = ifourier(HU(omega),omega,t)
hu(t) looks complicated, but the primary concern is that Dirac delta in the first term in the numerator.
Simplify both expressions
s = @(z) simplify(rewrite(simplify(z),’heaviside’));
y(t) = s(y(t))
hu(t) = s(hu(t))
Sure enough, both time domain signals are the same with the exception that hu(t) includes that Dirac delta term.
Show that they are the same, except for the Dirac delta, by subtracting and using fplot that ignores Dirac delta terms:
figure
fplot(y(t)-hu(t),[-10,10]),ylim([-1e-16,1e-16])
Is this a bug, or is there a problem in the code, or am I misunderstanding what the results should be?Consider two expressions of a Fourier transform
syms t omega real
HU(omega) = -(exp(-omega*1i)*(exp(omega*1i) – 1)*(omega + 1i))/(omega*(omega^2 + 1))
Y(omega) = (exp(-omega*1i)*1i – 1i)/(omega*(1 + omega*1i))
The transforms are equivalent
simplify(HU(omega)-Y(omega))
so I would expect the inverse transforms to be equivalent.
Inverse transform of Y(omega)
y(t) = ifourier(Y(omega),omega,t)
Inverse transform of HU(omega)
hu(t) = ifourier(HU(omega),omega,t)
hu(t) looks complicated, but the primary concern is that Dirac delta in the first term in the numerator.
Simplify both expressions
s = @(z) simplify(rewrite(simplify(z),’heaviside’));
y(t) = s(y(t))
hu(t) = s(hu(t))
Sure enough, both time domain signals are the same with the exception that hu(t) includes that Dirac delta term.
Show that they are the same, except for the Dirac delta, by subtracting and using fplot that ignores Dirac delta terms:
figure
fplot(y(t)-hu(t),[-10,10]),ylim([-1e-16,1e-16])
Is this a bug, or is there a problem in the code, or am I misunderstanding what the results should be? Consider two expressions of a Fourier transform
syms t omega real
HU(omega) = -(exp(-omega*1i)*(exp(omega*1i) – 1)*(omega + 1i))/(omega*(omega^2 + 1))
Y(omega) = (exp(-omega*1i)*1i – 1i)/(omega*(1 + omega*1i))
The transforms are equivalent
simplify(HU(omega)-Y(omega))
so I would expect the inverse transforms to be equivalent.
Inverse transform of Y(omega)
y(t) = ifourier(Y(omega),omega,t)
Inverse transform of HU(omega)
hu(t) = ifourier(HU(omega),omega,t)
hu(t) looks complicated, but the primary concern is that Dirac delta in the first term in the numerator.
Simplify both expressions
s = @(z) simplify(rewrite(simplify(z),’heaviside’));
y(t) = s(y(t))
hu(t) = s(hu(t))
Sure enough, both time domain signals are the same with the exception that hu(t) includes that Dirac delta term.
Show that they are the same, except for the Dirac delta, by subtracting and using fplot that ignores Dirac delta terms:
figure
fplot(y(t)-hu(t),[-10,10]),ylim([-1e-16,1e-16])
Is this a bug, or is there a problem in the code, or am I misunderstanding what the results should be? ifourier, inconsistent results MATLAB Answers — New Questions
How do I use ‘intersection’ to get the overlapping line between two polyshapes?
Hi – how do I get the line intersection between two polyshapes that overlap along a line? A super-simplified example is below. For the real case, the shapes are more complicated, but I think the simplified case covers it. I’m maybe not understanding how the intersection function works! Thank you!
function main()
%clear all; % completely superfluous in function workspace
x1 = [1 4 4 1];
y1 = [1 1 4 4];
x2 = [4 6 6 4];
y2 = [2 2 3 3];
poly1 = polyshape(x1,y1);
% the poly2 ‘grows’ from poly1
poly2 = polyshape(x2,y2);
poly2 = union(poly1,poly2);
growthPoly = subtract(poly2,poly1,"KeepCollinearPoints",true);
close all;
hold on;
plot(poly1,’FaceColor’,’none’,’EdgeColor’,’k’,’LineWidth’,12);
plot(poly2,’FaceColor’,’none’,’EdgeColor’,’g’,’LineWidth’,8);
plot(growthPoly,’FaceColor’,’none’,’EdgeColor’,’r’,’LineWidth’,4);
% this comes back empty and nothing gets plotted
growthLine = intersect(poly1,growthPoly,"KeepCollinearPoints",true);
plot(growthLine,’FaceColor’,’none’,’EdgeColor’,’b’,’LineWidth’,2);
legend({‘The initial poly1’,…
‘poly2 grew from poly1’,…
‘The growth area is the difference between poly2 and poly1′},’Box’,’off’,’Location’,’south’,’FontSize’,18);
title({‘How do I get the ”growthLine” part that is red-on-black?’;’I thought it would be the intersection of the black and red, but no dice’;’I thought it would show up as a blue line’},’FontSize’,22);
endHi – how do I get the line intersection between two polyshapes that overlap along a line? A super-simplified example is below. For the real case, the shapes are more complicated, but I think the simplified case covers it. I’m maybe not understanding how the intersection function works! Thank you!
function main()
%clear all; % completely superfluous in function workspace
x1 = [1 4 4 1];
y1 = [1 1 4 4];
x2 = [4 6 6 4];
y2 = [2 2 3 3];
poly1 = polyshape(x1,y1);
% the poly2 ‘grows’ from poly1
poly2 = polyshape(x2,y2);
poly2 = union(poly1,poly2);
growthPoly = subtract(poly2,poly1,"KeepCollinearPoints",true);
close all;
hold on;
plot(poly1,’FaceColor’,’none’,’EdgeColor’,’k’,’LineWidth’,12);
plot(poly2,’FaceColor’,’none’,’EdgeColor’,’g’,’LineWidth’,8);
plot(growthPoly,’FaceColor’,’none’,’EdgeColor’,’r’,’LineWidth’,4);
% this comes back empty and nothing gets plotted
growthLine = intersect(poly1,growthPoly,"KeepCollinearPoints",true);
plot(growthLine,’FaceColor’,’none’,’EdgeColor’,’b’,’LineWidth’,2);
legend({‘The initial poly1’,…
‘poly2 grew from poly1’,…
‘The growth area is the difference between poly2 and poly1′},’Box’,’off’,’Location’,’south’,’FontSize’,18);
title({‘How do I get the ”growthLine” part that is red-on-black?’;’I thought it would be the intersection of the black and red, but no dice’;’I thought it would show up as a blue line’},’FontSize’,22);
end Hi – how do I get the line intersection between two polyshapes that overlap along a line? A super-simplified example is below. For the real case, the shapes are more complicated, but I think the simplified case covers it. I’m maybe not understanding how the intersection function works! Thank you!
function main()
%clear all; % completely superfluous in function workspace
x1 = [1 4 4 1];
y1 = [1 1 4 4];
x2 = [4 6 6 4];
y2 = [2 2 3 3];
poly1 = polyshape(x1,y1);
% the poly2 ‘grows’ from poly1
poly2 = polyshape(x2,y2);
poly2 = union(poly1,poly2);
growthPoly = subtract(poly2,poly1,"KeepCollinearPoints",true);
close all;
hold on;
plot(poly1,’FaceColor’,’none’,’EdgeColor’,’k’,’LineWidth’,12);
plot(poly2,’FaceColor’,’none’,’EdgeColor’,’g’,’LineWidth’,8);
plot(growthPoly,’FaceColor’,’none’,’EdgeColor’,’r’,’LineWidth’,4);
% this comes back empty and nothing gets plotted
growthLine = intersect(poly1,growthPoly,"KeepCollinearPoints",true);
plot(growthLine,’FaceColor’,’none’,’EdgeColor’,’b’,’LineWidth’,2);
legend({‘The initial poly1’,…
‘poly2 grew from poly1’,…
‘The growth area is the difference between poly2 and poly1′},’Box’,’off’,’Location’,’south’,’FontSize’,18);
title({‘How do I get the ”growthLine” part that is red-on-black?’;’I thought it would be the intersection of the black and red, but no dice’;’I thought it would show up as a blue line’},’FontSize’,22);
end polyshape, intersection, union, subtract MATLAB Answers — New Questions
long time duration simulink simualtion stopped with error
An error occurred during simulation and the simulation was stopped
Caused by:
Output sample times of /Integer N PLL with Single Modulus Prescaler/Single Modulus Prescaler/Logic Decision1 occur out of sequence. Specify the ‘Minimum delay value’ parameter as a value greater than 1e-15 times the simulation stop time.
Component:Simulink | Category:Block errorAn error occurred during simulation and the simulation was stopped
Caused by:
Output sample times of /Integer N PLL with Single Modulus Prescaler/Single Modulus Prescaler/Logic Decision1 occur out of sequence. Specify the ‘Minimum delay value’ parameter as a value greater than 1e-15 times the simulation stop time.
Component:Simulink | Category:Block error An error occurred during simulation and the simulation was stopped
Caused by:
Output sample times of /Integer N PLL with Single Modulus Prescaler/Single Modulus Prescaler/Logic Decision1 occur out of sequence. Specify the ‘Minimum delay value’ parameter as a value greater than 1e-15 times the simulation stop time.
Component:Simulink | Category:Block error simulink, long time simulation, minimum delay value MATLAB Answers — New Questions
Microsoft Extends DLP Policy for Copilot Protection to All Storage Locations
Extending the Reach for the DLP Policy for Copilot
With all the fuss and bother about the bug that allowed Microsoft 365 Copilot Chat (BizChat) to expose content blocked by the DLP policy for Copilot in chat responses, you’d be forgiven for thinking that Copilot leaks confidential information all the time. Of course, Copilot doesn’t. Bugs happen all the time in software and although Microsoft was slow to acknowledge the bug initially, they did fix it promptly thereafter. I guess all those who spouted rubbish in forums such as LinkedIn were simply seeking notoriety, or something like that. It would be better if they engaged their brains before commenting.
Which brings me neatly to message center notification MC1234661 (19 February 2026, Microsoft 365 Roadmap 557255), which announces that Microsoft is extending the reach of the DLP policy for Copilot to all storage locations where Office files are kept. Previously, protection was only available to Office files stored inside Microsoft 365. Now, local and other cloud storage providers are covered. I think this is a pretty big deal.
Rollout will start in late March 2026, and Microsoft expects that the update will be deployed worldwide by late April 2026.
The Magic of the Augmentation Loop
Although Microsoft has control over Microsoft 365 locations, it obviously cannot control local storage. The magic that allows the DLP policy for Copilot to extend its reach comes from a component called the Office Augmentation Loop, often shortened to “AugLoop.”
The Augmentation Loop is an internal Office component that collects signals from Microsoft 365 applications and enforces policy when organizations use connected experiences. Not everything can be processed locally (DLP is a good example), which is when connected experience come into play to link local applications with cloud services.
The problem about discussing anything to do with the augmentation loop is the lack of documentation. The augmentation loop is an internal component that’s not designed to be exposed to users. Based on discussions with Microsoft engineers, my understanding is that the augmentation loop is responsible for gathering information to help components like Copilot make good decisions.
My understanding aligns with the description in MC1234661, where Microsoft explains that the augmentation loop now reads details about sensitivity labels assigned to files through the Office clients. Office clients already know how to report sensitivity labels (for example, to surface the name of the currently applied label in different places within the Office UI.
The older method used Microsoft Graph lookups to retrieve sensitivity label information based on the URL of the file (like the URL assigned to files in a SharePoint Online or OneDrive for Business site). This approach makes perfect sense when dealing with files stored in Microsoft 365 but left a gap for Office files held elsewhere.
No Change Necessary for Existing DLP Policies
The new implementation allows the augmentation loop to gather the information necessary for the DLP policy for Copilot to evaluate whether to block or allow access to content protected by a sensitivity label, even if the file is on a network or local drive. Remember, sensitivity labels travel with files to ensure that only users with adequate rights can open and use the files. Figure 1 shows the flow of processing for the DLP policy for Copilot.

The nice thing is that no changes need to be made to existing DLP policies. Protection is extended automatically to non-Microsoft 365 storage locations after the code update reaches Microsoft 365 tenants.
Consistency is Everything
Sensitivity labels ensure consistency of protection no matter where labelled files are stored. The same consistency of protection is now available through the DLP policy for Copilot. It’s a change that makes perfect sense.
Support the work of the Office 365 for IT Pros team by subscribing to the Office 365 for IT Pros eBook. Your support pays for the time we need to track, analyze, and document the changing world of Microsoft 365 and Office 365. No AI is used to generate our output!
Matlab using parallels on M1 macbook pro
Hello,
For the purpose of research, I need to use a image analysis program designed for windows, that requires matlab, which is run using parallels on macs with intel-processors. I’m currently looking at purchasing a new macbook pro m1 for work. Collegues have warned me that it’s only possible to run the insider preview ARM-based windows 11, not x86, using parallels on macbook M1, which is, if I understand this correctly, not compatible with matlab, and therefore I cannot run the programs needed for work. Do anyone know any solution to this problem? I would be most thankful.Hello,
For the purpose of research, I need to use a image analysis program designed for windows, that requires matlab, which is run using parallels on macs with intel-processors. I’m currently looking at purchasing a new macbook pro m1 for work. Collegues have warned me that it’s only possible to run the insider preview ARM-based windows 11, not x86, using parallels on macbook M1, which is, if I understand this correctly, not compatible with matlab, and therefore I cannot run the programs needed for work. Do anyone know any solution to this problem? I would be most thankful. Hello,
For the purpose of research, I need to use a image analysis program designed for windows, that requires matlab, which is run using parallels on macs with intel-processors. I’m currently looking at purchasing a new macbook pro m1 for work. Collegues have warned me that it’s only possible to run the insider preview ARM-based windows 11, not x86, using parallels on macbook M1, which is, if I understand this correctly, not compatible with matlab, and therefore I cannot run the programs needed for work. Do anyone know any solution to this problem? I would be most thankful. mac, m1, parallels MATLAB Answers — New Questions
scanf/printf not working when calling generated C code
In Matlab I have generated C code (.c/.h files) from a Matlab function using codegen from Matlab Coder.
I call this function in a while loop on an ARM quad-core Cortex A53 using AMD Vitis.
Before calling this function I use scanf/printf to get user input and to print to the serial monitor. However, scanf/printf only work once in the 1st iteration (before calling the function) and not in the 2nd iteration or later (after calling the function).
Is this a common problem and has anyone encountered this problem before?
I think, but am not sure, that the problem is in the generated C code and not in Vitis itself.
Thank you in advance!In Matlab I have generated C code (.c/.h files) from a Matlab function using codegen from Matlab Coder.
I call this function in a while loop on an ARM quad-core Cortex A53 using AMD Vitis.
Before calling this function I use scanf/printf to get user input and to print to the serial monitor. However, scanf/printf only work once in the 1st iteration (before calling the function) and not in the 2nd iteration or later (after calling the function).
Is this a common problem and has anyone encountered this problem before?
I think, but am not sure, that the problem is in the generated C code and not in Vitis itself.
Thank you in advance! In Matlab I have generated C code (.c/.h files) from a Matlab function using codegen from Matlab Coder.
I call this function in a while loop on an ARM quad-core Cortex A53 using AMD Vitis.
Before calling this function I use scanf/printf to get user input and to print to the serial monitor. However, scanf/printf only work once in the 1st iteration (before calling the function) and not in the 2nd iteration or later (after calling the function).
Is this a common problem and has anyone encountered this problem before?
I think, but am not sure, that the problem is in the generated C code and not in Vitis itself.
Thank you in advance! matlab coder, code generation MATLAB Answers — New Questions
Unexpected behavior of -nouserjavapath in MATLAB R2025b compared to R2022b
Hello everyone,
I recently upgraded from MATLAB R2022b to MATLAB R2025b and noticed a change in how MATLAB handles the -nouserjavapath startup option.
I have a javaclasspath.txt file in my MATLAB prefdir, where I define several custom JAR file locations. Normally, when MATLAB starts, these JARs are correctly loaded into the static Java class path (visible via javaclasspath(‘-static’)).
In some situations, however, I want to start MATLAB without loading my custom JARs. In R2022b, starting MATLAB with:
matlab -nouserjavapath
correctly ignored the javaclasspath.txt, and my custom JARs did not appear in the static Java class path.
But in R2025b, this no longer works. Even when starting with -nouserjavapath, MATLAB still loads the JARs defined in javaclasspath.txt.
Has something changed in MATLAB R2025b regarding how the -nouserjavapath option is handled?
Is this expected behavior, a known change, or possibly a bug?
Thank you!Hello everyone,
I recently upgraded from MATLAB R2022b to MATLAB R2025b and noticed a change in how MATLAB handles the -nouserjavapath startup option.
I have a javaclasspath.txt file in my MATLAB prefdir, where I define several custom JAR file locations. Normally, when MATLAB starts, these JARs are correctly loaded into the static Java class path (visible via javaclasspath(‘-static’)).
In some situations, however, I want to start MATLAB without loading my custom JARs. In R2022b, starting MATLAB with:
matlab -nouserjavapath
correctly ignored the javaclasspath.txt, and my custom JARs did not appear in the static Java class path.
But in R2025b, this no longer works. Even when starting with -nouserjavapath, MATLAB still loads the JARs defined in javaclasspath.txt.
Has something changed in MATLAB R2025b regarding how the -nouserjavapath option is handled?
Is this expected behavior, a known change, or possibly a bug?
Thank you! Hello everyone,
I recently upgraded from MATLAB R2022b to MATLAB R2025b and noticed a change in how MATLAB handles the -nouserjavapath startup option.
I have a javaclasspath.txt file in my MATLAB prefdir, where I define several custom JAR file locations. Normally, when MATLAB starts, these JARs are correctly loaded into the static Java class path (visible via javaclasspath(‘-static’)).
In some situations, however, I want to start MATLAB without loading my custom JARs. In R2022b, starting MATLAB with:
matlab -nouserjavapath
correctly ignored the javaclasspath.txt, and my custom JARs did not appear in the static Java class path.
But in R2025b, this no longer works. Even when starting with -nouserjavapath, MATLAB still loads the JARs defined in javaclasspath.txt.
Has something changed in MATLAB R2025b regarding how the -nouserjavapath option is handled?
Is this expected behavior, a known change, or possibly a bug?
Thank you! matlab 2025b, matlab 2022b, startup option, -nouserjavapath MATLAB Answers — New Questions
fprintf not printing to command window when asking for input.
Hello. I am working on a Jukebox to play a song that corrisponds with set number (this part is not the issue I am just trying to provide some context).
When the code is run I would like the Opening menu to appear in the command window so the user can see the song choices before being prompted to enter an input. The problem is that when I run the code it does not print any of my text and just waits for an input. I think it has something to do with the fact that other than declaring some variables, there is nothing happening before the first fprintf. I am not getting any error or warning messages on my end.
Is this a quirk of using the online version? I am using the online verison of MATlab because I am having techinal issues with installing the desktop version.
(This is not all of my code, I chose to only share what is relevent to my issue)
clear
clc
close all
%% Declarations
rate = 32768; % sampling rate
songs = 1:9;
octave = 0;
speed = 0;
% Opening menu. Give list of options
fprintf([‘Welcome to Jukebox.n——– SONG MENU ——–n 1 |’…
‘ Bohemian Rhapsody n 2 | ‘ …
‘Dies Irae n 3 | Entry Into Valhalla n 4 | Fur Elise n 5 | ‘ …
‘Game of Thrones Theme n 6 | He”s a Pirate n 7 | Megalovania ‘ …
‘Long n 8 | Paint it Black n’])
% Prompt user for selection, and check validity of choice
songNum = input([‘Enter the number of the song you wish to play –> n’]);
while songNum < 0 || songNum > 9 || mod(songNum,1) ~= 0
songNum = input(‘Try again –> ‘);
endHello. I am working on a Jukebox to play a song that corrisponds with set number (this part is not the issue I am just trying to provide some context).
When the code is run I would like the Opening menu to appear in the command window so the user can see the song choices before being prompted to enter an input. The problem is that when I run the code it does not print any of my text and just waits for an input. I think it has something to do with the fact that other than declaring some variables, there is nothing happening before the first fprintf. I am not getting any error or warning messages on my end.
Is this a quirk of using the online version? I am using the online verison of MATlab because I am having techinal issues with installing the desktop version.
(This is not all of my code, I chose to only share what is relevent to my issue)
clear
clc
close all
%% Declarations
rate = 32768; % sampling rate
songs = 1:9;
octave = 0;
speed = 0;
% Opening menu. Give list of options
fprintf([‘Welcome to Jukebox.n——– SONG MENU ——–n 1 |’…
‘ Bohemian Rhapsody n 2 | ‘ …
‘Dies Irae n 3 | Entry Into Valhalla n 4 | Fur Elise n 5 | ‘ …
‘Game of Thrones Theme n 6 | He”s a Pirate n 7 | Megalovania ‘ …
‘Long n 8 | Paint it Black n’])
% Prompt user for selection, and check validity of choice
songNum = input([‘Enter the number of the song you wish to play –> n’]);
while songNum < 0 || songNum > 9 || mod(songNum,1) ~= 0
songNum = input(‘Try again –> ‘);
end Hello. I am working on a Jukebox to play a song that corrisponds with set number (this part is not the issue I am just trying to provide some context).
When the code is run I would like the Opening menu to appear in the command window so the user can see the song choices before being prompted to enter an input. The problem is that when I run the code it does not print any of my text and just waits for an input. I think it has something to do with the fact that other than declaring some variables, there is nothing happening before the first fprintf. I am not getting any error or warning messages on my end.
Is this a quirk of using the online version? I am using the online verison of MATlab because I am having techinal issues with installing the desktop version.
(This is not all of my code, I chose to only share what is relevent to my issue)
clear
clc
close all
%% Declarations
rate = 32768; % sampling rate
songs = 1:9;
octave = 0;
speed = 0;
% Opening menu. Give list of options
fprintf([‘Welcome to Jukebox.n——– SONG MENU ——–n 1 |’…
‘ Bohemian Rhapsody n 2 | ‘ …
‘Dies Irae n 3 | Entry Into Valhalla n 4 | Fur Elise n 5 | ‘ …
‘Game of Thrones Theme n 6 | He”s a Pirate n 7 | Megalovania ‘ …
‘Long n 8 | Paint it Black n’])
% Prompt user for selection, and check validity of choice
songNum = input([‘Enter the number of the song you wish to play –> n’]);
while songNum < 0 || songNum > 9 || mod(songNum,1) ~= 0
songNum = input(‘Try again –> ‘);
end fprintf, input, matlab MATLAB Answers — New Questions
Update #21 for Automating Microsoft 365 with PowerShell
March 2026 Release for Automating Microsoft 365 with PowerShell eBook
The Automating Microsoft 365 with PowerShell eBook is part of the Office 365 for IT Pros eBook bundle and is also sold separately, including a paperback version. Like the rest of the Office 365 for IT Pros eBook, each month we update Automating Microsoft 365 with PowerShell to add new content, improve existing content, or prune material that is no longer current. We release the update before the start of the month to allow us time to concentrate on the “big book,” and that’s why update #21 for Automating Microsoft 365 with PowerShell is now available for subscribers to download.
Subscribers can fetch the updated EPUB and PDF files from their Gumroad.com account using the link in the receipt emailed for their subscription. We plan to release the March 2026 update for Office 365 for IT Pros on March 1, 2026.
The current version number is 21.2 dated 20 February 2026. The PDF is 390 pages long, or 150,116 words. Because of Amazon KDP formatting rules and because it includes an index, the current paperback version (Figure 1) is 415 pages long. We’ve added 30 pages of content and practical ready-to-use examples to the book since I last got a printed copy in October 2025.

Microsoft Graph PowerShell SDK V2.35.1
On February 5, Microsoft released V2.35.1 of the Microsoft Graph PowerShell SDK. As you might recall, Microsoft rushed out V2.34 just before Christmas 2025 to fix a security issue. As a consequence of the fix, WAM (Web Account Manager) became the default for interactive sessions on Windows PCs. The change wasn’t a problem for anyone who signs into Graph SDK interactive sessions with the same account as they use to sign into Windows, but as we all know, the world isn’t perfect and many different ways to sign into Windows environments exist, including hybrid setups where accounts are hosted by on-premises Active Directory.
Microsoft released V2.34 to address some reported issues with hybrid connections, followed soon after by V2.35.1. So far, my tests show that the release is at least as stable as V2.34. In other words, I haven’t run into anything odd that caused me to log an issue in the Microsoft Graph PowerShell SDK GitHub repository. (unkind people would say that I’m waiting for Microsoft to fix the issues already logged, but that’s not the case). Some folks report that V2.35.1 is incompatible with password managers (I haven’t had an issue using Bitwarden). If you run into a problem, please report it by logging an issue in GitHub.
Keep Current with Other Important Microsoft 365 Modules
The updates for the Microsoft Graph PowerShell SDK prompt me to note the latest versions of important Microsoft 365 PowerShell modules include:
- Microsoft Entra (based on the Microsoft Graph PowerShell SDK): 1.2
- Microsoft Teams: 7.6
- Exchange Online management: 3.9.2. Microsoft is busy removing old bits from this module, so make sure that these changes don’t impact production scripts. The latest change is the deprecation of the Credential parameter for the Connect-ExchangeOnline cmdlet.
- SharePoint Online management: 16.0.26914.12004
Remember to update these and other modules used in scripts to stay current. For example, I use the ImportExcel module to generate Excel worksheets instead of CSV files for reports. The current version for ImportExcel is 7.8.10. It’s also important to keep the modules used by Azure Automation runbooks current.
On to Update #22
Once the March update for Office 365 for IT Pros is squared away, we’ll start thinking about the next update for Automating Microsoft 365 with PowerShell. One thing’s for sure: we’ll always have something to write about.
Need help to write and manage PowerShell scripts for Microsoft 365, including Azure Automation runbooks? Get a copy of the Automating Microsoft 365 with PowerShell eBook, available standalone or as part of the Office 365 for IT Pros eBook bundle.
How to load data from Octave?
I have a .M file from Octave that I want to run in MATLAB, but I obtain an error. Here is the content of .M file (it’s just one line):
load "Slovenia_centered.mat"
And here is the error:
Error using load
Unable to read file ‘"Slovenia_centered.mat"’: Invalid argument.
Error in
Slovenia_centered (line 1)
load "Slovenia_centered.mat"
^^^^I have a .M file from Octave that I want to run in MATLAB, but I obtain an error. Here is the content of .M file (it’s just one line):
load "Slovenia_centered.mat"
And here is the error:
Error using load
Unable to read file ‘"Slovenia_centered.mat"’: Invalid argument.
Error in
Slovenia_centered (line 1)
load "Slovenia_centered.mat"
^^^^ I have a .M file from Octave that I want to run in MATLAB, but I obtain an error. Here is the content of .M file (it’s just one line):
load "Slovenia_centered.mat"
And here is the error:
Error using load
Unable to read file ‘"Slovenia_centered.mat"’: Invalid argument.
Error in
Slovenia_centered (line 1)
load "Slovenia_centered.mat"
^^^^ load MATLAB Answers — New Questions
What are the Differences between Simulink “Powertrain blockset” and “Simscape Driveline” in the case of developing a Hybrid Electric Vehicle?
Hello all. I am working on developing Energy Management Strategies for Hybrid Electric Vehicles using MATLAB and Simulink. I am now in the modelling phase and am quite stuck and confused over which approach to take. Should I develop the powertrain components in Simulink using "MATLAB FCN" blocks, or should I use Simulink libraries? If the latter, which library should I choose? Powertrain Blockset or Simscape Driveline? Which is more suited for my application? Pros and cons for both? Thanks for any help.Hello all. I am working on developing Energy Management Strategies for Hybrid Electric Vehicles using MATLAB and Simulink. I am now in the modelling phase and am quite stuck and confused over which approach to take. Should I develop the powertrain components in Simulink using "MATLAB FCN" blocks, or should I use Simulink libraries? If the latter, which library should I choose? Powertrain Blockset or Simscape Driveline? Which is more suited for my application? Pros and cons for both? Thanks for any help. Hello all. I am working on developing Energy Management Strategies for Hybrid Electric Vehicles using MATLAB and Simulink. I am now in the modelling phase and am quite stuck and confused over which approach to take. Should I develop the powertrain components in Simulink using "MATLAB FCN" blocks, or should I use Simulink libraries? If the latter, which library should I choose? Powertrain Blockset or Simscape Driveline? Which is more suited for my application? Pros and cons for both? Thanks for any help. simulink, hev, driveline, powertrainblockset MATLAB Answers — New Questions
Seeking advice on batch processing for opacity masking in ARK(Auto-Refractor Keratometer) retroillumination images (500+ images)
Hello everyone,
I am a graduate student and a relatively new user of MATLAB. I am currently working on a research project involving the analysis of ARK (Auto-Refractor Keratometer) retroillumination images to study cataracts.
I have successfully completed the first step, which is segmenting the pupil ROI (mask) from the anterior segment images using the Segment Anything Model (SAM).
Now, I am facing a challenge: I need to precisely mask the opacities (cloudy areas) within the identified pupil region. While I can perform this task for a single image using SAM, I have a dataset of approximately 500 images, making individual manual processing impractical.
I am looking for guidance on how to automate this process in MATLAB. Specifically:
Are there recommended image processing techniques (e.g., adaptive thresholding, texture analysis, or morphological operations) that work well for identifying cataract opacities within a pupil mask?
Is there a way to batch-process these 500 images efficiently while maintaining high precision?
Are there any existing File Exchange entries or toolboxes you would recommend for this type of medical image segmentation?
I would greatly appreciate any advice, code snippets, or references to help me move forward with my research.
Thank you in advance for your help!
Best regards,Hello everyone,
I am a graduate student and a relatively new user of MATLAB. I am currently working on a research project involving the analysis of ARK (Auto-Refractor Keratometer) retroillumination images to study cataracts.
I have successfully completed the first step, which is segmenting the pupil ROI (mask) from the anterior segment images using the Segment Anything Model (SAM).
Now, I am facing a challenge: I need to precisely mask the opacities (cloudy areas) within the identified pupil region. While I can perform this task for a single image using SAM, I have a dataset of approximately 500 images, making individual manual processing impractical.
I am looking for guidance on how to automate this process in MATLAB. Specifically:
Are there recommended image processing techniques (e.g., adaptive thresholding, texture analysis, or morphological operations) that work well for identifying cataract opacities within a pupil mask?
Is there a way to batch-process these 500 images efficiently while maintaining high precision?
Are there any existing File Exchange entries or toolboxes you would recommend for this type of medical image segmentation?
I would greatly appreciate any advice, code snippets, or references to help me move forward with my research.
Thank you in advance for your help!
Best regards, Hello everyone,
I am a graduate student and a relatively new user of MATLAB. I am currently working on a research project involving the analysis of ARK (Auto-Refractor Keratometer) retroillumination images to study cataracts.
I have successfully completed the first step, which is segmenting the pupil ROI (mask) from the anterior segment images using the Segment Anything Model (SAM).
Now, I am facing a challenge: I need to precisely mask the opacities (cloudy areas) within the identified pupil region. While I can perform this task for a single image using SAM, I have a dataset of approximately 500 images, making individual manual processing impractical.
I am looking for guidance on how to automate this process in MATLAB. Specifically:
Are there recommended image processing techniques (e.g., adaptive thresholding, texture analysis, or morphological operations) that work well for identifying cataract opacities within a pupil mask?
Is there a way to batch-process these 500 images efficiently while maintaining high precision?
Are there any existing File Exchange entries or toolboxes you would recommend for this type of medical image segmentation?
I would greatly appreciate any advice, code snippets, or references to help me move forward with my research.
Thank you in advance for your help!
Best regards, image processing, masking, image processing toolbox MATLAB Answers — New Questions
The fourier series coefficient phase
I am trying to get the x[n] from fourier coefficients, then I used the fft to find the coefficients of my x[n] and compare it with the prompt. So Here is the code
N = 8; % the period
figure;
k = -4:3; % the index for fourier transform
a_k = [0,0,1,1,1,1,1,0]; % fourier series
subplot(2,2,1);
stem(k,abs(a_k)); % plot the magnitude of the fourier coefficient
xlabel(‘k’); ylabel(‘|a_k|’); title(‘Magnitude of the Fourier Series Coefficient Directly From Prompt’); %xlabel tilte and ylabel
subplot(2,2,3);
stem(k,angle(a_k)); % plot the phase of the fourier coefficient
xlabel(‘k’); ylabel(‘phase of a_k’); title(‘Phase of the Fourier Series Coefficient Directly Prompt’);%xlabel title and ylabel
x = zeros(1,N);
n = -4:3; % the n matrix
w = 2*pi/N; % omega
A = [1,2,2,0,0,0,0,0]; % the cos wave amplitude
phi = [0,0,0,0,0,0,0,0]; % the phase
for i = 1:N
x = x+A(i)*cos((i-1)*w*n+phi(i));
end
ak_re = fft(fftshift(x)); % the coefficients
ak_shifted = fftshift(ak_re); % shifted version
subplot(2,2,2);
stem(k,abs(ak_shifted)/N);% stem plot
xlabel(‘k’); ylabel(‘|a_k|’); title(‘Magnitude of the Fourier Series Coefficient by FFT’); %xlabel tilte and ylabel
subplot(2,2,4);
stem(k,angle(ak_shifted));% stem plot
xlabel(‘k’); ylabel(‘phase of a_k’); title(‘Phase of the Fourier Series Coefficient by FFT’);%xlabel title and ylabel
x_re = N*fftshift(ifft(ifftshift(a_k))); % Rebuilt x[n]
figure;
subplot(1,2,1);
stem(n,x_re); % plot the original graph
xlabel(‘n’); ylabel(‘x[n]’); title(‘Plot of x[n] Rebuilt from Coefficients’); %xlabel tilte and ylabel
subplot(1,2,2);
stem(n,x); % stem plot
xlabel(‘n’); % xlabel of the x[n]
ylabel(‘x[n]’); % ylabel
title(‘Plot of x[n] Directly from Expression’); % title
I find out that x[n] plots are same, but a_k plots are a little bit off on phase plots. Apparently the Phase of the Fourier Series Coefficient by FFT is not equal to the original phase of the coefficients by prompt. They are like half periods off. So I tried to use fftshift, but it did not help. So please let me know what is wrong here.I am trying to get the x[n] from fourier coefficients, then I used the fft to find the coefficients of my x[n] and compare it with the prompt. So Here is the code
N = 8; % the period
figure;
k = -4:3; % the index for fourier transform
a_k = [0,0,1,1,1,1,1,0]; % fourier series
subplot(2,2,1);
stem(k,abs(a_k)); % plot the magnitude of the fourier coefficient
xlabel(‘k’); ylabel(‘|a_k|’); title(‘Magnitude of the Fourier Series Coefficient Directly From Prompt’); %xlabel tilte and ylabel
subplot(2,2,3);
stem(k,angle(a_k)); % plot the phase of the fourier coefficient
xlabel(‘k’); ylabel(‘phase of a_k’); title(‘Phase of the Fourier Series Coefficient Directly Prompt’);%xlabel title and ylabel
x = zeros(1,N);
n = -4:3; % the n matrix
w = 2*pi/N; % omega
A = [1,2,2,0,0,0,0,0]; % the cos wave amplitude
phi = [0,0,0,0,0,0,0,0]; % the phase
for i = 1:N
x = x+A(i)*cos((i-1)*w*n+phi(i));
end
ak_re = fft(fftshift(x)); % the coefficients
ak_shifted = fftshift(ak_re); % shifted version
subplot(2,2,2);
stem(k,abs(ak_shifted)/N);% stem plot
xlabel(‘k’); ylabel(‘|a_k|’); title(‘Magnitude of the Fourier Series Coefficient by FFT’); %xlabel tilte and ylabel
subplot(2,2,4);
stem(k,angle(ak_shifted));% stem plot
xlabel(‘k’); ylabel(‘phase of a_k’); title(‘Phase of the Fourier Series Coefficient by FFT’);%xlabel title and ylabel
x_re = N*fftshift(ifft(ifftshift(a_k))); % Rebuilt x[n]
figure;
subplot(1,2,1);
stem(n,x_re); % plot the original graph
xlabel(‘n’); ylabel(‘x[n]’); title(‘Plot of x[n] Rebuilt from Coefficients’); %xlabel tilte and ylabel
subplot(1,2,2);
stem(n,x); % stem plot
xlabel(‘n’); % xlabel of the x[n]
ylabel(‘x[n]’); % ylabel
title(‘Plot of x[n] Directly from Expression’); % title
I find out that x[n] plots are same, but a_k plots are a little bit off on phase plots. Apparently the Phase of the Fourier Series Coefficient by FFT is not equal to the original phase of the coefficients by prompt. They are like half periods off. So I tried to use fftshift, but it did not help. So please let me know what is wrong here. I am trying to get the x[n] from fourier coefficients, then I used the fft to find the coefficients of my x[n] and compare it with the prompt. So Here is the code
N = 8; % the period
figure;
k = -4:3; % the index for fourier transform
a_k = [0,0,1,1,1,1,1,0]; % fourier series
subplot(2,2,1);
stem(k,abs(a_k)); % plot the magnitude of the fourier coefficient
xlabel(‘k’); ylabel(‘|a_k|’); title(‘Magnitude of the Fourier Series Coefficient Directly From Prompt’); %xlabel tilte and ylabel
subplot(2,2,3);
stem(k,angle(a_k)); % plot the phase of the fourier coefficient
xlabel(‘k’); ylabel(‘phase of a_k’); title(‘Phase of the Fourier Series Coefficient Directly Prompt’);%xlabel title and ylabel
x = zeros(1,N);
n = -4:3; % the n matrix
w = 2*pi/N; % omega
A = [1,2,2,0,0,0,0,0]; % the cos wave amplitude
phi = [0,0,0,0,0,0,0,0]; % the phase
for i = 1:N
x = x+A(i)*cos((i-1)*w*n+phi(i));
end
ak_re = fft(fftshift(x)); % the coefficients
ak_shifted = fftshift(ak_re); % shifted version
subplot(2,2,2);
stem(k,abs(ak_shifted)/N);% stem plot
xlabel(‘k’); ylabel(‘|a_k|’); title(‘Magnitude of the Fourier Series Coefficient by FFT’); %xlabel tilte and ylabel
subplot(2,2,4);
stem(k,angle(ak_shifted));% stem plot
xlabel(‘k’); ylabel(‘phase of a_k’); title(‘Phase of the Fourier Series Coefficient by FFT’);%xlabel title and ylabel
x_re = N*fftshift(ifft(ifftshift(a_k))); % Rebuilt x[n]
figure;
subplot(1,2,1);
stem(n,x_re); % plot the original graph
xlabel(‘n’); ylabel(‘x[n]’); title(‘Plot of x[n] Rebuilt from Coefficients’); %xlabel tilte and ylabel
subplot(1,2,2);
stem(n,x); % stem plot
xlabel(‘n’); % xlabel of the x[n]
ylabel(‘x[n]’); % ylabel
title(‘Plot of x[n] Directly from Expression’); % title
I find out that x[n] plots are same, but a_k plots are a little bit off on phase plots. Apparently the Phase of the Fourier Series Coefficient by FFT is not equal to the original phase of the coefficients by prompt. They are like half periods off. So I tried to use fftshift, but it did not help. So please let me know what is wrong here. matlab, fft, ifft, fftshift MATLAB Answers — New Questions
Asha Sharma named EVP and CEO, Microsoft Gaming
Satya Nadella, Chairman and CEO, and members of his executive team shared the following communications with employees today.
SATYA NADELLA MESSAGE
Gaming has been part of Microsoft from the start. Flight Simulator shipped before Windows, and you can practically ray‑trace a line from DirectX in the ’90s to the accelerated‑compute era we’re in today.
As we celebrate Xbox’s 25th year, the opportunity and innovation agenda in front of us is expansive. Today we reach over 500 million monthly active users, are a top publisher across all platforms, and continue to innovate across gaming hardware, content, and community, in service of creators and players everywhere.
I am long on gaming and its role at the center of our consumer ambition, and as we look ahead, I’m excited to share that Asha Sharma will become Executive Vice President and CEO, Microsoft Gaming, reporting to me. Over the last two years at Microsoft, and previously as Chief Operating Officer at Instacart and a Vice President at Meta, Asha has helped build and scale services that reach billions of people and support thriving consumer and developer ecosystems. She brings deep experience building and growing platforms, aligning business models to long-term value, and operating at global scale, which will be critical in leading our gaming business into its next era of growth.
Matt Booty will become Executive Vice President and Chief Content Officer, reporting to Asha. Matt’s career reflects a lifelong commitment to games and to the people who make them. Under his leadership, Microsoft Gaming has grown to span nearly 40 studios across Xbox, Bethesda, Activision Blizzard, and King, which are home to beloved franchises including Halo, The Elder Scrolls, Call of Duty, World of Warcraft, Diablo, Candy Crush, and Fallout.
Together, Asha and Matt have the right combination of consumer product leadership and gaming depth to push our platform innovation and content pipeline forward. Last year, Phil Spencer made the decision to retire from the company, and since then we’ve been talking about succession planning. I want to thank Phil for his extraordinary leadership and partnership. Over 38 years at Microsoft, including 12 years leading Gaming, Phil helped transform what we do and how we do it. He expanded our reach across PC, mobile, and cloud; nearly tripled the size of the business; helped shape our strategy through the acquisitions of Activision Blizzard, ZeniMax, and Minecraft; and strengthened our culture across our studios and platforms. I’ve long admired Phil’s unwavering commitment to players, creators, and his team, and I am personally grateful for his leadership and counsel. He will continue working closely with Asha to ensure a smooth transition.
We have extraordinary creative talent across our studios and a global platform that is second to none. I’m excited for how we will capture the opportunity ahead and define what comes next, while staying grounded in what players and creators value.
Please join me in congratulating Asha and Matt on their new roles, and in thanking Phil for everything he has done for Microsoft and for our industry.
PHIL SPENCER MESSAGE
When I walked through Microsoft’s doors as an intern in June of 1988, I could never have imagined the products I’d help build, the players and customers we’d serve, or the extraordinary teams I’d be lucky enough to join. It’s been an epic ride and truly the privilege of a lifetime.
Last fall, I shared with Satya that I was thinking about stepping back and starting the next chapter of my life. From that moment, we aligned on approaching this transition with intention, ensuring stability, and strengthening the foundation we’ve built. Xbox has always been more than a business. It’s a vibrant community of players, creators, and teams who care deeply about what we build and how we build it. And it deserves a thoughtful, deliberate plan for the road ahead.
Today marks an exciting new chapter for Microsoft Gaming as Asha Sharma steps into the role of CEO, and I want to be the first to welcome her to this incredible team. Working with her over the past several months has given me tremendous confidence. She brings genuine curiosity, clarity and a deep commitment to understanding players, creators, and the decisions that shape our future. We know this is an important moment for our fans, partners, and team, and we’re committed to getting it right. I’ll remain in an advisory role through the summer to support a smooth handoff.
I’m also grateful for the strength of our studios organization. Matt Booty and our studios teams continue to build an incredible portfolio, and I have full confidence in the leadership and creative momentum across our global studios. I want to congratulate Matt on his promotion to EVP and Chief Content Officer.
As part of this transition, Sarah Bond has decided to leave Microsoft to begin a new chapter. Sarah has been instrumental during a defining period for Xbox, shaping our platform strategy, expanding Game Pass and cloud gaming, supporting new hardware launches, and guiding some of the most significant moments in our history. I’m grateful for her partnership and the impact she’s had, and I wish her the very best in what comes next.
Most of all, to everyone in Microsoft Gaming, I want to say “thank you.” I’ve learned so much from this team and community, grown alongside you, and been continually inspired by the creativity, courage, and care you bring to players, creators, and to one another every day.
I’m incredibly proud of what we’ve built together over the last 25 years, and I have complete confidence in all of you and in the opportunities ahead. I’ll be cheering you on in this next chapter as Xbox’s proudest fan and player.
Phil
XBL: P3
ASHA SHARMA MESSAGE
Dear team,
Today I begin my role as CEO of Microsoft Gaming.
I feel two things at once: humility and urgency.
Humility because this team has built something extraordinary over decades. Urgency because gaming is in a period of rapid change, and we need to move with clarity and conviction.
I am stepping into work shaped by generations of artists, engineers, designers, writers, musicians, operators and more who create worlds that have brought joy and deep personal meaning to hundreds of millions of players. The level of craft here is exceptional, and it is amplified by Xbox, which was founded in the belief that the power of games connects people and pushes the industry forward.
Thank you to Phil for his leadership, and to every studio, platform, and operations team that built this foundation. We are stewards of some of the most loved stories and characters in entertainment and bring players and creators together around the fun and community of gaming in entirely new ways.
My first job is simple: understand what makes this work and protect it.
That starts with three commitments.
First, great games.
Everything begins here. We must have great games beloved by players before we do anything. Unforgettable characters, stories that make us feel, innovative game play, and creative excellence. We will empower our studios, invest in iconic franchises, and back bold new ideas. We will take risks. We will enter new categories and markets where we can add real value, grounded in what players care about most.
I promoted Matt Booty in honor of this commitment. He understands the craft and the challenges of building great games, has led teams that deliver award-winning work, and has earned the trust of game developers across the industry.
Second, the return of Xbox.
We will recommit to our core Xbox fans and players, those who have invested with us for the past 25 years, and to the developers who build the expansive universes and experiences that are embraced by players across the world.
We will celebrate our roots with a renewed commitment to Xbox starting with console which has shaped who we are. It connects us to the players and fans who invest in Xbox, and to the developers who build ambitious experiences for it.
Gaming now lives across devices, not within the limits of any single piece of hardware. As we expand across PC, mobile, and cloud, Xbox should feel seamless, instant, and worthy of the communities we serve. We will break down barriers so developers can build once and reach players everywhere without compromise.
Third, future of play.
We are witnessing the reinvention of play.
To meet the moment, we will invent new business models and new ways to play by leaning into what we already have: iconic teams, characters, and worlds that people love. But we will not treat those worlds as static IP to milk and monetize. We will build a shared platform and tools that empower developers and players to create and share their own stories.
As monetization and AI evolve and influence this future, we will not chase short-term efficiency or flood our ecosystem with soulless AI slop. Games are and always will be art, crafted by humans, and created with the most innovative technology provided by us.
The next 25 years belong to the teams who dare to build something surprising, something no one else is willing to try, and have the patience to see it through. We have done this before, and I am here to help us do it again. I want to return to the renegade spirit that built Xbox in the first place. It will require us to relentlessly question everything, revisit processes, protect what works, and be brave enough to change what does not.
Thank you for welcoming me into this journey.
Asha
MATT BOOTY MESSAGE
I read Phil’s note with much gratitude. He has been a steady champion for game creators and our studio teams, and I’ve learned so much from his leadership over the years. All our games have benefited from his foundational support. I’m also grateful to Satya for his ongoing commitment to gaming and holding a vision of how it can connect back to the larger company.
Looking forward, I’m excited to partner with Asha as our next CEO. Our first conversations centered on her commitment to making great games and the role that plays in our overall success. She asks questions, pushes for clarity, and wants our choices grounded in player and developer needs. That mindset matters as the industry around us is changing quickly: how players engage, how games are made, and how business models and platforms evolve.
We have good reasons to believe in what’s ahead. This organization and its franchises have navigated change for decades, and our strength comes from teams who know how to adapt and keep delivering. That confidence is grounded in a strong pipeline of established franchises, new bets we believe in, and clear player demand for what we are building.
My focus is on supporting the teams and leaders we have in place and creating the conditions for them to do their best work. To be clear, there are no organizational changes underway for our studios.
Thanks for everything you do for players and for each other.
Matt
The post Asha Sharma named EVP and CEO, Microsoft Gaming appeared first on The Official Microsoft Blog.
Satya Nadella, Chairman and CEO, and members of his executive team shared the following communications with employees today. SATYA NADELLA MESSAGE Gaming has been part of Microsoft from the start. Flight Simulator shipped before Windows, and you can practically ray‑trace a line from DirectX in the ’90s to the accelerated‑compute era we’re in today. As…
The post Asha Sharma named EVP and CEO, Microsoft Gaming appeared first on The Official Microsoft Blog.
Read More
Deconvolution using FFT – a classical problem
Hello friends, I am new to signal processing and I am trying to achive deconvolution using FFT. I have an input step function u(t) applied to an impulse response given by . The output function is . I am trying to convolve g and u to get y as well as deconvolve y and g to get u. However, I quite cannot get the right answers. I understand that the deconvolution process is ill-posed and I have to use some kind of normalization process but I am lost. I also apply zero padding to twice the length of the input signals. Any sort of guidance will be appreciated.
After using deconvolution in the fourier domain:
Y = fft(y)
G = fft(g)
X = Y./G
x = ifft(X)
I am getting an output shown below:
Which is not the expected outcome. Can someone shead light on what is happening here? Thank you.Hello friends, I am new to signal processing and I am trying to achive deconvolution using FFT. I have an input step function u(t) applied to an impulse response given by . The output function is . I am trying to convolve g and u to get y as well as deconvolve y and g to get u. However, I quite cannot get the right answers. I understand that the deconvolution process is ill-posed and I have to use some kind of normalization process but I am lost. I also apply zero padding to twice the length of the input signals. Any sort of guidance will be appreciated.
After using deconvolution in the fourier domain:
Y = fft(y)
G = fft(g)
X = Y./G
x = ifft(X)
I am getting an output shown below:
Which is not the expected outcome. Can someone shead light on what is happening here? Thank you. Hello friends, I am new to signal processing and I am trying to achive deconvolution using FFT. I have an input step function u(t) applied to an impulse response given by . The output function is . I am trying to convolve g and u to get y as well as deconvolve y and g to get u. However, I quite cannot get the right answers. I understand that the deconvolution process is ill-posed and I have to use some kind of normalization process but I am lost. I also apply zero padding to twice the length of the input signals. Any sort of guidance will be appreciated.
After using deconvolution in the fourier domain:
Y = fft(y)
G = fft(g)
X = Y./G
x = ifft(X)
I am getting an output shown below:
Which is not the expected outcome. Can someone shead light on what is happening here? Thank you. deconvolution, fft, inverse problem MATLAB Answers — New Questions
How to do Multichannel statistical analysis?
I just need an example:
%% Load data
% Lab says use readtable, then convert to array
T = readtable("Section2.csv");
data = table2array(T);
% Assumption: column 1 is time/index, columns 2:11 are the 10 subjects
X = data(:,2:11); % Nx10 matrix (each column = one subject)
%% =========================
% [3.2] Central tendency + dispersion for each subject
% mean, median, range, std (one value per subject/column)
% =========================
mean_data = mean(X, ‘omitnan’); % 1×10
median_data = median(X, ‘omitnan’); % 1×10
% Use max-min for range (robust if MATLAB "range" gives issues)
range_data = max(X, [], 1) – min(X, [], 1); % 1×10
std_data = std(X, 0, ‘omitnan’); % 1×10 (0 = sample std)
%% =========================
% [3.2] Find which subject has max/min for each metric
% Lab asks to do this by code (not by looking)
% =========================
[max_mean, subj_max_mean] = max(mean_data);
[min_mean, subj_min_mean] = min(mean_data);
[max_median, subj_max_median] = max(median_data);
[min_median, subj_min_median] = min(median_data);
[max_range, subj_max_range] = max(range_data);
[min_range, subj_min_range] = min(range_data);
[max_std, subj_max_std] = max(std_data);
[min_std, subj_min_std] = min(std_data);
% Display summary
fprintf(‘n=== Subject Extremes (Subjects 1-10) ===n’);
fprintf(‘Mean : max = %.2f (Subject %d), min = %.2f (Subject %d)n’, …
max_mean, subj_max_mean, min_mean, subj_min_mean);
fprintf(‘Median : max = %.2f (Subject %d), min = %.2f (Subject %d)n’, …
max_median, subj_max_median, min_median, subj_min_median);
fprintf(‘Range : max = %.2f (Subject %d), min = %.2f (Subject %d)n’, …
max_range, subj_max_range, min_range, subj_min_range);
fprintf(‘Std Dev: max = %.2f (Subject %d), min = %.2f (Subject %d)n’, …
max_std, subj_max_std, min_std, subj_min_std);
%% =========================
% [3.2] Time spent > (mean + 20 bpm), in HOURS
% Lab says each row = 5 seconds
% =========================
function hours = time_over(colVec, meanVal)
% colVec = one subject’s HR time series (Nx1)
% meanVal = mean HR for that subject
count = sum(colVec > (meanVal + 20)); % number of samples above threshold
hours = (count * 5) / 3600; % 5 s/sample -> hours
end
% Compute for all 10 subjects
hours_over = zeros(1,10);
for s = 1:10
hours_over(s) = time_over(X(:,s), mean_data(s));
end
% Optional: display results neatly
fprintf(‘n=== Time above (mean + 20 bpm) ===n’);
for s = 1:10
fprintf(‘Subject %d: %.3f hoursn’, s, hours_over(s));
end
%% Optional: put everything into a table (nice for report/checking)
subject_id = (1:10)’;
resultsTbl = table(subject_id, mean_data’, median_data’, range_data’, std_data’, hours_over’, …
‘VariableNames’, {‘Subject’,’MeanHR’,’MedianHR’,’RangeHR’,’StdHR’,’HoursAboveMeanPlus20′});
disp(resultsTbl);I just need an example:
%% Load data
% Lab says use readtable, then convert to array
T = readtable("Section2.csv");
data = table2array(T);
% Assumption: column 1 is time/index, columns 2:11 are the 10 subjects
X = data(:,2:11); % Nx10 matrix (each column = one subject)
%% =========================
% [3.2] Central tendency + dispersion for each subject
% mean, median, range, std (one value per subject/column)
% =========================
mean_data = mean(X, ‘omitnan’); % 1×10
median_data = median(X, ‘omitnan’); % 1×10
% Use max-min for range (robust if MATLAB "range" gives issues)
range_data = max(X, [], 1) – min(X, [], 1); % 1×10
std_data = std(X, 0, ‘omitnan’); % 1×10 (0 = sample std)
%% =========================
% [3.2] Find which subject has max/min for each metric
% Lab asks to do this by code (not by looking)
% =========================
[max_mean, subj_max_mean] = max(mean_data);
[min_mean, subj_min_mean] = min(mean_data);
[max_median, subj_max_median] = max(median_data);
[min_median, subj_min_median] = min(median_data);
[max_range, subj_max_range] = max(range_data);
[min_range, subj_min_range] = min(range_data);
[max_std, subj_max_std] = max(std_data);
[min_std, subj_min_std] = min(std_data);
% Display summary
fprintf(‘n=== Subject Extremes (Subjects 1-10) ===n’);
fprintf(‘Mean : max = %.2f (Subject %d), min = %.2f (Subject %d)n’, …
max_mean, subj_max_mean, min_mean, subj_min_mean);
fprintf(‘Median : max = %.2f (Subject %d), min = %.2f (Subject %d)n’, …
max_median, subj_max_median, min_median, subj_min_median);
fprintf(‘Range : max = %.2f (Subject %d), min = %.2f (Subject %d)n’, …
max_range, subj_max_range, min_range, subj_min_range);
fprintf(‘Std Dev: max = %.2f (Subject %d), min = %.2f (Subject %d)n’, …
max_std, subj_max_std, min_std, subj_min_std);
%% =========================
% [3.2] Time spent > (mean + 20 bpm), in HOURS
% Lab says each row = 5 seconds
% =========================
function hours = time_over(colVec, meanVal)
% colVec = one subject’s HR time series (Nx1)
% meanVal = mean HR for that subject
count = sum(colVec > (meanVal + 20)); % number of samples above threshold
hours = (count * 5) / 3600; % 5 s/sample -> hours
end
% Compute for all 10 subjects
hours_over = zeros(1,10);
for s = 1:10
hours_over(s) = time_over(X(:,s), mean_data(s));
end
% Optional: display results neatly
fprintf(‘n=== Time above (mean + 20 bpm) ===n’);
for s = 1:10
fprintf(‘Subject %d: %.3f hoursn’, s, hours_over(s));
end
%% Optional: put everything into a table (nice for report/checking)
subject_id = (1:10)’;
resultsTbl = table(subject_id, mean_data’, median_data’, range_data’, std_data’, hours_over’, …
‘VariableNames’, {‘Subject’,’MeanHR’,’MedianHR’,’RangeHR’,’StdHR’,’HoursAboveMeanPlus20′});
disp(resultsTbl); I just need an example:
%% Load data
% Lab says use readtable, then convert to array
T = readtable("Section2.csv");
data = table2array(T);
% Assumption: column 1 is time/index, columns 2:11 are the 10 subjects
X = data(:,2:11); % Nx10 matrix (each column = one subject)
%% =========================
% [3.2] Central tendency + dispersion for each subject
% mean, median, range, std (one value per subject/column)
% =========================
mean_data = mean(X, ‘omitnan’); % 1×10
median_data = median(X, ‘omitnan’); % 1×10
% Use max-min for range (robust if MATLAB "range" gives issues)
range_data = max(X, [], 1) – min(X, [], 1); % 1×10
std_data = std(X, 0, ‘omitnan’); % 1×10 (0 = sample std)
%% =========================
% [3.2] Find which subject has max/min for each metric
% Lab asks to do this by code (not by looking)
% =========================
[max_mean, subj_max_mean] = max(mean_data);
[min_mean, subj_min_mean] = min(mean_data);
[max_median, subj_max_median] = max(median_data);
[min_median, subj_min_median] = min(median_data);
[max_range, subj_max_range] = max(range_data);
[min_range, subj_min_range] = min(range_data);
[max_std, subj_max_std] = max(std_data);
[min_std, subj_min_std] = min(std_data);
% Display summary
fprintf(‘n=== Subject Extremes (Subjects 1-10) ===n’);
fprintf(‘Mean : max = %.2f (Subject %d), min = %.2f (Subject %d)n’, …
max_mean, subj_max_mean, min_mean, subj_min_mean);
fprintf(‘Median : max = %.2f (Subject %d), min = %.2f (Subject %d)n’, …
max_median, subj_max_median, min_median, subj_min_median);
fprintf(‘Range : max = %.2f (Subject %d), min = %.2f (Subject %d)n’, …
max_range, subj_max_range, min_range, subj_min_range);
fprintf(‘Std Dev: max = %.2f (Subject %d), min = %.2f (Subject %d)n’, …
max_std, subj_max_std, min_std, subj_min_std);
%% =========================
% [3.2] Time spent > (mean + 20 bpm), in HOURS
% Lab says each row = 5 seconds
% =========================
function hours = time_over(colVec, meanVal)
% colVec = one subject’s HR time series (Nx1)
% meanVal = mean HR for that subject
count = sum(colVec > (meanVal + 20)); % number of samples above threshold
hours = (count * 5) / 3600; % 5 s/sample -> hours
end
% Compute for all 10 subjects
hours_over = zeros(1,10);
for s = 1:10
hours_over(s) = time_over(X(:,s), mean_data(s));
end
% Optional: display results neatly
fprintf(‘n=== Time above (mean + 20 bpm) ===n’);
for s = 1:10
fprintf(‘Subject %d: %.3f hoursn’, s, hours_over(s));
end
%% Optional: put everything into a table (nice for report/checking)
subject_id = (1:10)’;
resultsTbl = table(subject_id, mean_data’, median_data’, range_data’, std_data’, hours_over’, …
‘VariableNames’, {‘Subject’,’MeanHR’,’MedianHR’,’RangeHR’,’StdHR’,’HoursAboveMeanPlus20′});
disp(resultsTbl); multichannel statistical analysis MATLAB Answers — New Questions
How can i isolate an object and find its orientation with respect to another object?
I am new to image processing toolbox in Matlab and I wanted some directions or steps on how I could do this process. In the center of this image in the center of the hole (on the cross hair), I have a piece of material which is almost hexagonal in shape with reddish color. I have multiple pictures similar to this where the material is oriented slightly differently.
Could someone please tell me how can I isolate this object from the rest of the image and then find its orientation? I tried to use image contrast and segmentation, but it wasnt super clean.I am new to image processing toolbox in Matlab and I wanted some directions or steps on how I could do this process. In the center of this image in the center of the hole (on the cross hair), I have a piece of material which is almost hexagonal in shape with reddish color. I have multiple pictures similar to this where the material is oriented slightly differently.
Could someone please tell me how can I isolate this object from the rest of the image and then find its orientation? I tried to use image contrast and segmentation, but it wasnt super clean. I am new to image processing toolbox in Matlab and I wanted some directions or steps on how I could do this process. In the center of this image in the center of the hole (on the cross hair), I have a piece of material which is almost hexagonal in shape with reddish color. I have multiple pictures similar to this where the material is oriented slightly differently.
Could someone please tell me how can I isolate this object from the rest of the image and then find its orientation? I tried to use image contrast and segmentation, but it wasnt super clean. image processing MATLAB Answers — New Questions
Assessment failure in Task 1 of Solar Energy module: P_AC signal shows incorrect at the end of simulation.
I am experiencing a persistent assessment failure in the "Solar Energy" section, Task 1, of the Power Systems Simulation Onramp course.
The Problem: I have connected the signal labeled P_AC to the Signal Assessment block as instructed. The connection in the model is a solid black line, yet the assessment returns "Incorrect" with a hint suggesting an unconnected signal.
Symptoms:
The Assessment graph shows red dots (incorrect data) specifically at the end of the simulation period (approx. seconds 23-25).
I have confirmed that the Enable MPPT block is set to 0.
Steps already taken:
Deleted and re-connected the P_AC signal multiple times to ensure a solid connection.
Ran the simulation until completion (100% ready).
Used the "Reset" button for the task and re-attempted.
Could you please check if this is a known issue with the auto-grader for this specific task?I am experiencing a persistent assessment failure in the "Solar Energy" section, Task 1, of the Power Systems Simulation Onramp course.
The Problem: I have connected the signal labeled P_AC to the Signal Assessment block as instructed. The connection in the model is a solid black line, yet the assessment returns "Incorrect" with a hint suggesting an unconnected signal.
Symptoms:
The Assessment graph shows red dots (incorrect data) specifically at the end of the simulation period (approx. seconds 23-25).
I have confirmed that the Enable MPPT block is set to 0.
Steps already taken:
Deleted and re-connected the P_AC signal multiple times to ensure a solid connection.
Ran the simulation until completion (100% ready).
Used the "Reset" button for the task and re-attempted.
Could you please check if this is a known issue with the auto-grader for this specific task? I am experiencing a persistent assessment failure in the "Solar Energy" section, Task 1, of the Power Systems Simulation Onramp course.
The Problem: I have connected the signal labeled P_AC to the Signal Assessment block as instructed. The connection in the model is a solid black line, yet the assessment returns "Incorrect" with a hint suggesting an unconnected signal.
Symptoms:
The Assessment graph shows red dots (incorrect data) specifically at the end of the simulation period (approx. seconds 23-25).
I have confirmed that the Enable MPPT block is set to 0.
Steps already taken:
Deleted and re-connected the P_AC signal multiple times to ensure a solid connection.
Ran the simulation until completion (100% ready).
Used the "Reset" button for the task and re-attempted.
Could you please check if this is a known issue with the auto-grader for this specific task? power systems simulation onramp, mppt, signal asse MATLAB Answers — New Questions
Parsing mfunctions with mtree
Given an Nx1 colum vector of strings containing lines of mfunction code, it is possible to use the undocumented function mtree() to parse it into its constituent functions. For example, given,
load Inputs
str1,
the function below will find the starting and ending lines of each of the three function blocks.
[firstLine,lastLine] = functionBlocks(str1)
This works for nested functions as well:
str2,
[firstLine,lastLine] = functionBlocks(str2)
However, I would really like to have the function be able to group the output separately into top-level function blocks and nested function blocks. I know it is possible to do this through a post-analysis of the outputs firstLine and lastLine, but I wonder if it is possible to get information about whether a function block is top-level or nested directly from mtree, i.e., by modifying,
fnSet = T.mtfind(‘Kind’,’FUNCTION’);
Unfortunately, because mtree() is undocumented, it is difficult to fathom its full capabilities. Does anyone know if/how this can be done?
function [firstLine,lastLine] = functionBlocks(str)
T = mtree(strjoin(str,newline));
fnSet = T.mtfind(‘Kind’,’FUNCTION’);
K=fnSet.count;
kset=fnSet.indices;
for k = K:-1:1
fn = fnSet.select(kset(k));
firstLine(k) = fn.lineno;
lastLine(k) = fn.lastone;
end
endGiven an Nx1 colum vector of strings containing lines of mfunction code, it is possible to use the undocumented function mtree() to parse it into its constituent functions. For example, given,
load Inputs
str1,
the function below will find the starting and ending lines of each of the three function blocks.
[firstLine,lastLine] = functionBlocks(str1)
This works for nested functions as well:
str2,
[firstLine,lastLine] = functionBlocks(str2)
However, I would really like to have the function be able to group the output separately into top-level function blocks and nested function blocks. I know it is possible to do this through a post-analysis of the outputs firstLine and lastLine, but I wonder if it is possible to get information about whether a function block is top-level or nested directly from mtree, i.e., by modifying,
fnSet = T.mtfind(‘Kind’,’FUNCTION’);
Unfortunately, because mtree() is undocumented, it is difficult to fathom its full capabilities. Does anyone know if/how this can be done?
function [firstLine,lastLine] = functionBlocks(str)
T = mtree(strjoin(str,newline));
fnSet = T.mtfind(‘Kind’,’FUNCTION’);
K=fnSet.count;
kset=fnSet.indices;
for k = K:-1:1
fn = fnSet.select(kset(k));
firstLine(k) = fn.lineno;
lastLine(k) = fn.lastone;
end
end Given an Nx1 colum vector of strings containing lines of mfunction code, it is possible to use the undocumented function mtree() to parse it into its constituent functions. For example, given,
load Inputs
str1,
the function below will find the starting and ending lines of each of the three function blocks.
[firstLine,lastLine] = functionBlocks(str1)
This works for nested functions as well:
str2,
[firstLine,lastLine] = functionBlocks(str2)
However, I would really like to have the function be able to group the output separately into top-level function blocks and nested function blocks. I know it is possible to do this through a post-analysis of the outputs firstLine and lastLine, but I wonder if it is possible to get information about whether a function block is top-level or nested directly from mtree, i.e., by modifying,
fnSet = T.mtfind(‘Kind’,’FUNCTION’);
Unfortunately, because mtree() is undocumented, it is difficult to fathom its full capabilities. Does anyone know if/how this can be done?
function [firstLine,lastLine] = functionBlocks(str)
T = mtree(strjoin(str,newline));
fnSet = T.mtfind(‘Kind’,’FUNCTION’);
K=fnSet.count;
kset=fnSet.indices;
for k = K:-1:1
fn = fnSet.select(kset(k));
firstLine(k) = fn.lineno;
lastLine(k) = fn.lastone;
end
end mtree, undocumented, parsing, functions MATLAB Answers — New Questions









