Category: News
Customer isn’t receiving a meeting invite
I added the link to Bookings to the bottom of my website https://www.missteams365.com/
Customers who book from my website aren’t receiving a meeting invite even though their email is a required field.
The appointment shows up on my calendar, and it says I’m the organizer. I’m unable to forward the invite or change the meeting.
I added the link to Bookings to the bottom of my website https://www.missteams365.com/ Customers who book from my website aren’t receiving a meeting invite even though their email is a required field. The appointment shows up on my calendar, and it says I’m the organizer. I’m unable to forward the invite or change the meeting. Read More
Create a simulink model fro, python
Hello,
I would like to create an algorithm using evolutionnary strategies in order to identify physical systems represented by block diagrams. To do so, I will need to design an algorithm where a population of systems is modified (not only the parameters but also the structure) and tested at each iteration. I need to simulate the resulting population and in order to do that I need to be able to change one block of the model in simulink, which would be a sub system with different transfer functions. I don’t know simulink very well so is there a way to crate a custom block, to simulate the model from python and to change one part of the model at each run?
Thank you in advance,Hello,
I would like to create an algorithm using evolutionnary strategies in order to identify physical systems represented by block diagrams. To do so, I will need to design an algorithm where a population of systems is modified (not only the parameters but also the structure) and tested at each iteration. I need to simulate the resulting population and in order to do that I need to be able to change one block of the model in simulink, which would be a sub system with different transfer functions. I don’t know simulink very well so is there a way to crate a custom block, to simulate the model from python and to change one part of the model at each run?
Thank you in advance, Hello,
I would like to create an algorithm using evolutionnary strategies in order to identify physical systems represented by block diagrams. To do so, I will need to design an algorithm where a population of systems is modified (not only the parameters but also the structure) and tested at each iteration. I need to simulate the resulting population and in order to do that I need to be able to change one block of the model in simulink, which would be a sub system with different transfer functions. I don’t know simulink very well so is there a way to crate a custom block, to simulate the model from python and to change one part of the model at each run?
Thank you in advance, simulink, python, optimization MATLAB Answers — New Questions
Nonlinear optimization with branching solution space
I would like to solve a nonlinear optimization problem with nonlinear constraints, in which the solution space branches, such that the relevant optimization parameters and their constraints depend upon the branch. In total the problem has 11 optimization parameters however not all parameters are possible together. The primary parameter is an integer ‘x’ = 1-10 (although it could be treated as a continuous variable). The error function f(x) depends also upon other parameters as follows. If x < 10 the error function is f(x, c, d = 0) where ‘c’ is 5 other continuous parameters with constraints, elseif x = 10 the error function is f(x, c = 0, d) where ‘d’ is 5 different continuous parameters with constraints.
It seems simplest to first solve for x assuming c = 0 and d = 0, then solve for ‘c and ‘d’ depending upon the branch, i.e., depending upon whether x < 10 or x = 10, however, those attempts have failed, because if ‘c’ or ‘d’ are nonzero, the data are affected and the solutions for x are incorrect.
Two questions please;
1) Is this problem even well-posed as stated?
2) Does optimization or global optimization have a tool that can solve this?I would like to solve a nonlinear optimization problem with nonlinear constraints, in which the solution space branches, such that the relevant optimization parameters and their constraints depend upon the branch. In total the problem has 11 optimization parameters however not all parameters are possible together. The primary parameter is an integer ‘x’ = 1-10 (although it could be treated as a continuous variable). The error function f(x) depends also upon other parameters as follows. If x < 10 the error function is f(x, c, d = 0) where ‘c’ is 5 other continuous parameters with constraints, elseif x = 10 the error function is f(x, c = 0, d) where ‘d’ is 5 different continuous parameters with constraints.
It seems simplest to first solve for x assuming c = 0 and d = 0, then solve for ‘c and ‘d’ depending upon the branch, i.e., depending upon whether x < 10 or x = 10, however, those attempts have failed, because if ‘c’ or ‘d’ are nonzero, the data are affected and the solutions for x are incorrect.
Two questions please;
1) Is this problem even well-posed as stated?
2) Does optimization or global optimization have a tool that can solve this? I would like to solve a nonlinear optimization problem with nonlinear constraints, in which the solution space branches, such that the relevant optimization parameters and their constraints depend upon the branch. In total the problem has 11 optimization parameters however not all parameters are possible together. The primary parameter is an integer ‘x’ = 1-10 (although it could be treated as a continuous variable). The error function f(x) depends also upon other parameters as follows. If x < 10 the error function is f(x, c, d = 0) where ‘c’ is 5 other continuous parameters with constraints, elseif x = 10 the error function is f(x, c = 0, d) where ‘d’ is 5 different continuous parameters with constraints.
It seems simplest to first solve for x assuming c = 0 and d = 0, then solve for ‘c and ‘d’ depending upon the branch, i.e., depending upon whether x < 10 or x = 10, however, those attempts have failed, because if ‘c’ or ‘d’ are nonzero, the data are affected and the solutions for x are incorrect.
Two questions please;
1) Is this problem even well-posed as stated?
2) Does optimization or global optimization have a tool that can solve this? optimization MATLAB Answers — New Questions
str2num is returning and empty matrix: []
Problem:
I’m trying to convert a string containing a number into a double, but the output of str2num keeps giving me an empty matrix [].
Context:
I’ve imported data from an excel sheet with importdata(). That data comes in as a cell array. To extract data from a specific cell, I use cell2mat(). This yeilds numbers in the class: Char. (Example: ‘5’). I use convertCharsToString(‘5’) to convert that character into a string. What I’m left with is ans = "5".
Now, I want to convert this "5" into a double. So, I used str2num(ans), and I get [] as the output (instead of 5 of class double).
I even tried this debugg:
a = "5";
strcmp(a,month)
and got a logical = 0…
Any ideas why this isn’t woking?Problem:
I’m trying to convert a string containing a number into a double, but the output of str2num keeps giving me an empty matrix [].
Context:
I’ve imported data from an excel sheet with importdata(). That data comes in as a cell array. To extract data from a specific cell, I use cell2mat(). This yeilds numbers in the class: Char. (Example: ‘5’). I use convertCharsToString(‘5’) to convert that character into a string. What I’m left with is ans = "5".
Now, I want to convert this "5" into a double. So, I used str2num(ans), and I get [] as the output (instead of 5 of class double).
I even tried this debugg:
a = "5";
strcmp(a,month)
and got a logical = 0…
Any ideas why this isn’t woking? Problem:
I’m trying to convert a string containing a number into a double, but the output of str2num keeps giving me an empty matrix [].
Context:
I’ve imported data from an excel sheet with importdata(). That data comes in as a cell array. To extract data from a specific cell, I use cell2mat(). This yeilds numbers in the class: Char. (Example: ‘5’). I use convertCharsToString(‘5’) to convert that character into a string. What I’m left with is ans = "5".
Now, I want to convert this "5" into a double. So, I used str2num(ans), and I get [] as the output (instead of 5 of class double).
I even tried this debugg:
a = "5";
strcmp(a,month)
and got a logical = 0…
Any ideas why this isn’t woking? str2num empty matrix string not working MATLAB Answers — New Questions
Niladri Das on Microsoft Azure, Dynamics 365 & Power Platform Newsletter – May 2024
Hey Microsoft Learn community!
As a fellow tech enthusiast, I’m excited to start a discussion on Microsoft Azure, Dynamics 365, and Power Platform. With the rapid evolution of these technologies, I believe it’s essential to share our experiences, insights, and knowledge with each other.
Table of Contents
IntroductionMicrosoft AzurePower PlatformMicrosoft Dynamics 365Microsoft 365Join the Conversation
Introduction
In this post, I will be discussing my experience with Azure, Power Platform, Dynamics 365, and Microsoft 365. I’m also curious to learn about other user’s experiences and projects.
Microsoft Azure
During my training, I used Azure to create a virtual machine with Ubuntu.What are your favorite Azure features or use cases?Have you worked on any interesting projects using Azure?
Power Platform
I have some understanding of Power BI and how to import Excel data into it.I’m curious to learn more about Power Apps and Power Automate.How have you used Power Platform in your projects?What are some tips and tricks for getting the most out of these tools?
Microsoft Dynamics 365
I have experience working with Dynamics 365 CRM.What are your favorite Dynamics 365 features or use cases?Have you worked on any interesting projects using Dynamics 365?
Microsoft 365
I’ve been using Microsoft 365 tools since my childhood days for painting, writing, and creating sheets and presentations.How do you use Microsoft 365 in your personal or professional life?What are some hidden gems in the Microsoft 365 suite that you’ve discovered?
Join the Conversation
So, what’s your story?What are you working on, or what do you want to learn more about?
Join the conversation!
Best, Niladri
Please feel free to ask any questions or share your experiences and insights with Microsoft Azure, Dynamics 365, Power Platform, and GitHub. I look forward to learning from and collaborating with you all!
Hey Microsoft Learn community! As a fellow tech enthusiast, I’m excited to start a discussion on Microsoft Azure, Dynamics 365, and Power Platform. With the rapid evolution of these technologies, I believe it’s essential to share our experiences, insights, and knowledge with each other. Table of ContentsIntroductionMicrosoft AzurePower PlatformMicrosoft Dynamics 365Microsoft 365Join the Conversation IntroductionIn this post, I will be discussing my experience with Azure, Power Platform, Dynamics 365, and Microsoft 365. I’m also curious to learn about other user’s experiences and projects. Microsoft AzureDuring my training, I used Azure to create a virtual machine with Ubuntu.What are your favorite Azure features or use cases?Have you worked on any interesting projects using Azure? Power PlatformI have some understanding of Power BI and how to import Excel data into it.I’m curious to learn more about Power Apps and Power Automate.How have you used Power Platform in your projects?What are some tips and tricks for getting the most out of these tools? Microsoft Dynamics 365I have experience working with Dynamics 365 CRM.What are your favorite Dynamics 365 features or use cases?Have you worked on any interesting projects using Dynamics 365? Microsoft 365I’ve been using Microsoft 365 tools since my childhood days for painting, writing, and creating sheets and presentations.How do you use Microsoft 365 in your personal or professional life?What are some hidden gems in the Microsoft 365 suite that you’ve discovered? Join the ConversationSo, what’s your story?What are you working on, or what do you want to learn more about? Join the conversation!Best, NiladriLinkedIn | GitHub Please feel free to ask any questions or share your experiences and insights with Microsoft Azure, Dynamics 365, Power Platform, and GitHub. I look forward to learning from and collaborating with you all! Read More
Images are rotated counter clockwise without any reason,
Hi,
So, I’m working on a code where I have a folder with 33 images and they are of different orientation (mix of landscape and portrait sizes). I have the script that reads the images from the folder and overlay gaze data on top of these images. The script is running fine except a small bug that im facing is that for final plot of 33 images, some images that are actually portrait size (elongated top to bottom) are plotted with counter clock-wise rotation to show it as a landscape.
The two images below are for reference. where Img x025 is correct plotted with right data but Img x033 is incorrect and its rotated and therefore the gaze data is correct but due to rotation, its not overlaid correctly.
I want the x033 image to look like this below and there are about 12-14 images that are displayed or showed in this way with wrong orientation:
The code is as follows, which is part of a larger script:
imageDir = ‘C:Usersmqs6680Downloadssaliency-masterimages1’;
% Load the data
filename = ‘DD2.tsv’;
opts = detectImportOptions(filename, ‘FileType’, ‘text’);
data = readtable(filename, opts);
% Get unique participants
participants = unique(data.(‘ParticipantName’));
% Initialize a structure for participants
participantData = struct();
% Get a list of all JPG files in the folder
imageFiles = dir(fullfile(imageDir, ‘*.jpg’));
% Read resolutions and store in a map for quick lookup
resolutions = containers.Map(‘KeyType’, ‘char’, ‘ValueType’, ‘any’);
for i = 1:length(imageFiles)
imagePath = fullfile(imageDir, imageFiles(i).name);
img = imread(imagePath);
resolution = [size(img, 1), size(img, 2)]; % [height, width]
[~, imageID, ~] = fileparts(imageFiles(i).name);
resolutions(imageID) = resolution;
end
% Now you can access each participant’s data and each image’s data using:
% participantData.participantName_var.imageName_var
%% Individual Fixation map
% Assuming participantData is already filled from previous code
% Get all participant names from the structure
participantNames = fieldnames(participantData);
% Prompt user to enter a participant name or choose from a list
disp(‘Available participants:’);
disp(participantNames);
selectedParticipant = input(‘Enter the name of the participant to plot (case-sensitive): ‘, ‘s’);
% Check if the entered participant name is valid
if isfield(participantData, selectedParticipant)
% Get all images for the selected participant
imageNames = fieldnames(participantData.(selectedParticipant));
for j = 1:length(imageNames)
imageName = imageNames{j};
imageData = participantData.(selectedParticipant).(imageName);
% Ensure data exists for plotting
if ~isempty(imageData)
actualFixationX = imageData.ActualFixationX;
actualFixationY = imageData.ActualFixationY;
% Read the image from the file
imagePath = fullfile(‘C:Usersmqs6680Downloadssaliency-masterimages’, strcat(imageName, ‘.jpg’)); % Assumes image extension is jpg
img = imread(imagePath);
% Check if the image needs to be rotated (portrait orientation)
if size(img, 1) > size(img, 2)
img = imrotate(img, -90); % Rotate the image clockwise by 90 degrees
% Correctly swap and calculate new fixation points
tempX = actualFixationX; % Temporary variable for swapping
actualFixationX = actualFixationY; % New X is the old Y
actualFixationY = size(img, 1) – tempX + 1; % New Y is adjusted based on the new image height
end
% Create a scatter plot on top of the image
figure; % Create a new figure for each image
imshow(img, ‘InitialMagnification’, ‘fit’); % Display the image and fit it to the window
hold on; % Hold on to overlay scatter plot on the image
scatter(actualFixationX, actualFixationY, ‘filled’, ‘r’); % Red points
hold off; % Release the hold to allow further plots to be displayed separately
title(sprintf(‘Fixation Points on Image for Participant: %s, Image: %s’, selectedParticipant, imageName));
xlabel(‘Actual Fixation X (pixels)’);
ylabel(‘Actual Fixation Y (pixels)’);
% Explicitly set the axis limits to match the image dimensions
axis on; % Turn on axis lines, optional
xlim([0 size(img, 2)]); % Set x-axis limits based on image width
ylim([0 size(img, 1)]); % Set y-axis limits based on image height
end
end
else
fprintf(‘No data available for participant: %sn’, selectedParticipant);
end
Also, I have tried following different debugging methods:
Method 1:
% Check if the image needs to be rotated (portrait orientation)
if size(img, 1) > size(img, 2)
img = imrotate(img, -90); % Rotate the image clockwise by 90 degrees
% Swap X and Y fixation points for the rotated image
newFixationX = size(img, 1) – actualFixationY + 1; % Recalibrate to the new dimensions
newFixationY = actualFixationX;
actualFixationX = newFixationX;
actualFixationY = newFixationY;
end
Method 2:
% Check if the image needs to be rotated (portrait orientation)
if size(img, 1) > size(img, 2)
img = imrotate(img, -90); % Rotate the image clockwise by 90 degrees
% Swap X and Y fixation points for the rotated image
[actualFixationX, actualFixationY] = deal(actualFixationY, size(img, 2) – actualFixationX + 1);
end
I have cut portion of the code where it was handling the gaze data related stuff. Anyhelp will be appreciated. Thank you so much.Hi,
So, I’m working on a code where I have a folder with 33 images and they are of different orientation (mix of landscape and portrait sizes). I have the script that reads the images from the folder and overlay gaze data on top of these images. The script is running fine except a small bug that im facing is that for final plot of 33 images, some images that are actually portrait size (elongated top to bottom) are plotted with counter clock-wise rotation to show it as a landscape.
The two images below are for reference. where Img x025 is correct plotted with right data but Img x033 is incorrect and its rotated and therefore the gaze data is correct but due to rotation, its not overlaid correctly.
I want the x033 image to look like this below and there are about 12-14 images that are displayed or showed in this way with wrong orientation:
The code is as follows, which is part of a larger script:
imageDir = ‘C:Usersmqs6680Downloadssaliency-masterimages1’;
% Load the data
filename = ‘DD2.tsv’;
opts = detectImportOptions(filename, ‘FileType’, ‘text’);
data = readtable(filename, opts);
% Get unique participants
participants = unique(data.(‘ParticipantName’));
% Initialize a structure for participants
participantData = struct();
% Get a list of all JPG files in the folder
imageFiles = dir(fullfile(imageDir, ‘*.jpg’));
% Read resolutions and store in a map for quick lookup
resolutions = containers.Map(‘KeyType’, ‘char’, ‘ValueType’, ‘any’);
for i = 1:length(imageFiles)
imagePath = fullfile(imageDir, imageFiles(i).name);
img = imread(imagePath);
resolution = [size(img, 1), size(img, 2)]; % [height, width]
[~, imageID, ~] = fileparts(imageFiles(i).name);
resolutions(imageID) = resolution;
end
% Now you can access each participant’s data and each image’s data using:
% participantData.participantName_var.imageName_var
%% Individual Fixation map
% Assuming participantData is already filled from previous code
% Get all participant names from the structure
participantNames = fieldnames(participantData);
% Prompt user to enter a participant name or choose from a list
disp(‘Available participants:’);
disp(participantNames);
selectedParticipant = input(‘Enter the name of the participant to plot (case-sensitive): ‘, ‘s’);
% Check if the entered participant name is valid
if isfield(participantData, selectedParticipant)
% Get all images for the selected participant
imageNames = fieldnames(participantData.(selectedParticipant));
for j = 1:length(imageNames)
imageName = imageNames{j};
imageData = participantData.(selectedParticipant).(imageName);
% Ensure data exists for plotting
if ~isempty(imageData)
actualFixationX = imageData.ActualFixationX;
actualFixationY = imageData.ActualFixationY;
% Read the image from the file
imagePath = fullfile(‘C:Usersmqs6680Downloadssaliency-masterimages’, strcat(imageName, ‘.jpg’)); % Assumes image extension is jpg
img = imread(imagePath);
% Check if the image needs to be rotated (portrait orientation)
if size(img, 1) > size(img, 2)
img = imrotate(img, -90); % Rotate the image clockwise by 90 degrees
% Correctly swap and calculate new fixation points
tempX = actualFixationX; % Temporary variable for swapping
actualFixationX = actualFixationY; % New X is the old Y
actualFixationY = size(img, 1) – tempX + 1; % New Y is adjusted based on the new image height
end
% Create a scatter plot on top of the image
figure; % Create a new figure for each image
imshow(img, ‘InitialMagnification’, ‘fit’); % Display the image and fit it to the window
hold on; % Hold on to overlay scatter plot on the image
scatter(actualFixationX, actualFixationY, ‘filled’, ‘r’); % Red points
hold off; % Release the hold to allow further plots to be displayed separately
title(sprintf(‘Fixation Points on Image for Participant: %s, Image: %s’, selectedParticipant, imageName));
xlabel(‘Actual Fixation X (pixels)’);
ylabel(‘Actual Fixation Y (pixels)’);
% Explicitly set the axis limits to match the image dimensions
axis on; % Turn on axis lines, optional
xlim([0 size(img, 2)]); % Set x-axis limits based on image width
ylim([0 size(img, 1)]); % Set y-axis limits based on image height
end
end
else
fprintf(‘No data available for participant: %sn’, selectedParticipant);
end
Also, I have tried following different debugging methods:
Method 1:
% Check if the image needs to be rotated (portrait orientation)
if size(img, 1) > size(img, 2)
img = imrotate(img, -90); % Rotate the image clockwise by 90 degrees
% Swap X and Y fixation points for the rotated image
newFixationX = size(img, 1) – actualFixationY + 1; % Recalibrate to the new dimensions
newFixationY = actualFixationX;
actualFixationX = newFixationX;
actualFixationY = newFixationY;
end
Method 2:
% Check if the image needs to be rotated (portrait orientation)
if size(img, 1) > size(img, 2)
img = imrotate(img, -90); % Rotate the image clockwise by 90 degrees
% Swap X and Y fixation points for the rotated image
[actualFixationX, actualFixationY] = deal(actualFixationY, size(img, 2) – actualFixationX + 1);
end
I have cut portion of the code where it was handling the gaze data related stuff. Anyhelp will be appreciated. Thank you so much. Hi,
So, I’m working on a code where I have a folder with 33 images and they are of different orientation (mix of landscape and portrait sizes). I have the script that reads the images from the folder and overlay gaze data on top of these images. The script is running fine except a small bug that im facing is that for final plot of 33 images, some images that are actually portrait size (elongated top to bottom) are plotted with counter clock-wise rotation to show it as a landscape.
The two images below are for reference. where Img x025 is correct plotted with right data but Img x033 is incorrect and its rotated and therefore the gaze data is correct but due to rotation, its not overlaid correctly.
I want the x033 image to look like this below and there are about 12-14 images that are displayed or showed in this way with wrong orientation:
The code is as follows, which is part of a larger script:
imageDir = ‘C:Usersmqs6680Downloadssaliency-masterimages1’;
% Load the data
filename = ‘DD2.tsv’;
opts = detectImportOptions(filename, ‘FileType’, ‘text’);
data = readtable(filename, opts);
% Get unique participants
participants = unique(data.(‘ParticipantName’));
% Initialize a structure for participants
participantData = struct();
% Get a list of all JPG files in the folder
imageFiles = dir(fullfile(imageDir, ‘*.jpg’));
% Read resolutions and store in a map for quick lookup
resolutions = containers.Map(‘KeyType’, ‘char’, ‘ValueType’, ‘any’);
for i = 1:length(imageFiles)
imagePath = fullfile(imageDir, imageFiles(i).name);
img = imread(imagePath);
resolution = [size(img, 1), size(img, 2)]; % [height, width]
[~, imageID, ~] = fileparts(imageFiles(i).name);
resolutions(imageID) = resolution;
end
% Now you can access each participant’s data and each image’s data using:
% participantData.participantName_var.imageName_var
%% Individual Fixation map
% Assuming participantData is already filled from previous code
% Get all participant names from the structure
participantNames = fieldnames(participantData);
% Prompt user to enter a participant name or choose from a list
disp(‘Available participants:’);
disp(participantNames);
selectedParticipant = input(‘Enter the name of the participant to plot (case-sensitive): ‘, ‘s’);
% Check if the entered participant name is valid
if isfield(participantData, selectedParticipant)
% Get all images for the selected participant
imageNames = fieldnames(participantData.(selectedParticipant));
for j = 1:length(imageNames)
imageName = imageNames{j};
imageData = participantData.(selectedParticipant).(imageName);
% Ensure data exists for plotting
if ~isempty(imageData)
actualFixationX = imageData.ActualFixationX;
actualFixationY = imageData.ActualFixationY;
% Read the image from the file
imagePath = fullfile(‘C:Usersmqs6680Downloadssaliency-masterimages’, strcat(imageName, ‘.jpg’)); % Assumes image extension is jpg
img = imread(imagePath);
% Check if the image needs to be rotated (portrait orientation)
if size(img, 1) > size(img, 2)
img = imrotate(img, -90); % Rotate the image clockwise by 90 degrees
% Correctly swap and calculate new fixation points
tempX = actualFixationX; % Temporary variable for swapping
actualFixationX = actualFixationY; % New X is the old Y
actualFixationY = size(img, 1) – tempX + 1; % New Y is adjusted based on the new image height
end
% Create a scatter plot on top of the image
figure; % Create a new figure for each image
imshow(img, ‘InitialMagnification’, ‘fit’); % Display the image and fit it to the window
hold on; % Hold on to overlay scatter plot on the image
scatter(actualFixationX, actualFixationY, ‘filled’, ‘r’); % Red points
hold off; % Release the hold to allow further plots to be displayed separately
title(sprintf(‘Fixation Points on Image for Participant: %s, Image: %s’, selectedParticipant, imageName));
xlabel(‘Actual Fixation X (pixels)’);
ylabel(‘Actual Fixation Y (pixels)’);
% Explicitly set the axis limits to match the image dimensions
axis on; % Turn on axis lines, optional
xlim([0 size(img, 2)]); % Set x-axis limits based on image width
ylim([0 size(img, 1)]); % Set y-axis limits based on image height
end
end
else
fprintf(‘No data available for participant: %sn’, selectedParticipant);
end
Also, I have tried following different debugging methods:
Method 1:
% Check if the image needs to be rotated (portrait orientation)
if size(img, 1) > size(img, 2)
img = imrotate(img, -90); % Rotate the image clockwise by 90 degrees
% Swap X and Y fixation points for the rotated image
newFixationX = size(img, 1) – actualFixationY + 1; % Recalibrate to the new dimensions
newFixationY = actualFixationX;
actualFixationX = newFixationX;
actualFixationY = newFixationY;
end
Method 2:
% Check if the image needs to be rotated (portrait orientation)
if size(img, 1) > size(img, 2)
img = imrotate(img, -90); % Rotate the image clockwise by 90 degrees
% Swap X and Y fixation points for the rotated image
[actualFixationX, actualFixationY] = deal(actualFixationY, size(img, 2) – actualFixationX + 1);
end
I have cut portion of the code where it was handling the gaze data related stuff. Anyhelp will be appreciated. Thank you so much. data import, plotting, image analysis MATLAB Answers — New Questions
graph multiple excel or csv files
I have 4 excel files, which I would like to join using matlab into a single file like example 5 (but not convert it to excel). But using the time table command in which the date and time are combined, the purpose is to be able to graph various amounts of data quickly without graphing each file.
The purpose is when you have to graph excel or csv files to be able to generate them quickly
For example:
I really appreciate the help.
My code actual:
clear;
clc;
%% Load and plot data example 01
filename = ‘example1’;
T = readtable(filename);
x1 = T{:,1} + days(T{:,2}); % Combining date and time
y1 = T{:,3}; % Pressure data
figure
plot(x1, y1, ‘r-‘, ‘LineWidth’, 1)
hold on
%% Load and plot data example 02
filename = ‘example2’;
T = readtable(filename);
x2 = T{:,1} + days(T{:,2}); % Combining date and time
y2= T{:,3}; % Pressure data
plot(x2, y2, ‘b-‘, ‘LineWidth’, 1)
hold on
%% Load and plot data example 03
filename = ‘example3’;
T = readtable(filename);
x3 = T{:,1} + days(T{:,2}); % Combining date and time
y3= T{:,3}; % Pressure data
plot(x3, y3, ‘g-‘, ‘LineWidth’, 1)
hold on
%% Load and plot data example 04
filename = ‘example4’;
T = readtable(filename);
x4 = T{:,1} + days(T{:,2}); % Combining date and time
y4= T{:,3}; % Pressure data
plot(x4, y4, ‘k-‘, ‘LineWidth’, 1)
hold on
grid on
axis tightI have 4 excel files, which I would like to join using matlab into a single file like example 5 (but not convert it to excel). But using the time table command in which the date and time are combined, the purpose is to be able to graph various amounts of data quickly without graphing each file.
The purpose is when you have to graph excel or csv files to be able to generate them quickly
For example:
I really appreciate the help.
My code actual:
clear;
clc;
%% Load and plot data example 01
filename = ‘example1’;
T = readtable(filename);
x1 = T{:,1} + days(T{:,2}); % Combining date and time
y1 = T{:,3}; % Pressure data
figure
plot(x1, y1, ‘r-‘, ‘LineWidth’, 1)
hold on
%% Load and plot data example 02
filename = ‘example2’;
T = readtable(filename);
x2 = T{:,1} + days(T{:,2}); % Combining date and time
y2= T{:,3}; % Pressure data
plot(x2, y2, ‘b-‘, ‘LineWidth’, 1)
hold on
%% Load and plot data example 03
filename = ‘example3’;
T = readtable(filename);
x3 = T{:,1} + days(T{:,2}); % Combining date and time
y3= T{:,3}; % Pressure data
plot(x3, y3, ‘g-‘, ‘LineWidth’, 1)
hold on
%% Load and plot data example 04
filename = ‘example4’;
T = readtable(filename);
x4 = T{:,1} + days(T{:,2}); % Combining date and time
y4= T{:,3}; % Pressure data
plot(x4, y4, ‘k-‘, ‘LineWidth’, 1)
hold on
grid on
axis tight I have 4 excel files, which I would like to join using matlab into a single file like example 5 (but not convert it to excel). But using the time table command in which the date and time are combined, the purpose is to be able to graph various amounts of data quickly without graphing each file.
The purpose is when you have to graph excel or csv files to be able to generate them quickly
For example:
I really appreciate the help.
My code actual:
clear;
clc;
%% Load and plot data example 01
filename = ‘example1’;
T = readtable(filename);
x1 = T{:,1} + days(T{:,2}); % Combining date and time
y1 = T{:,3}; % Pressure data
figure
plot(x1, y1, ‘r-‘, ‘LineWidth’, 1)
hold on
%% Load and plot data example 02
filename = ‘example2’;
T = readtable(filename);
x2 = T{:,1} + days(T{:,2}); % Combining date and time
y2= T{:,3}; % Pressure data
plot(x2, y2, ‘b-‘, ‘LineWidth’, 1)
hold on
%% Load and plot data example 03
filename = ‘example3’;
T = readtable(filename);
x3 = T{:,1} + days(T{:,2}); % Combining date and time
y3= T{:,3}; % Pressure data
plot(x3, y3, ‘g-‘, ‘LineWidth’, 1)
hold on
%% Load and plot data example 04
filename = ‘example4’;
T = readtable(filename);
x4 = T{:,1} + days(T{:,2}); % Combining date and time
y4= T{:,3}; % Pressure data
plot(x4, y4, ‘k-‘, ‘LineWidth’, 1)
hold on
grid on
axis tight multiple files, graphics, plot MATLAB Answers — New Questions
Outlook 365 Calendar View
Is it possible to change the default view in Outlook 365 Calendar to display 4 weeks and not the 5 week “Month View?”
Is it possible to change the default view in Outlook 365 Calendar to display 4 weeks and not the 5 week “Month View?” Read More
Viewing Risks in Project Online
Hi All,
We are formulating risks on our projects, but I am confused about the permissions. I can see all risks as the Project owner and the project manager assigned on the summary page of the project. But others can only see the risks assigned to them.
How do I allow everyone to see the full list of risks?
Hi All, We are formulating risks on our projects, but I am confused about the permissions. I can see all risks as the Project owner and the project manager assigned on the summary page of the project. But others can only see the risks assigned to them.How do I allow everyone to see the full list of risks? Read More
Remote Connection Manager (RDMon)
For those who use Remote Desktop Connection Manager, v2.93
I’m trying to utilize the feature of Hot Keys.
From the menu -> Tools -> Options -> Hot Keys (tab) -> Previous session.
I use the ctrl-alt-insert for full screen all the time.
Problem is the ctrl-alt-rightarrow / left arrow are not working.
I’m expecting it to cycle to the next open VM.
I’ve used this in the past but now it doesn’t seem to work anymore.
For those who use Remote Desktop Connection Manager, v2.93 I’m trying to utilize the feature of Hot Keys.From the menu -> Tools -> Options -> Hot Keys (tab) -> Previous session.I use the ctrl-alt-insert for full screen all the time.Problem is the ctrl-alt-rightarrow / left arrow are not working.I’m expecting it to cycle to the next open VM. I’ve used this in the past but now it doesn’t seem to work anymore. Read More
Moving Teams Android Devices to AOSP Device Management
We are pleased to announce that Microsoft Teams Android devices will be moving to Intune Android Open Source Project (AOSP) device management later this year. AOSP device management will be the mobile device management (MDM) platform for Teams devices going forward. This move will bring a more reliable experience, an improved deployment experience for admins, and it will serve as the platform for future innovation and richer management scenarios for Microsoft Teams Android devices.
AOSP Device Management is the replacement for the legacy Android Device Administrator solution used for managing Teams Devices.
This mandatory migration will take place over several months and will not start until Q3CY24. We’ve taken great care to minimize the end user and IT admin impact with this migration, but there is action required for you as the IT admin. Following our published guidance for migration will only take a few minutes and will ensure your devices are seamlessly migrated between MDM platforms with a simple firmware upgrade. End users will notice no difference in device functionality.
There are two parts to a successful migration to AOSP Device Management:
Step 1: Create new enrollment profiles & configuration/compliance policies in Intune. This step can be completed starting in Q3 CY24 and can be completed even before the firmware updates are available. Performing these steps will have no impact on existing devices but please note that failing to create enrollment profiles before performing step 2 will result in signed out Teams Devices.
Step 2: Take firmware updates containing the new AOSP agent and Authenticator app, for each of the supported Teams Devices. This firmware update will automatically unenroll the device from Device Administrator and re-enroll the device with AOSP device management with your newly created enrollment profile. This entire process will be done while the device remains signed into Teams. These firmware updates will be made available from Teams Admin Center as a manual update to allow you time to slowly migrate your devices. Availability is expected later in Q3 CY24.
Step by step guidance on how to complete steps 1 and 2 can be found in the AOSP migration admin guide.
FAQ:
My organization does not enroll our Teams Android Devices in Intune today, do we need to do anything?
No, if your organization does not enroll its Teams Devices into Intune today and currently has the Intune license unassigned from accounts signing into Teams Devices, there will be no impact when you install the new device firmware which supports AOSP device management. Your devices will get the new management applications, but no action is required beyond updating the devices to the new firmware once released.
What happens if I don’t do anything?
Devices will receive the firmware update through Teams Admin Center eventually regardless of admin action through automatic updates.
If your organization does enroll its Teams devices into Intune, then by not creating an enrollment profile, devices will fail to enroll properly in Intune and will thus not be able to sign in (or sign out if they were already signed in before). Not creating new AOSP policies could lead to unexpected issues in your environment, as Device Administrator policies will not be migrated automatically.
This blog post mentions that I need to wait until Q3CY24 to create enrollment profiles, I already see the option in my Intune admin portal, why should I wait?
The current enrollment profile creation has a 90-day expiration date. If you create the profile now, you will need to extend it every 90 days, we are working to improve this experience with a much longer expiration period prior to Q3CY24.
Wait, I don’t have to enroll my devices in Intune at all? Why would I want to use Intune?
Intune provides a security wrapper around your devices allowing you to set security controls as well as detect if the device is compliant with your organization security requirements prior to allowing the device to sign in to your M365 instance.
Are there devices that will not migrate to AOSP Device Management?
All devices currently certified and supported for Microsoft Teams will be migrated, those devices can be found here:
Teams Rooms on Android
Teams Phones, Panels, & Displays
There are some Teams Android Devices that were previously supported, but are now end of life, which you may still have in your environment, those devices specifically not migrating are listed here:
AudioCodes C448HD (Teams Phone)
AudioCodes C450HD (Teams Phone)
AudioCodes RXV80 (Teams Rooms on Android)
Yealink VP59 (Teams Phone)
Yealink MP52 (Teams Phone)
Yealink VC210 (Teams Rooms on Android)
Crestron UC-2 (Teams Phone)
Crestron UC-P8 (Teams Phone)
Crestron UC-P8-I (Teams Phone)
Crestron UC-P10 (Teams Phone)
Crestron UC-P10-I (Teams Phone)
Crestron UC-P8-C (Teams Phone)
Crestron UC-P8-C-I (Teams Phone)
Crestron UC-P10-C (Teams Phone)
Crestron UC-P10-C-I (Teams Phone)
Crestron UC-P8-TD (Teams Display)
Crestron UC-P8-TD-I (Teams Display)
Crestron UC-P10-TD (Teams Display)
Crestron UC-P10-TD-I (Teams Display)
EPOS Expand Vision 3T (Teams Rooms on Android)
What happens with those devices that will not migrate?
The devices listed above will remain on Android Device Administrator. These devices can still be used once Android Device Administrator is fully deprecated but will be considered legacy and unsupported where features may be removed at any time. To use the device you will need to unenroll from Intune and then sign the device back in without an Intune license assigned to the account, more information about this can be found here: Manage Intune devices with Android device administrator | Microsoft Learn
Will I notice anything different with the devices after the migration?
No, the devices will not look any different from an end user perspective. As an IT admin you will see two new applications installed on your devices (visible in the software health tab in Teams Admin Center), these two applications are the “Authenticator” app and the “Microsoft Intune” app these applications replace the previous “Company Portal” application.
Why not use Android Enterprise?
Android Enterprise specifically requires Google Mobile Services, and since Teams Devices do not contain Google Mobile Services, AOSP Device Management is our solution.
What if once this migration is complete, I take a device out of storage that has not been through the migration? Will I be able to upgrade it?
Yes, there will be out of box updates available to ensure devices are able to receive the latest apps.
I’m a GCC-High customer and I don’t see the option for Teams Devices in the AOSP Device Management enrollment profile?
This is expected, this feature will be released to GCC-High customers at the end of June.
Who do I contact if I need more support or information?
Please reach out to your Microsoft account representatives or open a support case for more details.
Microsoft Tech Community – Latest Blogs –Read More
Stream features I don’t understand
I’m just starting to use Stream this month. There are some things I don’t understand.
What use is the Recommended bar on the home screen? I don’t need recommendations. I just need a searchable list of my Streams.Why don’t my most recent Streams show up on the home screen? I’ve made a dozen new Steams over the last few days, but they don’t show up under All or Created by me, etc.Why, when I try to add a Stream to my favorites, does it come back with “Something went wrong…”Why is Microsoft spending a zillion dollars on AI to help me plan a dinner party, when I just want to get my work done?
I’m just starting to use Stream this month. There are some things I don’t understand.What use is the Recommended bar on the home screen? I don’t need recommendations. I just need a searchable list of my Streams.Why don’t my most recent Streams show up on the home screen? I’ve made a dozen new Steams over the last few days, but they don’t show up under All or Created by me, etc.Why, when I try to add a Stream to my favorites, does it come back with “Something went wrong…”Why is Microsoft spending a zillion dollars on AI to help me plan a dinner party, when I just want to get my work done? Read More
Category Color Coding not viewable by Delegate on New Mode
Ran into an issue when helping a user today of not being able to see the color coding of a shared calendar. User is a delegate for someone that has their calendar items color coded. I’ve toggled permissions and we’ve removed/re-added the shared calendar in question. This happens in New Mode. When reverting to Legacy Mode, the colors are viewable on the shared calendar.
I’ve tried most things except for a complete reinstall of Outlook. Any thoughts?
JB
Ran into an issue when helping a user today of not being able to see the color coding of a shared calendar. User is a delegate for someone that has their calendar items color coded. I’ve toggled permissions and we’ve removed/re-added the shared calendar in question. This happens in New Mode. When reverting to Legacy Mode, the colors are viewable on the shared calendar.I’ve tried most things except for a complete reinstall of Outlook. Any thoughts?JB Read More
Disable Copilot Pro ad on Word 365 toolbar
Recently this icon appeared on my toolbar in Word 365 on iPad. It’s an ad for Copilot Pro, and it is in the first position on the top-right toolbar. Not only that but it obscures the center toolbar.
I have less than zero interest in Copilot Pro, and I will never purchase it. How do I remove this intrusive ad that Microsoft is foisting on me?
Recently this icon appeared on my toolbar in Word 365 on iPad. It’s an ad for Copilot Pro, and it is in the first position on the top-right toolbar. Not only that but it obscures the center toolbar. I have less than zero interest in Copilot Pro, and I will never purchase it. How do I remove this intrusive ad that Microsoft is foisting on me? Read More
How can i avoid that Onedrive executes after Pressing ” PrintScreen ” in keyboard in this POST OS?
Please say me how to do that for this Windows OS: Windows 11 Pro Versión 23H2 Compilación 22631.3527
Please say me how to do that for this Windows OS: Windows 11 Pro Versión 23H2 Compilación 22631.3527 Read More
ADO YAML question re: ‘enabled’ and variable
– powershell: |
write-host $(CxDebug)
displayName: Test Debug Var
enabled: true
The above code works.
I’d like to leverage a pipeline variable on the last line. When I add a variable and set it to ‘true’ – I get a YAML error prior to running the pipeline.
– powershell: |
write-host $(CxDebug)
displayName: Test Debug Var
enabled: $(CxDebug)
- powershell: |
write-host $(CxDebug)
displayName: Test Debug Var
enabled: true The above code works. I’d like to leverage a pipeline variable on the last line. When I add a variable and set it to ‘true’ – I get a YAML error prior to running the pipeline. – powershell: |
write-host $(CxDebug)
displayName: Test Debug Var
enabled: $(CxDebug) Read More
Copilot using wrong date
Hi All
I live in New Zealand, so the timezone is UTC+13.
I have noticed that Copilot is using UTC as its standard gauge for time, which is problematic when I query my schedule in the morning as it shows the previous day in the results. When I ask it what the date is, it tells me its the previous day today because it is in UTC. As soon as UTC timezone moves into the next day (my current day), then all is well.
Any ideas as to how I can resolve this?
Hi All I live in New Zealand, so the timezone is UTC+13. I have noticed that Copilot is using UTC as its standard gauge for time, which is problematic when I query my schedule in the morning as it shows the previous day in the results. When I ask it what the date is, it tells me its the previous day today because it is in UTC. As soon as UTC timezone moves into the next day (my current day), then all is well. Any ideas as to how I can resolve this? Read More
Notification when video encoding is done
Is there a way to notify the user(s) when encoding of the video is complete? I’ve uploaded videos and they don’t show up in the Stream Library for quite some time. It would be helpful to see some type of placeholder in the library that provides an update when the video will finish processing OR maybe an email to notify the user that it has started and when it is done.
Is there a way to notify the user(s) when encoding of the video is complete? I’ve uploaded videos and they don’t show up in the Stream Library for quite some time. It would be helpful to see some type of placeholder in the library that provides an update when the video will finish processing OR maybe an email to notify the user that it has started and when it is done. Read More
Using OR in simulink
Hi Guys,
Im working on a timed traffic light system (which includes pedestrian lights) in matlab using relational operators and lamps. I am having trouble getting the red pedestrian light to remain on, at the time the main traffic light turns orange. I asked my lecturer about this, and he expalined that I need to use an OR operator to complete this system. I have tried integrating this into my simple system but cant seem to get the light to remain red and then turn off while the main lamp switches from orange to red. My traffic light works well apart from this section.
Please see attached simulink file to understand further what I am trying to do.
Thanks guys!
WilliamHi Guys,
Im working on a timed traffic light system (which includes pedestrian lights) in matlab using relational operators and lamps. I am having trouble getting the red pedestrian light to remain on, at the time the main traffic light turns orange. I asked my lecturer about this, and he expalined that I need to use an OR operator to complete this system. I have tried integrating this into my simple system but cant seem to get the light to remain red and then turn off while the main lamp switches from orange to red. My traffic light works well apart from this section.
Please see attached simulink file to understand further what I am trying to do.
Thanks guys!
William Hi Guys,
Im working on a timed traffic light system (which includes pedestrian lights) in matlab using relational operators and lamps. I am having trouble getting the red pedestrian light to remain on, at the time the main traffic light turns orange. I asked my lecturer about this, and he expalined that I need to use an OR operator to complete this system. I have tried integrating this into my simple system but cant seem to get the light to remain red and then turn off while the main lamp switches from orange to red. My traffic light works well apart from this section.
Please see attached simulink file to understand further what I am trying to do.
Thanks guys!
William simulink MATLAB Answers — New Questions
Optimizing problem: Convolution of two functions to dublicate a third one
Hello,
I am looking for a solution for a convolution problem. I have two time dependent functions (F1 and F2). One is a target function (F2). I want to convolute the other function (F1) with a mathematical model with two variables (Axial Dispersion model) so that I end up with a exact dublicate of the F2 function.
F2=F1 conv. AD
Within the axial dispersion model one position (t_mean) and one scattering parameter (Bo) shall be varriied so that the residual sum of squares should be minimized (optimization problem)
This is my code:
tic;
% Parameters of functions Y_Value_Fkt_XX
%BK
c0_tc1 = 0.06582;
k1 = 0.07932;
s1 = 0.09395;
tdead1 = 6.3016;
%KB80
c0_tc2 = 0.06466;
k2 = 0.08148;
s2 = 0.88691;
tdead2 = 6.8116;
% Time and function values
Time_vector = linspace(1, 100, 1200);
Time_matrix = reshape(Time_vector,[],1);
[rows, ~] = size(Time_matrix);
Y_Value_Fkt_BK = zeros(rows, 1);
Y_Value_Fkt_KB80 = zeros(rows, 1);
% Calculate function values
for i = 1:rows
Y_Value_Fkt_BK(i,1) = 0.5 * c0_tc1 * exp(k1 * (0.5 * k1 * s1 * s1 – (Time_matrix(i,1) – tdead1))) * erfc((k1 * s1 * s1 – (Time_matrix(i,1) – tdead1)) / (sqrt(2) * s1));
Y_Value_Fkt_KB80(i,1) = 0.5 * c0_tc2 * exp(k2 * (0.5 * k2 * s2 * s2 – (Time_matrix(i,1) – tdead2))) * erfc((k2 * s2 * s2 – (Time_matrix(i,1) – tdead2)) / (sqrt(2) * s2));
end
Y_Value_Fkt_KB80_Vektor=Y_Value_Fkt_KB80(:);
Y_Value_Fkt_BK_Vektor=Y_Value_Fkt_BK(:);
%Initialization of variables of Axial Dispersion Model
Bo_Values_Vector = linspace(0.0001, 0.2, 300);
Bo_Values = reshape(Bo_Values_Vector,[],1);
t_mean_Values_Vector = linspace(0.0001, 5, 300);
t_mean_Values = reshape(t_mean_Values_Vector,[],1);
% Resuts should be saved in
results = table();
% Calculation of Convolution
for j = 1:size(Bo_Values,1)
for k = 1:size(t_mean_Values,1)
Bo = Bo_Values(j);
t_mean = t_mean_Values(k);
% Calculation Y_Value_AD
Y_Value_AD=zeros(rows,1);
if Bo ~= 0
for l=1:size(Time_matrix,1)
Y_Value_AD(l) = 0.5 * sqrt(Bo / (pi * (Time_matrix(l) / t_mean))) .* exp(-(1 – (Time_matrix(l)/t_mean))^2 * Bo / (4 * (Time_matrix(l) / t_mean)));
end
else
Y_Value_AD(l)=NaN;
end
Y_Value_AD_Vektor=Y_Value_AD(:);
%Convolution
Conv_AD_BK=conv(Y_Value_AD_Vektor,Y_Value_Fkt_BK_Vektor,’same’);
%normalizing convolution
Integral_Conv_AD_BK=0;
for m=2:length(Time_matrix)
Area=0.5*(Time_matrix(m)-Time_matrix(m-1))*(Conv_AD_BK(m)+Conv_AD_BK(m-1));
Integral_Conv_AD_BK=Integral_Conv_AD_BK+Area;
end
Norm_Conv_AD_BK=Conv_AD_BK./Integral_Conv_AD_BK;
% RSS Calculation (Residual sum of squares)
RRsum = sum((Norm_Conv_AD_BK – Y_Value_Fkt_KB80).^2);
% Save
results = [results; table(Bo, t_mean, RRsum)];
end
end
%Find row where RSS=min
[minRRsum, minIndex] = min(results.RRsum);
minRow = results(minIndex, :);
%Find Bo and t_mean for RSS=min
minBo = minRow.Bo;
mint_mean = minRow.t_mean;
%Calculation of Y_Values and convolution for RSS=min values
Conv_min=zeros(rows,1);
Y_Value_AD_min=zeros(rows,1);
for i = 1:size(Time_matrix,1)
if mint_mean ~= 0
Y_Value_AD_min(i,1)= 0.5 * sqrt(minBo / (pi * (Time_matrix(i, 1) / mint_mean))) * exp(-(1 – Time_matrix(i, 1))^2 * minBo / (4 * (Time_matrix(i, 1) / mint_mean)));
else
Y_Value_AD_min(i, 1) = NaN;
end
end
Conv_min=conv(Y_Value_AD_min,Y_Value_Fkt_BK,’same’);
Integral_Conv_min=0;
for n=2:length(Time_matrix)
Area_min=0.5*(Time_matrix(n)-Time_matrix(n-1))*(Conv_min(n)+Conv_min(n-1));
Integral_Conv_min=Integral_Conv_min+Area_min;
end
Norm_Conv_min=Conv_min./Integral_Conv_min;
% control Plot
plot(Time_matrix, Y_Value_Fkt_BK, ‘b’, Time_matrix, Y_Value_Fkt_KB80, ‘r’, Time_matrix, Norm_Conv_min, ‘g’);
time=toc;
disp(time);
The following picture shows the result. Red is the target function, blue is the function which needs to be convoluted. green should be a duplicate of red if everything goes well.
Do you have any suggestions where a fault may be hidden or how to get a better fit?
Thanks in advance for your help :)Hello,
I am looking for a solution for a convolution problem. I have two time dependent functions (F1 and F2). One is a target function (F2). I want to convolute the other function (F1) with a mathematical model with two variables (Axial Dispersion model) so that I end up with a exact dublicate of the F2 function.
F2=F1 conv. AD
Within the axial dispersion model one position (t_mean) and one scattering parameter (Bo) shall be varriied so that the residual sum of squares should be minimized (optimization problem)
This is my code:
tic;
% Parameters of functions Y_Value_Fkt_XX
%BK
c0_tc1 = 0.06582;
k1 = 0.07932;
s1 = 0.09395;
tdead1 = 6.3016;
%KB80
c0_tc2 = 0.06466;
k2 = 0.08148;
s2 = 0.88691;
tdead2 = 6.8116;
% Time and function values
Time_vector = linspace(1, 100, 1200);
Time_matrix = reshape(Time_vector,[],1);
[rows, ~] = size(Time_matrix);
Y_Value_Fkt_BK = zeros(rows, 1);
Y_Value_Fkt_KB80 = zeros(rows, 1);
% Calculate function values
for i = 1:rows
Y_Value_Fkt_BK(i,1) = 0.5 * c0_tc1 * exp(k1 * (0.5 * k1 * s1 * s1 – (Time_matrix(i,1) – tdead1))) * erfc((k1 * s1 * s1 – (Time_matrix(i,1) – tdead1)) / (sqrt(2) * s1));
Y_Value_Fkt_KB80(i,1) = 0.5 * c0_tc2 * exp(k2 * (0.5 * k2 * s2 * s2 – (Time_matrix(i,1) – tdead2))) * erfc((k2 * s2 * s2 – (Time_matrix(i,1) – tdead2)) / (sqrt(2) * s2));
end
Y_Value_Fkt_KB80_Vektor=Y_Value_Fkt_KB80(:);
Y_Value_Fkt_BK_Vektor=Y_Value_Fkt_BK(:);
%Initialization of variables of Axial Dispersion Model
Bo_Values_Vector = linspace(0.0001, 0.2, 300);
Bo_Values = reshape(Bo_Values_Vector,[],1);
t_mean_Values_Vector = linspace(0.0001, 5, 300);
t_mean_Values = reshape(t_mean_Values_Vector,[],1);
% Resuts should be saved in
results = table();
% Calculation of Convolution
for j = 1:size(Bo_Values,1)
for k = 1:size(t_mean_Values,1)
Bo = Bo_Values(j);
t_mean = t_mean_Values(k);
% Calculation Y_Value_AD
Y_Value_AD=zeros(rows,1);
if Bo ~= 0
for l=1:size(Time_matrix,1)
Y_Value_AD(l) = 0.5 * sqrt(Bo / (pi * (Time_matrix(l) / t_mean))) .* exp(-(1 – (Time_matrix(l)/t_mean))^2 * Bo / (4 * (Time_matrix(l) / t_mean)));
end
else
Y_Value_AD(l)=NaN;
end
Y_Value_AD_Vektor=Y_Value_AD(:);
%Convolution
Conv_AD_BK=conv(Y_Value_AD_Vektor,Y_Value_Fkt_BK_Vektor,’same’);
%normalizing convolution
Integral_Conv_AD_BK=0;
for m=2:length(Time_matrix)
Area=0.5*(Time_matrix(m)-Time_matrix(m-1))*(Conv_AD_BK(m)+Conv_AD_BK(m-1));
Integral_Conv_AD_BK=Integral_Conv_AD_BK+Area;
end
Norm_Conv_AD_BK=Conv_AD_BK./Integral_Conv_AD_BK;
% RSS Calculation (Residual sum of squares)
RRsum = sum((Norm_Conv_AD_BK – Y_Value_Fkt_KB80).^2);
% Save
results = [results; table(Bo, t_mean, RRsum)];
end
end
%Find row where RSS=min
[minRRsum, minIndex] = min(results.RRsum);
minRow = results(minIndex, :);
%Find Bo and t_mean for RSS=min
minBo = minRow.Bo;
mint_mean = minRow.t_mean;
%Calculation of Y_Values and convolution for RSS=min values
Conv_min=zeros(rows,1);
Y_Value_AD_min=zeros(rows,1);
for i = 1:size(Time_matrix,1)
if mint_mean ~= 0
Y_Value_AD_min(i,1)= 0.5 * sqrt(minBo / (pi * (Time_matrix(i, 1) / mint_mean))) * exp(-(1 – Time_matrix(i, 1))^2 * minBo / (4 * (Time_matrix(i, 1) / mint_mean)));
else
Y_Value_AD_min(i, 1) = NaN;
end
end
Conv_min=conv(Y_Value_AD_min,Y_Value_Fkt_BK,’same’);
Integral_Conv_min=0;
for n=2:length(Time_matrix)
Area_min=0.5*(Time_matrix(n)-Time_matrix(n-1))*(Conv_min(n)+Conv_min(n-1));
Integral_Conv_min=Integral_Conv_min+Area_min;
end
Norm_Conv_min=Conv_min./Integral_Conv_min;
% control Plot
plot(Time_matrix, Y_Value_Fkt_BK, ‘b’, Time_matrix, Y_Value_Fkt_KB80, ‘r’, Time_matrix, Norm_Conv_min, ‘g’);
time=toc;
disp(time);
The following picture shows the result. Red is the target function, blue is the function which needs to be convoluted. green should be a duplicate of red if everything goes well.
Do you have any suggestions where a fault may be hidden or how to get a better fit?
Thanks in advance for your help 🙂 Hello,
I am looking for a solution for a convolution problem. I have two time dependent functions (F1 and F2). One is a target function (F2). I want to convolute the other function (F1) with a mathematical model with two variables (Axial Dispersion model) so that I end up with a exact dublicate of the F2 function.
F2=F1 conv. AD
Within the axial dispersion model one position (t_mean) and one scattering parameter (Bo) shall be varriied so that the residual sum of squares should be minimized (optimization problem)
This is my code:
tic;
% Parameters of functions Y_Value_Fkt_XX
%BK
c0_tc1 = 0.06582;
k1 = 0.07932;
s1 = 0.09395;
tdead1 = 6.3016;
%KB80
c0_tc2 = 0.06466;
k2 = 0.08148;
s2 = 0.88691;
tdead2 = 6.8116;
% Time and function values
Time_vector = linspace(1, 100, 1200);
Time_matrix = reshape(Time_vector,[],1);
[rows, ~] = size(Time_matrix);
Y_Value_Fkt_BK = zeros(rows, 1);
Y_Value_Fkt_KB80 = zeros(rows, 1);
% Calculate function values
for i = 1:rows
Y_Value_Fkt_BK(i,1) = 0.5 * c0_tc1 * exp(k1 * (0.5 * k1 * s1 * s1 – (Time_matrix(i,1) – tdead1))) * erfc((k1 * s1 * s1 – (Time_matrix(i,1) – tdead1)) / (sqrt(2) * s1));
Y_Value_Fkt_KB80(i,1) = 0.5 * c0_tc2 * exp(k2 * (0.5 * k2 * s2 * s2 – (Time_matrix(i,1) – tdead2))) * erfc((k2 * s2 * s2 – (Time_matrix(i,1) – tdead2)) / (sqrt(2) * s2));
end
Y_Value_Fkt_KB80_Vektor=Y_Value_Fkt_KB80(:);
Y_Value_Fkt_BK_Vektor=Y_Value_Fkt_BK(:);
%Initialization of variables of Axial Dispersion Model
Bo_Values_Vector = linspace(0.0001, 0.2, 300);
Bo_Values = reshape(Bo_Values_Vector,[],1);
t_mean_Values_Vector = linspace(0.0001, 5, 300);
t_mean_Values = reshape(t_mean_Values_Vector,[],1);
% Resuts should be saved in
results = table();
% Calculation of Convolution
for j = 1:size(Bo_Values,1)
for k = 1:size(t_mean_Values,1)
Bo = Bo_Values(j);
t_mean = t_mean_Values(k);
% Calculation Y_Value_AD
Y_Value_AD=zeros(rows,1);
if Bo ~= 0
for l=1:size(Time_matrix,1)
Y_Value_AD(l) = 0.5 * sqrt(Bo / (pi * (Time_matrix(l) / t_mean))) .* exp(-(1 – (Time_matrix(l)/t_mean))^2 * Bo / (4 * (Time_matrix(l) / t_mean)));
end
else
Y_Value_AD(l)=NaN;
end
Y_Value_AD_Vektor=Y_Value_AD(:);
%Convolution
Conv_AD_BK=conv(Y_Value_AD_Vektor,Y_Value_Fkt_BK_Vektor,’same’);
%normalizing convolution
Integral_Conv_AD_BK=0;
for m=2:length(Time_matrix)
Area=0.5*(Time_matrix(m)-Time_matrix(m-1))*(Conv_AD_BK(m)+Conv_AD_BK(m-1));
Integral_Conv_AD_BK=Integral_Conv_AD_BK+Area;
end
Norm_Conv_AD_BK=Conv_AD_BK./Integral_Conv_AD_BK;
% RSS Calculation (Residual sum of squares)
RRsum = sum((Norm_Conv_AD_BK – Y_Value_Fkt_KB80).^2);
% Save
results = [results; table(Bo, t_mean, RRsum)];
end
end
%Find row where RSS=min
[minRRsum, minIndex] = min(results.RRsum);
minRow = results(minIndex, :);
%Find Bo and t_mean for RSS=min
minBo = minRow.Bo;
mint_mean = minRow.t_mean;
%Calculation of Y_Values and convolution for RSS=min values
Conv_min=zeros(rows,1);
Y_Value_AD_min=zeros(rows,1);
for i = 1:size(Time_matrix,1)
if mint_mean ~= 0
Y_Value_AD_min(i,1)= 0.5 * sqrt(minBo / (pi * (Time_matrix(i, 1) / mint_mean))) * exp(-(1 – Time_matrix(i, 1))^2 * minBo / (4 * (Time_matrix(i, 1) / mint_mean)));
else
Y_Value_AD_min(i, 1) = NaN;
end
end
Conv_min=conv(Y_Value_AD_min,Y_Value_Fkt_BK,’same’);
Integral_Conv_min=0;
for n=2:length(Time_matrix)
Area_min=0.5*(Time_matrix(n)-Time_matrix(n-1))*(Conv_min(n)+Conv_min(n-1));
Integral_Conv_min=Integral_Conv_min+Area_min;
end
Norm_Conv_min=Conv_min./Integral_Conv_min;
% control Plot
plot(Time_matrix, Y_Value_Fkt_BK, ‘b’, Time_matrix, Y_Value_Fkt_KB80, ‘r’, Time_matrix, Norm_Conv_min, ‘g’);
time=toc;
disp(time);
The following picture shows the result. Red is the target function, blue is the function which needs to be convoluted. green should be a duplicate of red if everything goes well.
Do you have any suggestions where a fault may be hidden or how to get a better fit?
Thanks in advance for your help 🙂 convolution MATLAB Answers — New Questions