Month: June 2024
How do I optimize/find the minimum of a multi-variable function?
I’m trying to find the minimum of a multivariable function. I’ve tried using both fminunc and fminsearch but the results seem incorrect. I’m just confused on what I’m doing wrong and why its not working.
The data:
x=[1.0e-5;1.0e-5;1.0e-5;1.4e-5;1.4e-5;1.4e-5;1.8e-5;1.8e-5;1.8e-5];
y=[1.3e-4;1.55e-4;1.7e-4;1.3e-4;1.55e-4;1.7e-4;1.3e-4;1.55e-4;1.7e-4];
z=[18.488;21.45;24.52;20.93; 26.08; 29.41;25.44;30.98;34.19];
My code:
coeffs=fit([x,y],z,’Poly22′);
[~,idx]=min(z);
x(idx)
y(idx)
xval=fminunc(coeffs,[x(idx) y(idx)])
and
A=[x(:).^[0:2] y(:).^[1:2] x(:).*y(:)];
a=Az(:);
x2=linspace(0,2.00e-5,100);
y2=linspace(0,2.00e-4,100);
[X,Y]=meshgrid(x2,y2);
M=[X(:).^(0:2) Y(:).^(1:2) X(:).*Y(:)];
Z=X;
Z(:)=M*a;
f=@(xy) -14.19 -4.028e+05.*xy(:,1) + 2.774e+05.*xy(:,2)+ 1.473e+10.*xy(:,1).^2 + 7.05e+09.*xy(:,1).*xy(:,2) + -6.256e+08.*xy(:,2).^2;
fminsearch(f,[1.00e-5 1.55e-4])
Both methods give me results that seem incorrect. The fmincon gives me results at:
xval =
1.0e+06 *
0.324231351627941 -1.604585119026901
which based on the data, doesn’t make sense at all. What am I doing wrong?I’m trying to find the minimum of a multivariable function. I’ve tried using both fminunc and fminsearch but the results seem incorrect. I’m just confused on what I’m doing wrong and why its not working.
The data:
x=[1.0e-5;1.0e-5;1.0e-5;1.4e-5;1.4e-5;1.4e-5;1.8e-5;1.8e-5;1.8e-5];
y=[1.3e-4;1.55e-4;1.7e-4;1.3e-4;1.55e-4;1.7e-4;1.3e-4;1.55e-4;1.7e-4];
z=[18.488;21.45;24.52;20.93; 26.08; 29.41;25.44;30.98;34.19];
My code:
coeffs=fit([x,y],z,’Poly22′);
[~,idx]=min(z);
x(idx)
y(idx)
xval=fminunc(coeffs,[x(idx) y(idx)])
and
A=[x(:).^[0:2] y(:).^[1:2] x(:).*y(:)];
a=Az(:);
x2=linspace(0,2.00e-5,100);
y2=linspace(0,2.00e-4,100);
[X,Y]=meshgrid(x2,y2);
M=[X(:).^(0:2) Y(:).^(1:2) X(:).*Y(:)];
Z=X;
Z(:)=M*a;
f=@(xy) -14.19 -4.028e+05.*xy(:,1) + 2.774e+05.*xy(:,2)+ 1.473e+10.*xy(:,1).^2 + 7.05e+09.*xy(:,1).*xy(:,2) + -6.256e+08.*xy(:,2).^2;
fminsearch(f,[1.00e-5 1.55e-4])
Both methods give me results that seem incorrect. The fmincon gives me results at:
xval =
1.0e+06 *
0.324231351627941 -1.604585119026901
which based on the data, doesn’t make sense at all. What am I doing wrong? I’m trying to find the minimum of a multivariable function. I’ve tried using both fminunc and fminsearch but the results seem incorrect. I’m just confused on what I’m doing wrong and why its not working.
The data:
x=[1.0e-5;1.0e-5;1.0e-5;1.4e-5;1.4e-5;1.4e-5;1.8e-5;1.8e-5;1.8e-5];
y=[1.3e-4;1.55e-4;1.7e-4;1.3e-4;1.55e-4;1.7e-4;1.3e-4;1.55e-4;1.7e-4];
z=[18.488;21.45;24.52;20.93; 26.08; 29.41;25.44;30.98;34.19];
My code:
coeffs=fit([x,y],z,’Poly22′);
[~,idx]=min(z);
x(idx)
y(idx)
xval=fminunc(coeffs,[x(idx) y(idx)])
and
A=[x(:).^[0:2] y(:).^[1:2] x(:).*y(:)];
a=Az(:);
x2=linspace(0,2.00e-5,100);
y2=linspace(0,2.00e-4,100);
[X,Y]=meshgrid(x2,y2);
M=[X(:).^(0:2) Y(:).^(1:2) X(:).*Y(:)];
Z=X;
Z(:)=M*a;
f=@(xy) -14.19 -4.028e+05.*xy(:,1) + 2.774e+05.*xy(:,2)+ 1.473e+10.*xy(:,1).^2 + 7.05e+09.*xy(:,1).*xy(:,2) + -6.256e+08.*xy(:,2).^2;
fminsearch(f,[1.00e-5 1.55e-4])
Both methods give me results that seem incorrect. The fmincon gives me results at:
xval =
1.0e+06 *
0.324231351627941 -1.604585119026901
which based on the data, doesn’t make sense at all. What am I doing wrong? optimization, fminunc, fminsearch, matlab, functions MATLAB Answers — New Questions
Import timestamps with alternating date formats
Hello!
I have .csv data files that contain gps coordinates with timestamps. I want to import these data files into MATLAB. The problem I am having is the timestamp has an alternating date format, or at least matlab import is treating it as such. Timestamps look like:
Timestamp
16:15:29
16:15:29.500000
16:15:30
16:15:30.500000
etc.
Using import tool I can set a custom date format to HH:mm:ss.SSSSSS but this doesn’t work for the timestamps that don’t include the .SSSSSS
The import tool assigns NaT to those timestamps. Any ideas?Hello!
I have .csv data files that contain gps coordinates with timestamps. I want to import these data files into MATLAB. The problem I am having is the timestamp has an alternating date format, or at least matlab import is treating it as such. Timestamps look like:
Timestamp
16:15:29
16:15:29.500000
16:15:30
16:15:30.500000
etc.
Using import tool I can set a custom date format to HH:mm:ss.SSSSSS but this doesn’t work for the timestamps that don’t include the .SSSSSS
The import tool assigns NaT to those timestamps. Any ideas? Hello!
I have .csv data files that contain gps coordinates with timestamps. I want to import these data files into MATLAB. The problem I am having is the timestamp has an alternating date format, or at least matlab import is treating it as such. Timestamps look like:
Timestamp
16:15:29
16:15:29.500000
16:15:30
16:15:30.500000
etc.
Using import tool I can set a custom date format to HH:mm:ss.SSSSSS but this doesn’t work for the timestamps that don’t include the .SSSSSS
The import tool assigns NaT to those timestamps. Any ideas? timestamp import MATLAB Answers — New Questions
How to enable Nearest Neighbor Classifier
I would like to use "Optimizable KNN" for this training, but the whole NNC section is disabled for some reasons. Please help to solve this. The code is attached in the bottom.
% Define the file path
imageFolderPath = "C:UsersxxooxOneDriveデスクトップMATLAB worksDataMathWorks ImagesRoadside Ground Cover";
% Create an imageDatastore
imds = imageDatastore(imageFolderPath, …
‘IncludeSubfolders’, true, …
‘LabelSource’, ‘foldernames’);
% Display the count of each label
labelCount = countEachLabel(imds);
disp(‘Initial label count:’);
disp(labelCount);
% Split the datastore into training and testing subsets (85% training, 15% testing)
[imdsTrain, imdsTest] = splitEachLabel(imds, 0.85, ‘randomized’);
% Display the count of each label in the training datastore
labelCountTrain = countEachLabel(imdsTrain);
disp(‘Training label count:’);
disp(labelCountTrain);
% Count the images labeled as "Snow" in the training datastore
numSnowTrain = sum(imdsTrain.Labels == "Snow");
disp([‘Number of "Snow" images in the training datastore: ‘, num2str(numSnowTrain)]);
% Define the file path to the specific image
imageFilePath = fullfile(imageFolderPath, ‘No Snow’, ‘RoadsideA_1.jpg’);
% Read the image
img = imread(imageFilePath);
% Convert the image from RGB to HSV color space
hsvImage = rgb2hsv(img);
% Extract the saturation channel
saturationChannel = hsvImage(:,:,2);
% Calculate the mean saturation value
meanSaturation = mean(saturationChannel(:));
% Display the mean saturation
disp([‘The mean saturation for the "No Snow" labeled image "RoadsideA_1.jpg" is: ‘, num2str(meanSaturation)]);
% Calculate the standard deviation of the saturation values
stdSaturation = std(saturationChannel(:));
disp([‘The standard deviation of the saturation for the "No Snow" labeled image "RoadsideA_1.jpg" is: ‘, num2str(stdSaturation)]);
% Initialize arrays to store the results
fileNames = imdsTrain.Files;
labels = imdsTrain.Labels;
meanSaturations = zeros(length(fileNames), 1);
stdSaturations = zeros(length(fileNames), 1);
% Loop through each image in the training datastore
for i = 1:length(fileNames)
% Read the image
img = imread(fileNames{i});
% Convert the image from RGB to HSV color space
hsvImage = rgb2hsv(img);
% Extract the saturation channel
saturationChannel = hsvImage(:,:,2);
% Calculate the mean and standard deviation of the saturation
meanSaturations(i) = mean(saturationChannel(:));
stdSaturations(i) = std(saturationChannel(:));
end
% Create a table with the results
trainingTable = table(fileNames, labels, meanSaturations, stdSaturations, …
‘VariableNames’, {‘Filename’, ‘Label’, ‘MeanSaturation’, ‘StdSaturation’});
% Display the table
disp(trainingTable);
% Create the scatter plot
figure;
gscatter(trainingTable.MeanSaturation, trainingTable.StdSaturation, trainingTable.Label, ‘rb’, ‘ox’);
xlabel(‘Mean Saturation’);
ylabel(‘Standard Deviation of Saturation’);
title(‘Grouped Scatter Plot of Mean Saturation and Standard Deviation of Saturation’);
legend(‘No Snow’, ‘Snow’);
% Save the figure
saveas(gcf, ‘GroupedScatterPlot.png’);
% Display the result
disp(‘Scatter plot created and saved as GroupedScatterPlot.png’);I would like to use "Optimizable KNN" for this training, but the whole NNC section is disabled for some reasons. Please help to solve this. The code is attached in the bottom.
% Define the file path
imageFolderPath = "C:UsersxxooxOneDriveデスクトップMATLAB worksDataMathWorks ImagesRoadside Ground Cover";
% Create an imageDatastore
imds = imageDatastore(imageFolderPath, …
‘IncludeSubfolders’, true, …
‘LabelSource’, ‘foldernames’);
% Display the count of each label
labelCount = countEachLabel(imds);
disp(‘Initial label count:’);
disp(labelCount);
% Split the datastore into training and testing subsets (85% training, 15% testing)
[imdsTrain, imdsTest] = splitEachLabel(imds, 0.85, ‘randomized’);
% Display the count of each label in the training datastore
labelCountTrain = countEachLabel(imdsTrain);
disp(‘Training label count:’);
disp(labelCountTrain);
% Count the images labeled as "Snow" in the training datastore
numSnowTrain = sum(imdsTrain.Labels == "Snow");
disp([‘Number of "Snow" images in the training datastore: ‘, num2str(numSnowTrain)]);
% Define the file path to the specific image
imageFilePath = fullfile(imageFolderPath, ‘No Snow’, ‘RoadsideA_1.jpg’);
% Read the image
img = imread(imageFilePath);
% Convert the image from RGB to HSV color space
hsvImage = rgb2hsv(img);
% Extract the saturation channel
saturationChannel = hsvImage(:,:,2);
% Calculate the mean saturation value
meanSaturation = mean(saturationChannel(:));
% Display the mean saturation
disp([‘The mean saturation for the "No Snow" labeled image "RoadsideA_1.jpg" is: ‘, num2str(meanSaturation)]);
% Calculate the standard deviation of the saturation values
stdSaturation = std(saturationChannel(:));
disp([‘The standard deviation of the saturation for the "No Snow" labeled image "RoadsideA_1.jpg" is: ‘, num2str(stdSaturation)]);
% Initialize arrays to store the results
fileNames = imdsTrain.Files;
labels = imdsTrain.Labels;
meanSaturations = zeros(length(fileNames), 1);
stdSaturations = zeros(length(fileNames), 1);
% Loop through each image in the training datastore
for i = 1:length(fileNames)
% Read the image
img = imread(fileNames{i});
% Convert the image from RGB to HSV color space
hsvImage = rgb2hsv(img);
% Extract the saturation channel
saturationChannel = hsvImage(:,:,2);
% Calculate the mean and standard deviation of the saturation
meanSaturations(i) = mean(saturationChannel(:));
stdSaturations(i) = std(saturationChannel(:));
end
% Create a table with the results
trainingTable = table(fileNames, labels, meanSaturations, stdSaturations, …
‘VariableNames’, {‘Filename’, ‘Label’, ‘MeanSaturation’, ‘StdSaturation’});
% Display the table
disp(trainingTable);
% Create the scatter plot
figure;
gscatter(trainingTable.MeanSaturation, trainingTable.StdSaturation, trainingTable.Label, ‘rb’, ‘ox’);
xlabel(‘Mean Saturation’);
ylabel(‘Standard Deviation of Saturation’);
title(‘Grouped Scatter Plot of Mean Saturation and Standard Deviation of Saturation’);
legend(‘No Snow’, ‘Snow’);
% Save the figure
saveas(gcf, ‘GroupedScatterPlot.png’);
% Display the result
disp(‘Scatter plot created and saved as GroupedScatterPlot.png’); I would like to use "Optimizable KNN" for this training, but the whole NNC section is disabled for some reasons. Please help to solve this. The code is attached in the bottom.
% Define the file path
imageFolderPath = "C:UsersxxooxOneDriveデスクトップMATLAB worksDataMathWorks ImagesRoadside Ground Cover";
% Create an imageDatastore
imds = imageDatastore(imageFolderPath, …
‘IncludeSubfolders’, true, …
‘LabelSource’, ‘foldernames’);
% Display the count of each label
labelCount = countEachLabel(imds);
disp(‘Initial label count:’);
disp(labelCount);
% Split the datastore into training and testing subsets (85% training, 15% testing)
[imdsTrain, imdsTest] = splitEachLabel(imds, 0.85, ‘randomized’);
% Display the count of each label in the training datastore
labelCountTrain = countEachLabel(imdsTrain);
disp(‘Training label count:’);
disp(labelCountTrain);
% Count the images labeled as "Snow" in the training datastore
numSnowTrain = sum(imdsTrain.Labels == "Snow");
disp([‘Number of "Snow" images in the training datastore: ‘, num2str(numSnowTrain)]);
% Define the file path to the specific image
imageFilePath = fullfile(imageFolderPath, ‘No Snow’, ‘RoadsideA_1.jpg’);
% Read the image
img = imread(imageFilePath);
% Convert the image from RGB to HSV color space
hsvImage = rgb2hsv(img);
% Extract the saturation channel
saturationChannel = hsvImage(:,:,2);
% Calculate the mean saturation value
meanSaturation = mean(saturationChannel(:));
% Display the mean saturation
disp([‘The mean saturation for the "No Snow" labeled image "RoadsideA_1.jpg" is: ‘, num2str(meanSaturation)]);
% Calculate the standard deviation of the saturation values
stdSaturation = std(saturationChannel(:));
disp([‘The standard deviation of the saturation for the "No Snow" labeled image "RoadsideA_1.jpg" is: ‘, num2str(stdSaturation)]);
% Initialize arrays to store the results
fileNames = imdsTrain.Files;
labels = imdsTrain.Labels;
meanSaturations = zeros(length(fileNames), 1);
stdSaturations = zeros(length(fileNames), 1);
% Loop through each image in the training datastore
for i = 1:length(fileNames)
% Read the image
img = imread(fileNames{i});
% Convert the image from RGB to HSV color space
hsvImage = rgb2hsv(img);
% Extract the saturation channel
saturationChannel = hsvImage(:,:,2);
% Calculate the mean and standard deviation of the saturation
meanSaturations(i) = mean(saturationChannel(:));
stdSaturations(i) = std(saturationChannel(:));
end
% Create a table with the results
trainingTable = table(fileNames, labels, meanSaturations, stdSaturations, …
‘VariableNames’, {‘Filename’, ‘Label’, ‘MeanSaturation’, ‘StdSaturation’});
% Display the table
disp(trainingTable);
% Create the scatter plot
figure;
gscatter(trainingTable.MeanSaturation, trainingTable.StdSaturation, trainingTable.Label, ‘rb’, ‘ox’);
xlabel(‘Mean Saturation’);
ylabel(‘Standard Deviation of Saturation’);
title(‘Grouped Scatter Plot of Mean Saturation and Standard Deviation of Saturation’);
legend(‘No Snow’, ‘Snow’);
% Save the figure
saveas(gcf, ‘GroupedScatterPlot.png’);
% Display the result
disp(‘Scatter plot created and saved as GroupedScatterPlot.png’); matlab, plotting, machine learing, knn, nnc MATLAB Answers — New Questions
Autofill dates while skipping cells (without formatting)
Hi everyone, new (ish) to Microsoft Excel and I’m having some trouble with the Autofill tool. I have an old schedule that I’d like to update the dates on, without having to manually input each date. I read online that you could autofill while skipping certain cells by pressing ctrl (cmd for me bc ios), but when I do that, the shortcut Autofill icon disappears. When I search for Autofill, I can’t find the option of Fill w/o Formatting. I can always go back and individually correct each cell color and date, but I’m sure there has to be some ways to cut down on time, I just don’t know where to look. The dates in the photo were the ones I tried messing around with, but as you can see I’m unable to keep the original cell colors.
Hi everyone, new (ish) to Microsoft Excel and I’m having some trouble with the Autofill tool. I have an old schedule that I’d like to update the dates on, without having to manually input each date. I read online that you could autofill while skipping certain cells by pressing ctrl (cmd for me bc ios), but when I do that, the shortcut Autofill icon disappears. When I search for Autofill, I can’t find the option of Fill w/o Formatting. I can always go back and individually correct each cell color and date, but I’m sure there has to be some ways to cut down on time, I just don’t know where to look. The dates in the photo were the ones I tried messing around with, but as you can see I’m unable to keep the original cell colors. Read More
Macros & VBA:
Hello,
I have never used macros before. How do I use VBA to move the data from column C to B? I tried recording macros but got stuck with coding (I have never coded).
Attached is a picture of my task. Thanks! The data is not real, FYI.
Hello,I have never used macros before. How do I use VBA to move the data from column C to B? I tried recording macros but got stuck with coding (I have never coded).Attached is a picture of my task. Thanks! The data is not real, FYI. Read More
Can I re-establish a connection between a Form and a linked Excel spreadsheet
We have an MS Form through O365 which is linked to an Excel sheet in Sharepoint. Each form entry has been automatically added to the next row of the Excel.
It appears that some manual modifications within the Excel have caused the connection between the Excel and the Form to be broken. New entries are not auto-populating in the Excel.
Can anyone provide a way to reconnect the form to the existing spreadsheet that has been receiving form submissions? I know I can link a new Excel, but we have years of data in the old one, and really want to re-establish the broken connection.
Help!
We have an MS Form through O365 which is linked to an Excel sheet in Sharepoint. Each form entry has been automatically added to the next row of the Excel.It appears that some manual modifications within the Excel have caused the connection between the Excel and the Form to be broken. New entries are not auto-populating in the Excel. Can anyone provide a way to reconnect the form to the existing spreadsheet that has been receiving form submissions? I know I can link a new Excel, but we have years of data in the old one, and really want to re-establish the broken connection.Help! Read More
Azure Administrator Career Path – wrong certification?
Hello,
I have a quick question about the Administrator Career Path/Plan at https://learn.microsoft.com/en-us/plans/50nrtozg28d354 – the modules are all for AZ-104, however the certification in milestone 2 is a MS-365 certification. Could you please update the path/plan to include the AZ-104 instead as that seems to be more aligned with the overall path?
Hello, I have a quick question about the Administrator Career Path/Plan at https://learn.microsoft.com/en-us/plans/50nrtozg28d354 – the modules are all for AZ-104, however the certification in milestone 2 is a MS-365 certification. Could you please update the path/plan to include the AZ-104 instead as that seems to be more aligned with the overall path? Read More
Excel formula cells without =, but want to make a formula of it
Hello,
Hopefully somebody can help me.
I want to make a formula that solves a formula in a cell without a = sign.
Example:
Cell A1 = 2+4+6+12
Cell A2 = Answer of cell A1
What formula do i need in cell A2 to do this?
I have looked for 2 hours and can’t find how to do it.
Hello, Hopefully somebody can help me. I want to make a formula that solves a formula in a cell without a = sign. Example:Cell A1 = 2+4+6+12Cell A2 = Answer of cell A1 What formula do i need in cell A2 to do this? I have looked for 2 hours and can’t find how to do it. Read More
Create a specific colormap for a contour plot
Hi I am trying to create a contour plot with my own colormap. However, this only works up to a certain value, after which the colours are no longer output as I had hoped. From 36.8 on, everything is output in the same colour. Does anyone know why this happens?
Levels = [3200 3366 3566 3680 3700 3800]
num_points = diff(Levels);
colors = [ 0.24 0.36 0.56;
0.25 0.56 0.55;
0.45 0.82 0.26;
0.82 0.8 0.19;
0.81 0.61 0.24;
];
map = [];
for i=1:numel(num_points)
map = [map; repmat(colors(i,:), num_points(i), 1)];
end
figure( ‘Name’, ‘untitled fit 1’ , ‘Colormap’, map);
h = plot( fitresult, [xData, yData], zData, ‘Style’, ‘Contour’ );
set(h,’LevelList’,[23.4 33.6 35.6 36.8 37.0 40] , ‘ShowText’, ‘on’)Hi I am trying to create a contour plot with my own colormap. However, this only works up to a certain value, after which the colours are no longer output as I had hoped. From 36.8 on, everything is output in the same colour. Does anyone know why this happens?
Levels = [3200 3366 3566 3680 3700 3800]
num_points = diff(Levels);
colors = [ 0.24 0.36 0.56;
0.25 0.56 0.55;
0.45 0.82 0.26;
0.82 0.8 0.19;
0.81 0.61 0.24;
];
map = [];
for i=1:numel(num_points)
map = [map; repmat(colors(i,:), num_points(i), 1)];
end
figure( ‘Name’, ‘untitled fit 1’ , ‘Colormap’, map);
h = plot( fitresult, [xData, yData], zData, ‘Style’, ‘Contour’ );
set(h,’LevelList’,[23.4 33.6 35.6 36.8 37.0 40] , ‘ShowText’, ‘on’) Hi I am trying to create a contour plot with my own colormap. However, this only works up to a certain value, after which the colours are no longer output as I had hoped. From 36.8 on, everything is output in the same colour. Does anyone know why this happens?
Levels = [3200 3366 3566 3680 3700 3800]
num_points = diff(Levels);
colors = [ 0.24 0.36 0.56;
0.25 0.56 0.55;
0.45 0.82 0.26;
0.82 0.8 0.19;
0.81 0.61 0.24;
];
map = [];
for i=1:numel(num_points)
map = [map; repmat(colors(i,:), num_points(i), 1)];
end
figure( ‘Name’, ‘untitled fit 1’ , ‘Colormap’, map);
h = plot( fitresult, [xData, yData], zData, ‘Style’, ‘Contour’ );
set(h,’LevelList’,[23.4 33.6 35.6 36.8 37.0 40] , ‘ShowText’, ‘on’) colormap, contour plot, contour MATLAB Answers — New Questions
Create library from Existing library – Item vs Document Parent Content Type
Using the option to create from an existing library that has an Enterprise Content Type applied is producing a library with both Document and the desired Enterprise Content Type. To avoid confusion, we delete the “Document” CT leaving just our Enterprise CT. This is now mapped incorrectly to a parent of “Item” vs “Document” or the “Enterprise CT”. I suspect it has something to do with the way CTs are pushed onDemand to new sites. If we delete our CT first leaving “Document” CT and then re-add our CT then we have the desired results. Frustrating workaround …
Using the option to create from an existing library that has an Enterprise Content Type applied is producing a library with both Document and the desired Enterprise Content Type. To avoid confusion, we delete the “Document” CT leaving just our Enterprise CT. This is now mapped incorrectly to a parent of “Item” vs “Document” or the “Enterprise CT”. I suspect it has something to do with the way CTs are pushed onDemand to new sites. If we delete our CT first leaving “Document” CT and then re-add our CT then we have the desired results. Frustrating workaround … Read More
Teams Bot App debugging locally Listener function unable to start error
Hi,
I have used the following guide to set up a Teams bot with Cron trigger to test out the abilities of the Teams Development toolkit. Debug your Teams app locally using Visual Studio – Teams | Microsoft Learn
I followed each step and all was well until the end when attempting to debug locally the function app could not fire its cron trigger and printed out the error “The listener for function ‘NotifyTimerTrigger’ was unable to start” and “No connection could be made because the target machine actively refused it. (127.0.0.1:10000)”
I haven’t been able to find anything I did wrong or others who have had this same issue. Any guidance would be appreciated.
Hi, I have used the following guide to set up a Teams bot with Cron trigger to test out the abilities of the Teams Development toolkit. Debug your Teams app locally using Visual Studio – Teams | Microsoft Learn I followed each step and all was well until the end when attempting to debug locally the function app could not fire its cron trigger and printed out the error “The listener for function ‘NotifyTimerTrigger’ was unable to start” and “No connection could be made because the target machine actively refused it. (127.0.0.1:10000)” I haven’t been able to find anything I did wrong or others who have had this same issue. Any guidance would be appreciated. Read More
How to add 0.05 to excel
how do I add if I worked 0.5 hours for one day
how do I add if I worked 0.5 hours for one day Read More
I am finding issues in PDEPe which shows time integration failure again and again
"Warning: Failure at t=2.088125e-04. Unable to meet integration tolerances without reducing the step size
below the smallest value allowed (4.336809e-19) at time t. "
This message is being shown for running my code. I am uploading my code below.
clear all
clc
close all
m=0;
x=linspace(0,1,1001);
t=linspace(0,1,1001);
options = odeset(‘RelTol’, 1e-3, ‘AbsTol’, 1e-6,’MaxStep’, 0.1);
sol=pdepe(m,@coupledpde_BACD,@coupledic_BACD,@coupledbc_BACD,x,t,options);
b=sol(:,:,1);
figure(1)
surf(x,t,b)
xlabel(‘x’)
ylabel(‘t’)
zlabel(‘b(x,t)’)
grid on
title(‘Bacterial distribution’);
view([150 25])
colorbar
colormap jet
for j=[1 11 101]
ylim([0,1.2])
figure(2)
hold on
plot(x,b(j,:),LineWidth=2)
title("Particle Concentration Profile at t= (1, 11, 101)*td")
xlabel("Characteristic length")
ylabel(‘bacteria Concentration’)
end
function [c,f,s]= coupledpde_BACD(x,t,u, dudx)
Db=10^-12;
Dc=10^-9;
X0=10^-9;
% X0=linspace(10^-11,10^-9,100);
% Db=linspace(10^-13,10^-12,100);
c=1;
s=0;
l=[pi/2 3*pi/2 5*pi/2];
A=4.*(cos(l)-1)./(2.*l-sin(2.*l));
mob_ratio=X0/Dc;
d_ratio=Db/Dc;
f=(d_ratio).*dudx-u*(mob_ratio)./(1+exp(-l(1)^2.*t).*A(1).*sin(l(1).*x)).*(exp(-l(1)^2.*t).*A(1).*cos(l(1).*x).*l(1));
end
function u0 = coupledic_BACD(x)
u0=1;
end
function [pl,ql,pr,qr]= coupledbc_BACD(xl,ul,xr,ur,t)
pl=ul;
ql=0;
pr=0;
qr=1;
end
please help me find the issue in the code"Warning: Failure at t=2.088125e-04. Unable to meet integration tolerances without reducing the step size
below the smallest value allowed (4.336809e-19) at time t. "
This message is being shown for running my code. I am uploading my code below.
clear all
clc
close all
m=0;
x=linspace(0,1,1001);
t=linspace(0,1,1001);
options = odeset(‘RelTol’, 1e-3, ‘AbsTol’, 1e-6,’MaxStep’, 0.1);
sol=pdepe(m,@coupledpde_BACD,@coupledic_BACD,@coupledbc_BACD,x,t,options);
b=sol(:,:,1);
figure(1)
surf(x,t,b)
xlabel(‘x’)
ylabel(‘t’)
zlabel(‘b(x,t)’)
grid on
title(‘Bacterial distribution’);
view([150 25])
colorbar
colormap jet
for j=[1 11 101]
ylim([0,1.2])
figure(2)
hold on
plot(x,b(j,:),LineWidth=2)
title("Particle Concentration Profile at t= (1, 11, 101)*td")
xlabel("Characteristic length")
ylabel(‘bacteria Concentration’)
end
function [c,f,s]= coupledpde_BACD(x,t,u, dudx)
Db=10^-12;
Dc=10^-9;
X0=10^-9;
% X0=linspace(10^-11,10^-9,100);
% Db=linspace(10^-13,10^-12,100);
c=1;
s=0;
l=[pi/2 3*pi/2 5*pi/2];
A=4.*(cos(l)-1)./(2.*l-sin(2.*l));
mob_ratio=X0/Dc;
d_ratio=Db/Dc;
f=(d_ratio).*dudx-u*(mob_ratio)./(1+exp(-l(1)^2.*t).*A(1).*sin(l(1).*x)).*(exp(-l(1)^2.*t).*A(1).*cos(l(1).*x).*l(1));
end
function u0 = coupledic_BACD(x)
u0=1;
end
function [pl,ql,pr,qr]= coupledbc_BACD(xl,ul,xr,ur,t)
pl=ul;
ql=0;
pr=0;
qr=1;
end
please help me find the issue in the code "Warning: Failure at t=2.088125e-04. Unable to meet integration tolerances without reducing the step size
below the smallest value allowed (4.336809e-19) at time t. "
This message is being shown for running my code. I am uploading my code below.
clear all
clc
close all
m=0;
x=linspace(0,1,1001);
t=linspace(0,1,1001);
options = odeset(‘RelTol’, 1e-3, ‘AbsTol’, 1e-6,’MaxStep’, 0.1);
sol=pdepe(m,@coupledpde_BACD,@coupledic_BACD,@coupledbc_BACD,x,t,options);
b=sol(:,:,1);
figure(1)
surf(x,t,b)
xlabel(‘x’)
ylabel(‘t’)
zlabel(‘b(x,t)’)
grid on
title(‘Bacterial distribution’);
view([150 25])
colorbar
colormap jet
for j=[1 11 101]
ylim([0,1.2])
figure(2)
hold on
plot(x,b(j,:),LineWidth=2)
title("Particle Concentration Profile at t= (1, 11, 101)*td")
xlabel("Characteristic length")
ylabel(‘bacteria Concentration’)
end
function [c,f,s]= coupledpde_BACD(x,t,u, dudx)
Db=10^-12;
Dc=10^-9;
X0=10^-9;
% X0=linspace(10^-11,10^-9,100);
% Db=linspace(10^-13,10^-12,100);
c=1;
s=0;
l=[pi/2 3*pi/2 5*pi/2];
A=4.*(cos(l)-1)./(2.*l-sin(2.*l));
mob_ratio=X0/Dc;
d_ratio=Db/Dc;
f=(d_ratio).*dudx-u*(mob_ratio)./(1+exp(-l(1)^2.*t).*A(1).*sin(l(1).*x)).*(exp(-l(1)^2.*t).*A(1).*cos(l(1).*x).*l(1));
end
function u0 = coupledic_BACD(x)
u0=1;
end
function [pl,ql,pr,qr]= coupledbc_BACD(xl,ul,xr,ur,t)
pl=ul;
ql=0;
pr=0;
qr=1;
end
please help me find the issue in the code pdepe, time integration failure MATLAB Answers — New Questions
loop plot add text to only one specific plot year
Background:
time series for temp and chlorophyll from 2006 to current
created subplots for annual plots (four plots and text in the 5th subplot) (2006, 2007, 2008….2024)
saved title with the specific year for each plot (used num2str)
saved to correct path with the year in the filename (used num2str) filename = [‘AnnualPlots ‘, num2str(datedata), ‘.jpg’], datedata;
filenames are AnnualPlots 2006.jpg, AnnualPlots 2007.jpg, …AnnualPlots 2024.jpg
Everything checks out….
We had a sampling pause in 2020 and 2021…you know why. I would like to label this in the 2020 plot and 2021 plot.
???Is it possible to add details to an individual plot within a loop like code??? This is for outreach and I have limited coding experience.
% extract date, total chla, 3µm chla, 1 to 3 µm chla, > 3 µm chla
date = Data.DATEPST; % date sampled
sampletemp = Data.Sample_Temp; % deg C
chlaTotal = Data.TChla; % µg/L
chla3um = Data.Chla3um;% µg/L
chla3um1 = Data.Chla3um1; % 3µm>Chla percent(%)
chla3um2 = Data.Chla3um2; % 3µm<Chla percent(%)
% Get the current year
currentYear = year(datetime(‘now’));
% Iterate over each year from 2006 to the current year
for datedata = 2006:currentYear
% Create a new figure for each year
figure;
set(gcf, ‘Position’, [10,10,800,600])
subplot(5,1,1);
plot(date,sampletemp,"color","#4682B4", "LineWidth",0.5); % #4682B4 steal blue
yyaxis left
title({[num2str(datedata) ‘ Coastal Water (10 m depth)’] ‘California’});
ylabel(‘Temp (^oC)’)
xlim([datetime(datedata,1,1,0,0,0)…
datetime(datedata,12,31,0,0,0)])
datetick(‘x’,’mmm’,’keeplimits’,’keepticks’)
ylim([6 29])
where would this go and how to relate it to AnnualPlots 2020.jpg???
txt1 = ‘- – – – anthropause – – – -‘;
text(x,3,txt1,’Color’,’red’,’FontSize’,10,’Rotation’,0);
%yyaxis default was red; following code changes it back to black
ax = gca;
ax.YColor = ‘k’;
subplot(5,1,2);
…
subplot(5,1,3);
…
subplot(5,1,4);
…
subplot(5,1,5);
…
% Save each figure to a specific folder
filepath = ‘C:MeDesktopwebsite figures’;
filename = [‘AnnualPlots ‘, num2str(datedata), ‘.jpg’], datedata;
saveas(gcf, fullfile(filepath,filename));
endBackground:
time series for temp and chlorophyll from 2006 to current
created subplots for annual plots (four plots and text in the 5th subplot) (2006, 2007, 2008….2024)
saved title with the specific year for each plot (used num2str)
saved to correct path with the year in the filename (used num2str) filename = [‘AnnualPlots ‘, num2str(datedata), ‘.jpg’], datedata;
filenames are AnnualPlots 2006.jpg, AnnualPlots 2007.jpg, …AnnualPlots 2024.jpg
Everything checks out….
We had a sampling pause in 2020 and 2021…you know why. I would like to label this in the 2020 plot and 2021 plot.
???Is it possible to add details to an individual plot within a loop like code??? This is for outreach and I have limited coding experience.
% extract date, total chla, 3µm chla, 1 to 3 µm chla, > 3 µm chla
date = Data.DATEPST; % date sampled
sampletemp = Data.Sample_Temp; % deg C
chlaTotal = Data.TChla; % µg/L
chla3um = Data.Chla3um;% µg/L
chla3um1 = Data.Chla3um1; % 3µm>Chla percent(%)
chla3um2 = Data.Chla3um2; % 3µm<Chla percent(%)
% Get the current year
currentYear = year(datetime(‘now’));
% Iterate over each year from 2006 to the current year
for datedata = 2006:currentYear
% Create a new figure for each year
figure;
set(gcf, ‘Position’, [10,10,800,600])
subplot(5,1,1);
plot(date,sampletemp,"color","#4682B4", "LineWidth",0.5); % #4682B4 steal blue
yyaxis left
title({[num2str(datedata) ‘ Coastal Water (10 m depth)’] ‘California’});
ylabel(‘Temp (^oC)’)
xlim([datetime(datedata,1,1,0,0,0)…
datetime(datedata,12,31,0,0,0)])
datetick(‘x’,’mmm’,’keeplimits’,’keepticks’)
ylim([6 29])
where would this go and how to relate it to AnnualPlots 2020.jpg???
txt1 = ‘- – – – anthropause – – – -‘;
text(x,3,txt1,’Color’,’red’,’FontSize’,10,’Rotation’,0);
%yyaxis default was red; following code changes it back to black
ax = gca;
ax.YColor = ‘k’;
subplot(5,1,2);
…
subplot(5,1,3);
…
subplot(5,1,4);
…
subplot(5,1,5);
…
% Save each figure to a specific folder
filepath = ‘C:MeDesktopwebsite figures’;
filename = [‘AnnualPlots ‘, num2str(datedata), ‘.jpg’], datedata;
saveas(gcf, fullfile(filepath,filename));
end Background:
time series for temp and chlorophyll from 2006 to current
created subplots for annual plots (four plots and text in the 5th subplot) (2006, 2007, 2008….2024)
saved title with the specific year for each plot (used num2str)
saved to correct path with the year in the filename (used num2str) filename = [‘AnnualPlots ‘, num2str(datedata), ‘.jpg’], datedata;
filenames are AnnualPlots 2006.jpg, AnnualPlots 2007.jpg, …AnnualPlots 2024.jpg
Everything checks out….
We had a sampling pause in 2020 and 2021…you know why. I would like to label this in the 2020 plot and 2021 plot.
???Is it possible to add details to an individual plot within a loop like code??? This is for outreach and I have limited coding experience.
% extract date, total chla, 3µm chla, 1 to 3 µm chla, > 3 µm chla
date = Data.DATEPST; % date sampled
sampletemp = Data.Sample_Temp; % deg C
chlaTotal = Data.TChla; % µg/L
chla3um = Data.Chla3um;% µg/L
chla3um1 = Data.Chla3um1; % 3µm>Chla percent(%)
chla3um2 = Data.Chla3um2; % 3µm<Chla percent(%)
% Get the current year
currentYear = year(datetime(‘now’));
% Iterate over each year from 2006 to the current year
for datedata = 2006:currentYear
% Create a new figure for each year
figure;
set(gcf, ‘Position’, [10,10,800,600])
subplot(5,1,1);
plot(date,sampletemp,"color","#4682B4", "LineWidth",0.5); % #4682B4 steal blue
yyaxis left
title({[num2str(datedata) ‘ Coastal Water (10 m depth)’] ‘California’});
ylabel(‘Temp (^oC)’)
xlim([datetime(datedata,1,1,0,0,0)…
datetime(datedata,12,31,0,0,0)])
datetick(‘x’,’mmm’,’keeplimits’,’keepticks’)
ylim([6 29])
where would this go and how to relate it to AnnualPlots 2020.jpg???
txt1 = ‘- – – – anthropause – – – -‘;
text(x,3,txt1,’Color’,’red’,’FontSize’,10,’Rotation’,0);
%yyaxis default was red; following code changes it back to black
ax = gca;
ax.YColor = ‘k’;
subplot(5,1,2);
…
subplot(5,1,3);
…
subplot(5,1,4);
…
subplot(5,1,5);
…
% Save each figure to a specific folder
filepath = ‘C:MeDesktopwebsite figures’;
filename = [‘AnnualPlots ‘, num2str(datedata), ‘.jpg’], datedata;
saveas(gcf, fullfile(filepath,filename));
end time series, for loop, text MATLAB Answers — New Questions
Defining variable as a function of other variable
I am trying to define t as a function of k so that when I substitute compute_obj with define_t and then differentiate the objective_with_t function wrt k, Matlab should differentiate variable t for being a function of k. I tried numerous ways to define t as a function of k. Following code shows one of the ways in which I tried to do it –
% Define symbolic variables
syms k t real
% Define the relationship between k and t
t_k = @(k) t; % t is a function of k
% Define the expressions
compute_obj = -(sqrt(1 – k) * (t_k(k)^6 * (2 * m * (3 * m + 2) + 4) – t_k(k)^5 * (m * (m * (5 * m + 6) + 11) + 12) + m^6 + 2 * t_k(k)^7 – t_k(k)^8 – t_k(k)^4 * (m * (3 * m * (m * (3 * m + 2) – 3) – 16) – 9) – 2 * m^3 * t_k(k)^2 * (3 * m^3 + 2 * m + 3) + m^2 * t_k(k)^3 * (m * (3 * m * (5 * m + 4) + 1) – 4)) + sqrt(k) * (t_k(k)^4 * (m * (9 * m * (m * (m + 4) + 5) + 28) + 9) – m^4 * (3 * m – 2) – t_k(k)^6 * (6 * m * (m + 2) + 10) + t_k(k)^5 * (4 * m^3 + 12 * m + 8) + t_k(k)^8 + m * t_k(k)^2 * (m * (m * (4 * m^3 + 3 * m + 9) + 6) – 8) + 2 * m^2 * t_k(k) * (3 * m – 2) – 2 * m * t_k(k)^3 * (m * (m * (6 * m * (m + 2) + 7) + 6) – 2))) / (18 * t_k(k)^3 * (2 * t_k(k) – (m – t_k(k))^2));
define_t = (sqrt(k) * ((m / t + 2) / 3) – sqrt(1 – k) * ((1 / 3) * (2 + (m / t) + ((2 * m + t) / ((m – t)^2 – 2 * t))))) / (sqrt(k) * (2 * m^3 – 3 * (1 + m)^2 * t + t^3) / (3 * ((m – t)^2 – 2 * t)) – sqrt(1 – k) * ((2 * m + t) / 3));
% Main loop to solve for each m
m_values = linspace(0, 1, 100);
k_solutions = zeros(size(m_values));
t_solutions = zeros(size(m_values));
for i = 1:length(m_values)
m = m_values(i);
% Define the objective function with current m and symbolic t
objective_with_t = compute_obj;
% Differentiate the objective function with respect to k
d_obj_d_k = diff(objective_with_t, k);
% Convert the symbolic derivative to a MATLAB function
d_obj_d_k_fn = matlabFunction(d_obj_d_k, ‘Vars’, [k, t]);
% Define a function for numerical root finding to find optimal k
opt_k_fn = @(k_val) d_obj_d_k_fn(k_val, t_k(k_val));
% Use fminbnd to find the optimal k in the range [0.5, 1]
options = optimset(‘Display’, ‘off’);
k_opt = fminbnd(@(k) abs(opt_k_fn(k)), 0.5, 1, options);
% Define a function for numerical root finding to find t_opt
func = matlabFunction(t_k(k) – define_t, ‘Vars’, t);
% Use numerical root finding to find the fixed point of t
try
t_opt = fzero(func, 0.7); % Assuming a starting guess for t
catch
t_opt = NaN;
end
% Store solutions
k_solutions(i) = k_opt;
t_solutions(i) = t_opt;
end
% Display solutions
disp(table(m_values’, k_solutions’, t_solutions’, ‘VariableNames’, {‘m’, ‘k_opt’, ‘t_opt’}));
% Plot results
figure;
plot(m_values, k_solutions, ‘b-‘, ‘LineWidth’, 1.5);
hold on;
plot(m_values, t_solutions, ‘r–‘, ‘LineWidth’, 1.5);
xlabel(‘m’);
ylabel(‘Value’);
legend(‘Optimal k’, ‘Optimal t’);
title(‘Stackelberg Equilibrium Solutions’);
hold off;
I keep getting error. Please someone suggest a way to define t as function of kI am trying to define t as a function of k so that when I substitute compute_obj with define_t and then differentiate the objective_with_t function wrt k, Matlab should differentiate variable t for being a function of k. I tried numerous ways to define t as a function of k. Following code shows one of the ways in which I tried to do it –
% Define symbolic variables
syms k t real
% Define the relationship between k and t
t_k = @(k) t; % t is a function of k
% Define the expressions
compute_obj = -(sqrt(1 – k) * (t_k(k)^6 * (2 * m * (3 * m + 2) + 4) – t_k(k)^5 * (m * (m * (5 * m + 6) + 11) + 12) + m^6 + 2 * t_k(k)^7 – t_k(k)^8 – t_k(k)^4 * (m * (3 * m * (m * (3 * m + 2) – 3) – 16) – 9) – 2 * m^3 * t_k(k)^2 * (3 * m^3 + 2 * m + 3) + m^2 * t_k(k)^3 * (m * (3 * m * (5 * m + 4) + 1) – 4)) + sqrt(k) * (t_k(k)^4 * (m * (9 * m * (m * (m + 4) + 5) + 28) + 9) – m^4 * (3 * m – 2) – t_k(k)^6 * (6 * m * (m + 2) + 10) + t_k(k)^5 * (4 * m^3 + 12 * m + 8) + t_k(k)^8 + m * t_k(k)^2 * (m * (m * (4 * m^3 + 3 * m + 9) + 6) – 8) + 2 * m^2 * t_k(k) * (3 * m – 2) – 2 * m * t_k(k)^3 * (m * (m * (6 * m * (m + 2) + 7) + 6) – 2))) / (18 * t_k(k)^3 * (2 * t_k(k) – (m – t_k(k))^2));
define_t = (sqrt(k) * ((m / t + 2) / 3) – sqrt(1 – k) * ((1 / 3) * (2 + (m / t) + ((2 * m + t) / ((m – t)^2 – 2 * t))))) / (sqrt(k) * (2 * m^3 – 3 * (1 + m)^2 * t + t^3) / (3 * ((m – t)^2 – 2 * t)) – sqrt(1 – k) * ((2 * m + t) / 3));
% Main loop to solve for each m
m_values = linspace(0, 1, 100);
k_solutions = zeros(size(m_values));
t_solutions = zeros(size(m_values));
for i = 1:length(m_values)
m = m_values(i);
% Define the objective function with current m and symbolic t
objective_with_t = compute_obj;
% Differentiate the objective function with respect to k
d_obj_d_k = diff(objective_with_t, k);
% Convert the symbolic derivative to a MATLAB function
d_obj_d_k_fn = matlabFunction(d_obj_d_k, ‘Vars’, [k, t]);
% Define a function for numerical root finding to find optimal k
opt_k_fn = @(k_val) d_obj_d_k_fn(k_val, t_k(k_val));
% Use fminbnd to find the optimal k in the range [0.5, 1]
options = optimset(‘Display’, ‘off’);
k_opt = fminbnd(@(k) abs(opt_k_fn(k)), 0.5, 1, options);
% Define a function for numerical root finding to find t_opt
func = matlabFunction(t_k(k) – define_t, ‘Vars’, t);
% Use numerical root finding to find the fixed point of t
try
t_opt = fzero(func, 0.7); % Assuming a starting guess for t
catch
t_opt = NaN;
end
% Store solutions
k_solutions(i) = k_opt;
t_solutions(i) = t_opt;
end
% Display solutions
disp(table(m_values’, k_solutions’, t_solutions’, ‘VariableNames’, {‘m’, ‘k_opt’, ‘t_opt’}));
% Plot results
figure;
plot(m_values, k_solutions, ‘b-‘, ‘LineWidth’, 1.5);
hold on;
plot(m_values, t_solutions, ‘r–‘, ‘LineWidth’, 1.5);
xlabel(‘m’);
ylabel(‘Value’);
legend(‘Optimal k’, ‘Optimal t’);
title(‘Stackelberg Equilibrium Solutions’);
hold off;
I keep getting error. Please someone suggest a way to define t as function of k I am trying to define t as a function of k so that when I substitute compute_obj with define_t and then differentiate the objective_with_t function wrt k, Matlab should differentiate variable t for being a function of k. I tried numerous ways to define t as a function of k. Following code shows one of the ways in which I tried to do it –
% Define symbolic variables
syms k t real
% Define the relationship between k and t
t_k = @(k) t; % t is a function of k
% Define the expressions
compute_obj = -(sqrt(1 – k) * (t_k(k)^6 * (2 * m * (3 * m + 2) + 4) – t_k(k)^5 * (m * (m * (5 * m + 6) + 11) + 12) + m^6 + 2 * t_k(k)^7 – t_k(k)^8 – t_k(k)^4 * (m * (3 * m * (m * (3 * m + 2) – 3) – 16) – 9) – 2 * m^3 * t_k(k)^2 * (3 * m^3 + 2 * m + 3) + m^2 * t_k(k)^3 * (m * (3 * m * (5 * m + 4) + 1) – 4)) + sqrt(k) * (t_k(k)^4 * (m * (9 * m * (m * (m + 4) + 5) + 28) + 9) – m^4 * (3 * m – 2) – t_k(k)^6 * (6 * m * (m + 2) + 10) + t_k(k)^5 * (4 * m^3 + 12 * m + 8) + t_k(k)^8 + m * t_k(k)^2 * (m * (m * (4 * m^3 + 3 * m + 9) + 6) – 8) + 2 * m^2 * t_k(k) * (3 * m – 2) – 2 * m * t_k(k)^3 * (m * (m * (6 * m * (m + 2) + 7) + 6) – 2))) / (18 * t_k(k)^3 * (2 * t_k(k) – (m – t_k(k))^2));
define_t = (sqrt(k) * ((m / t + 2) / 3) – sqrt(1 – k) * ((1 / 3) * (2 + (m / t) + ((2 * m + t) / ((m – t)^2 – 2 * t))))) / (sqrt(k) * (2 * m^3 – 3 * (1 + m)^2 * t + t^3) / (3 * ((m – t)^2 – 2 * t)) – sqrt(1 – k) * ((2 * m + t) / 3));
% Main loop to solve for each m
m_values = linspace(0, 1, 100);
k_solutions = zeros(size(m_values));
t_solutions = zeros(size(m_values));
for i = 1:length(m_values)
m = m_values(i);
% Define the objective function with current m and symbolic t
objective_with_t = compute_obj;
% Differentiate the objective function with respect to k
d_obj_d_k = diff(objective_with_t, k);
% Convert the symbolic derivative to a MATLAB function
d_obj_d_k_fn = matlabFunction(d_obj_d_k, ‘Vars’, [k, t]);
% Define a function for numerical root finding to find optimal k
opt_k_fn = @(k_val) d_obj_d_k_fn(k_val, t_k(k_val));
% Use fminbnd to find the optimal k in the range [0.5, 1]
options = optimset(‘Display’, ‘off’);
k_opt = fminbnd(@(k) abs(opt_k_fn(k)), 0.5, 1, options);
% Define a function for numerical root finding to find t_opt
func = matlabFunction(t_k(k) – define_t, ‘Vars’, t);
% Use numerical root finding to find the fixed point of t
try
t_opt = fzero(func, 0.7); % Assuming a starting guess for t
catch
t_opt = NaN;
end
% Store solutions
k_solutions(i) = k_opt;
t_solutions(i) = t_opt;
end
% Display solutions
disp(table(m_values’, k_solutions’, t_solutions’, ‘VariableNames’, {‘m’, ‘k_opt’, ‘t_opt’}));
% Plot results
figure;
plot(m_values, k_solutions, ‘b-‘, ‘LineWidth’, 1.5);
hold on;
plot(m_values, t_solutions, ‘r–‘, ‘LineWidth’, 1.5);
xlabel(‘m’);
ylabel(‘Value’);
legend(‘Optimal k’, ‘Optimal t’);
title(‘Stackelberg Equilibrium Solutions’);
hold off;
I keep getting error. Please someone suggest a way to define t as function of k function, optimization, fmincon MATLAB Answers — New Questions
Insert/Delete Sheet Rows/Columns no longer working in new release of Excel
I recently bought a new Windows 11 PC to replace a boat anchor Windows 7 box.
Windows 11 box has most recent version of MSO365/Excel.
An Excel doc from the old PC loads and looks fine on the Windows 11 box, however I can no longer add or delete sheet rows or sheet columns (not even in Safe Mode) using right click Insert/Delete or using ‘Insert/Delete Sheet Rows or Insert/Delete Sheet Columns. The Delete Sheet row/column will clear the data, but it will not delete the row/column.
Does anyone have any insight into how to resolve this?
Recreating the Excel file would easily be a man-month of work so hoping to avoid that option.
Thanks.
I recently bought a new Windows 11 PC to replace a boat anchor Windows 7 box.Windows 11 box has most recent version of MSO365/Excel. An Excel doc from the old PC loads and looks fine on the Windows 11 box, however I can no longer add or delete sheet rows or sheet columns (not even in Safe Mode) using right click Insert/Delete or using ‘Insert/Delete Sheet Rows or Insert/Delete Sheet Columns. The Delete Sheet row/column will clear the data, but it will not delete the row/column. Does anyone have any insight into how to resolve this?Recreating the Excel file would easily be a man-month of work so hoping to avoid that option.Thanks. Read More
Implementing Joe’s Sandbox into Microsoft Sentinel Logic Apps
Dear all,
I am wondering if there are any resources on utilizing Joe’s Sandbox API into Sentinel/Logic Apps to analyze malware/malicious link in quarantined emails before releasing them.
Thanks,
Dear all, I am wondering if there are any resources on utilizing Joe’s Sandbox API into Sentinel/Logic Apps to analyze malware/malicious link in quarantined emails before releasing them. Thanks, Read More
New Launch – can someone share the copilot user survey kit?
We are about to launch our first MS 365 Copilot “pilot” and saw a reference to a “copilot user survey kit” Is there a link to this kit as I don’t see it in the MS 365 copilot materials.
We are about to launch our first MS 365 Copilot “pilot” and saw a reference to a “copilot user survey kit” Is there a link to this kit as I don’t see it in the MS 365 copilot materials. Read More
A sleeping tab feature without a disable feature?!
Im currently on an Xbox 1s and if im trying to do anything on microsoft edge if I exit out for even a second, POOF it sleeps and i have to restart the whole window. This is mainly felt on discord if I am trying to stream a show to my friends, i will exit the tab and everything goes quiet immediately. so I just know the tab went to sleep. Can this PLEASE get fixed? And it is not a preformance thing from my end, as i can run games perfectly fine.
Im currently on an Xbox 1s and if im trying to do anything on microsoft edge if I exit out for even a second, POOF it sleeps and i have to restart the whole window. This is mainly felt on discord if I am trying to stream a show to my friends, i will exit the tab and everything goes quiet immediately. so I just know the tab went to sleep. Can this PLEASE get fixed? And it is not a preformance thing from my end, as i can run games perfectly fine. Read More
Old Windows 10 PC thinks it is registered as an Insider PC, trying to install Windows 11 Preview
I have a very old Windows 10 PC that does not come close to being able to support Windows 11. Somehow Microsoft thinks this PC is part of the Insider Program, I have no idea how that happened to this PC. I do have some Windows 11 PCs that are part of the Insider program but no Windows 10 PCs.
Using Window Update results in this old PC downloading Windows 11 Insider Preview 10.0.26120.961 (ge_release) and trying to install it.
I looked online at the devices connected to my Microsoft Account and the old PC is not listed. When I click the link that says, “Go to Windows Insider Program settings to change your Insider level” I get a dialog box that asks me to “Link a Windows Insider account”. I am also sure that I never signed in with Microsoft Account on this old PC.
How do I get this old PC out of the Insider Program?
What’s going to happen if I let the installation complete?
I have a very old Windows 10 PC that does not come close to being able to support Windows 11. Somehow Microsoft thinks this PC is part of the Insider Program, I have no idea how that happened to this PC. I do have some Windows 11 PCs that are part of the Insider program but no Windows 10 PCs.Using Window Update results in this old PC downloading Windows 11 Insider Preview 10.0.26120.961 (ge_release) and trying to install it. I looked online at the devices connected to my Microsoft Account and the old PC is not listed. When I click the link that says, “Go to Windows Insider Program settings to change your Insider level” I get a dialog box that asks me to “Link a Windows Insider account”. I am also sure that I never signed in with Microsoft Account on this old PC. How do I get this old PC out of the Insider Program? What’s going to happen if I let the installation complete? Read More