Category: News
I have the wrong code. How should I modify it to accomplish the goal?
Post Content Post Content homework MATLAB Answers — New Questions
How do i extract ‘x’ and ‘y’data from ‘z’data? f(x,y)=z
I have ‘x’ data, ‘y’ data, ‘z1’ data ‘z2’ data.
It has two variable values(‘z1’, ‘z2’) at the same coordinates(x,y).
x : an integer from 1 to 13
y : an integer from 1 to 19
Z1: 13*19
I used cftool to plot the mesh. ( Interpolation)
How do I extract ‘x’ and ‘y’ data from ‘z1’ ‘z2’?
I want to estimate the coordinates by comparing the x,y data( extracted through z1)
with the x,y data (extracted through z2).
A simple example is similar to finding approximate coordinates by estimating longitude based on time and latitude based on temperature, (confined to a northern (lower hemisphere) region.)
After moving the cftool result to the workspace (name: fittedmodel_z1), in the command window, use a value with a decimal point, not an integer, within the range (~13, ~19) for x and y, such as ‘fittedmodel_z1(10.1,3.7)’ When I give the command, I can get z1 data.
How do I do it in reverse?
I want to use f(x,y)=a , but I don’t know the function f(x,y) .
Cannot use formula(fittedmodel_Z1).
>> formula(fittedmodel_Z1)
ans =
‘piecewise linear surface’
I just want to know the coordinates through the overlapping part like the red hatched part in the picture below.
How about using artificial intelligence like a classification model? Or fuzzy?
Thank you.I have ‘x’ data, ‘y’ data, ‘z1’ data ‘z2’ data.
It has two variable values(‘z1’, ‘z2’) at the same coordinates(x,y).
x : an integer from 1 to 13
y : an integer from 1 to 19
Z1: 13*19
I used cftool to plot the mesh. ( Interpolation)
How do I extract ‘x’ and ‘y’ data from ‘z1’ ‘z2’?
I want to estimate the coordinates by comparing the x,y data( extracted through z1)
with the x,y data (extracted through z2).
A simple example is similar to finding approximate coordinates by estimating longitude based on time and latitude based on temperature, (confined to a northern (lower hemisphere) region.)
After moving the cftool result to the workspace (name: fittedmodel_z1), in the command window, use a value with a decimal point, not an integer, within the range (~13, ~19) for x and y, such as ‘fittedmodel_z1(10.1,3.7)’ When I give the command, I can get z1 data.
How do I do it in reverse?
I want to use f(x,y)=a , but I don’t know the function f(x,y) .
Cannot use formula(fittedmodel_Z1).
>> formula(fittedmodel_Z1)
ans =
‘piecewise linear surface’
I just want to know the coordinates through the overlapping part like the red hatched part in the picture below.
How about using artificial intelligence like a classification model? Or fuzzy?
Thank you. I have ‘x’ data, ‘y’ data, ‘z1’ data ‘z2’ data.
It has two variable values(‘z1’, ‘z2’) at the same coordinates(x,y).
x : an integer from 1 to 13
y : an integer from 1 to 19
Z1: 13*19
I used cftool to plot the mesh. ( Interpolation)
How do I extract ‘x’ and ‘y’ data from ‘z1’ ‘z2’?
I want to estimate the coordinates by comparing the x,y data( extracted through z1)
with the x,y data (extracted through z2).
A simple example is similar to finding approximate coordinates by estimating longitude based on time and latitude based on temperature, (confined to a northern (lower hemisphere) region.)
After moving the cftool result to the workspace (name: fittedmodel_z1), in the command window, use a value with a decimal point, not an integer, within the range (~13, ~19) for x and y, such as ‘fittedmodel_z1(10.1,3.7)’ When I give the command, I can get z1 data.
How do I do it in reverse?
I want to use f(x,y)=a , but I don’t know the function f(x,y) .
Cannot use formula(fittedmodel_Z1).
>> formula(fittedmodel_Z1)
ans =
‘piecewise linear surface’
I just want to know the coordinates through the overlapping part like the red hatched part in the picture below.
How about using artificial intelligence like a classification model? Or fuzzy?
Thank you. mesh, curve fitting, cftool, f(xy)=z, fuzzy, classification, learning, data, plot, formula MATLAB Answers — New Questions
read columns on command
what he mean it here and how I write the command :what he mean it here and how I write the command : what he mean it here and how I write the command : matlab MATLAB Answers — New Questions
Different results for same equation in curve fitting
Why is custom fitting not the same as the exponential default one as shown in the picture? The data fits nicely when I use the ‘exp2’ instead.
I’m relatively new to MATLAB and this is quite baffling to me as i am unable to use a custom equation as it simply does not fit.Why is custom fitting not the same as the exponential default one as shown in the picture? The data fits nicely when I use the ‘exp2’ instead.
I’m relatively new to MATLAB and this is quite baffling to me as i am unable to use a custom equation as it simply does not fit. Why is custom fitting not the same as the exponential default one as shown in the picture? The data fits nicely when I use the ‘exp2’ instead.
I’m relatively new to MATLAB and this is quite baffling to me as i am unable to use a custom equation as it simply does not fit. curve fitting MATLAB Answers — New Questions
server 2022 suddenly shutdown
I have a Windows server 2022 standard that suddenly shutdown and I can’t find the reason why. I have the two events that have numbers saying why, but I can’t find a definition of what they mean. What do the two following events say about why a server just shutdown.
Information
6/7/2024 11:07:19 AM
Microsoft-Windows-Kernel-Power
566
-268
The system session has transitioned from 181 to 183. Reason: 21
Information
6/7/2024 11:07:19 AM
User32
1074
None
The process C:Windowssystem32winlogon.exe (MYSERVER) has initiated the power off of computer MYSERVER on behalf of user NT AUTHORITYSYSTEM
for the following reason: No title for this reason could be found
Reason Code: 0x500ff
Shutdown Type: power off
Comment:
Thanks.
I have a Windows server 2022 standard that suddenly shutdown and I can’t find the reason why. I have the two events that have numbers saying why, but I can’t find a definition of what they mean. What do the two following events say about why a server just shutdown. Information6/7/2024 11:07:19 AMMicrosoft-Windows-Kernel-Power566-268The system session has transitioned from 181 to 183. Reason: 21 Information6/7/2024 11:07:19 AMUser321074NoneThe process C:Windowssystem32winlogon.exe (MYSERVER) has initiated the power off of computer MYSERVER on behalf of user NT AUTHORITYSYSTEMfor the following reason: No title for this reason could be foundReason Code: 0x500ffShutdown Type: power offComment: Thanks. Read More
GUI Matlab real time data storage using DataAcquisition Interface
Hope you all well, i have GUI app which is getting data from national instrument and give back live plot after trun switch on and when switch is off the recorded data wil stop and real time data will stop, however i am trying to intesert another button to clear the previous or delete them from store array however it won’t happened i tried clear func and clf to remove plot and delete the array nothing working i will place the code blow and screen shot of the app design if you could help me to solve this i would be supre greatfull to you what i want is that the previouse data from block 1 and 2 get deleted after clear data button is clicked
classdef app2 < matlab.apps.AppBase
% Properties that correspond to app components
properties (Access = public)
UIFigure matlab.ui.Figure
TabGroup matlab.ui.container.TabGroup
Tab matlab.ui.container.Tab
CleardataButton matlab.ui.control.Button
DistancemmEditField matlab.ui.control.NumericEditField
DistancemmEditFieldLabel matlab.ui.control.Label
VoltageLEditField matlab.ui.control.NumericEditField
VoltageLEditFieldLabel matlab.ui.control.Label
LoadNEditField matlab.ui.control.NumericEditField
LoadNEditFieldLabel matlab.ui.control.Label
VoltageEditField matlab.ui.control.NumericEditField
VoltageEditFieldLabel matlab.ui.control.Label
SAVEDATAButton matlab.ui.control.Button
Lamp matlab.ui.control.Lamp
LampLabel matlab.ui.control.Label
Switch matlab.ui.control.Switch
SwitchLabel matlab.ui.control.Label
UIAxes matlab.ui.control.UIAxes
end
properties (Access = private)
dq = daq("ni"); % Create a DataAcquisition object.
R = 5000;% Description
% % Arrays to store data for plotting
% timeData = [];
% loadData = [];
% distanceData = [];
end
properties (Access = public)
voltage
distance
load
f1
f2
timeData = [];
loadData = [];
distanceData = [];
end
methods (Access = public)
%
function getdat(app,src,~)
[d, ~] = read(src,src.ScansAvailableFcnCount,"OutputFormat","Matrix");
voltage = mean(d(:,1));
app.VoltageEditField.Value = voltage;
app.LoadNEditField.Value = voltage * 4.19; %* 10497;
load =app.LoadNEditField.Value ;
app.VoltageLEditField.Value = mean(d(:,2));
distance = (app.VoltageLEditField.Value – 0.7966) * 4.51;
app.DistancemmEditField.Value = distance;
% Append data to arrays
app.timeData = [app.timeData; datetime(‘now’)];
app.loadData = [app.loadData; load];
app.distanceData = [app.distanceData; distance];
% Plot all data
yyaxis(app.UIAxes, ‘left’);
app.f1= plot(app.UIAxes, app.timeData, app.loadData);
ylabel(app.UIAxes, ‘Load (N)’);
yyaxis(app.UIAxes, ‘right’);
app.f2= plot(app.UIAxes, app.timeData, app.distanceData, ‘r’);
ylabel(app.UIAxes, ‘Displacement (mm)’);
xlabel(app.UIAxes, ‘Time’);
app.UIAxes.XGrid = ‘on’;
app.UIAxes.YGrid = ‘on’;
%{
plot(app.UIAxes, app.timeData, app.loadData, ‘b’, app.timeData, app.distanceData, ‘r’);
xlabel(app.UIAxes, ‘Time’);
ylabel(app.UIAxes, ‘Load (N) / Distance (mm)’);
legend(app.UIAxes, ‘Load’, ‘Distance’);
%}
end
end
% Callbacks that handle component events
methods (Access = private)
% Value changed function: Switch
function SwitchValueChanged(app, event)
value = app.Switch.Value;
if strcmp(value,"On")
app.Lamp.Color = ‘g’;
app.dq = daq("ni");
app.dq.ScansAvailableFcn = @(src,event) getdat(app, src, event);
ch1 = addinput(app.dq, ‘Dev1’, ‘ai0′,’Voltage’);
ch2 = addinput(app.dq, ‘Dev1’, ‘ai1′,’Voltage’);
app.dq.Rate = app.R;
app.dq.UserData = [0 0];
start(app.dq,"Continuous");
else
% app.dq.ScansAvailableFcn = @(src,event) getdat(app, src, event);
stop(app.dq);
app.Lamp.Color = ‘r’;
% delete(app.f1);
%
% delete(app.f2);
removechannel(app.dq,1:length(app.dq))
% start(app.dq,"Continuous");
% removechannel(app.dq,2)
% daqreset
end
end
% Button pushed function: SAVEDATAButton
function SAVEDATAButtonPushed(app, event)
% Prompt the user to choose a filename and location for saving the data
[filename, filepath] = uiputfile(‘*.csv’, ‘Save Data As’);
if isequal(filename,0) || isequal(filepath,0)
% User canceled the operation
return;
end
% Combine the filename and path
fullpath = fullfile(filepath, filename);
% Open or create the CSV file
fid = fopen(fullpath, ‘w’);
% Write headers to the CSV file
fprintf(fid, ‘Time,Load (N),Displacement (mm)n’);
% Write data to the CSV file
for i = 1:numel(app.timeData)
fprintf(fid, ‘%s,%f,%fn’, …
datestr(app.timeData(i)), …
app.loadData(i), …
app.distanceData(i));
end
% Close the file
fclose(fid);
end
% Callback function
function SystemLogSizeChanged(app, event)
% position = app.SystemLog.Position;
% if strcmp(app.Lamp.Color,’g’)
%
end
% Button pushed function: CleardataButton
function CleardataButtonPushed(app, event)
% app.dq.ScansAvailableFcn = @(src,event) getdat(app, src, event);
stop(app.dq);
% Clear the session and channels.
% app.timeData = [app.timeData; datetime(‘now’)];
% app.loadData = [app.loadData; app.load];
% app.distanceData = [app.distanceData; app.distance];
delete(app.f1);
delete (‘app.timeData’)
delete (‘app.distanceData’)
delete (‘app.loadData’)
delete(app.f2);
% daqreset
% start(app.dq);
% app.dq
% stop(app.dq);
% cla(app.load,"reset");
% delete (app.load);
% cla(app.distance,"reset");
% delete(app.distance);
% cla(app.UIAxes);
% cla()
% delete(app.dq);
% delete(app.distance);
% delete(app.UIAxes)
% cla(app.UIAxes,"reset");
% app.dq.release(‘ni’);
end
end
% Component initialization
methods (Access = private)
% Create UIFigure and components
function createComponents(app)
% Create UIFigure and hide until all components are created
app.UIFigure = uifigure(‘Visible’, ‘off’);
app.UIFigure.Position = [100 100 1051 699];
app.UIFigure.Name = ‘MATLAB App’;
% Create TabGroup
app.TabGroup = uitabgroup(app.UIFigure);
app.TabGroup.Position = [1 0 1051 699];
% Create Tab
app.Tab = uitab(app.TabGroup);
app.Tab.Title = ‘Tab’;
% Create UIAxes
app.UIAxes = uiaxes(app.Tab);
xlabel(app.UIAxes, ‘Displacement (mm)’)
ylabel(app.UIAxes, ‘Force (N)’)
zlabel(app.UIAxes, ‘Z’)
app.UIAxes.YGrid = ‘on’;
app.UIAxes.Position = [15 26 828 505];
% Create SwitchLabel
app.SwitchLabel = uilabel(app.Tab);
app.SwitchLabel.HorizontalAlignment = ‘center’;
app.SwitchLabel.Position = [40 599 40 22];
app.SwitchLabel.Text = ‘Switch’;
% Create Switch
app.Switch = uiswitch(app.Tab, ‘slider’);
app.Switch.ValueChangedFcn = createCallbackFcn(app, @SwitchValueChanged, true);
app.Switch.Position = [37 636 45 20];
% Create LampLabel
app.LampLabel = uilabel(app.Tab);
app.LampLabel.HorizontalAlignment = ‘right’;
app.LampLabel.Position = [25 562 35 22];
app.LampLabel.Text = ‘Lamp’;
% Create Lamp
app.Lamp = uilamp(app.Tab);
app.Lamp.Position = [75 562 20 20];
app.Lamp.Color = [1 0 0];
% Create SAVEDATAButton
app.SAVEDATAButton = uibutton(app.Tab, ‘push’);
app.SAVEDATAButton.ButtonPushedFcn = createCallbackFcn(app, @SAVEDATAButtonPushed, true);
app.SAVEDATAButton.Position = [940 25 100 23];
app.SAVEDATAButton.Text = ‘SAVE DATA’;
% Create VoltageEditFieldLabel
app.VoltageEditFieldLabel = uilabel(app.Tab);
app.VoltageEditFieldLabel.HorizontalAlignment = ‘right’;
app.VoltageEditFieldLabel.Position = [878 226 46 22];
app.VoltageEditFieldLabel.Text = ‘Voltage’;
% Create VoltageEditField
app.VoltageEditField = uieditfield(app.Tab, ‘numeric’);
app.VoltageEditField.Position = [939 226 100 22];
% Create LoadNEditFieldLabel
app.LoadNEditFieldLabel = uilabel(app.Tab);
app.LoadNEditFieldLabel.HorizontalAlignment = ‘right’;
app.LoadNEditFieldLabel.Position = [872 133 52 22];
app.LoadNEditFieldLabel.Text = ‘Load (N)’;
% Create LoadNEditField
app.LoadNEditField = uieditfield(app.Tab, ‘numeric’);
app.LoadNEditField.Position = [939 133 100 22];
% Create VoltageLEditFieldLabel
app.VoltageLEditFieldLabel = uilabel(app.Tab);
app.VoltageLEditFieldLabel.HorizontalAlignment = ‘right’;
app.VoltageLEditFieldLabel.Position = [861 188 63 22];
app.VoltageLEditFieldLabel.Text = ‘Voltage (L)’;
% Create VoltageLEditField
app.VoltageLEditField = uieditfield(app.Tab, ‘numeric’);
app.VoltageLEditField.Position = [939 188 100 22];
% Create DistancemmEditFieldLabel
app.DistancemmEditFieldLabel = uilabel(app.Tab);
app.DistancemmEditFieldLabel.HorizontalAlignment = ‘right’;
app.DistancemmEditFieldLabel.Position = [841 82 83 22];
app.DistancemmEditFieldLabel.Text = ‘Distance (mm)’;
% Create DistancemmEditField
app.DistancemmEditField = uieditfield(app.Tab, ‘numeric’);
app.DistancemmEditField.Position = [939 82 100 22];
% Create CleardataButton
app.CleardataButton = uibutton(app.Tab, ‘push’);
app.CleardataButton.ButtonPushedFcn = createCallbackFcn(app, @CleardataButtonPushed, true);
app.CleardataButton.Position = [938 280 100 23];
app.CleardataButton.Text = ‘Clear data’;
% Show the figure after all components are created
app.UIFigure.Visible = ‘on’;
end
end
% App creation and deletion
methods (Access = public)
% Construct app
function app = app2
% Create UIFigure and components
createComponents(app)
% Register the app with App Designer
registerApp(app, app.UIFigure)
if nargout == 0
clear app
end
end
% Code that executes before app deletion
function delete(app)
% Delete UIFigure when app is deleted
delete(app.UIFigure)
end
end
endHope you all well, i have GUI app which is getting data from national instrument and give back live plot after trun switch on and when switch is off the recorded data wil stop and real time data will stop, however i am trying to intesert another button to clear the previous or delete them from store array however it won’t happened i tried clear func and clf to remove plot and delete the array nothing working i will place the code blow and screen shot of the app design if you could help me to solve this i would be supre greatfull to you what i want is that the previouse data from block 1 and 2 get deleted after clear data button is clicked
classdef app2 < matlab.apps.AppBase
% Properties that correspond to app components
properties (Access = public)
UIFigure matlab.ui.Figure
TabGroup matlab.ui.container.TabGroup
Tab matlab.ui.container.Tab
CleardataButton matlab.ui.control.Button
DistancemmEditField matlab.ui.control.NumericEditField
DistancemmEditFieldLabel matlab.ui.control.Label
VoltageLEditField matlab.ui.control.NumericEditField
VoltageLEditFieldLabel matlab.ui.control.Label
LoadNEditField matlab.ui.control.NumericEditField
LoadNEditFieldLabel matlab.ui.control.Label
VoltageEditField matlab.ui.control.NumericEditField
VoltageEditFieldLabel matlab.ui.control.Label
SAVEDATAButton matlab.ui.control.Button
Lamp matlab.ui.control.Lamp
LampLabel matlab.ui.control.Label
Switch matlab.ui.control.Switch
SwitchLabel matlab.ui.control.Label
UIAxes matlab.ui.control.UIAxes
end
properties (Access = private)
dq = daq("ni"); % Create a DataAcquisition object.
R = 5000;% Description
% % Arrays to store data for plotting
% timeData = [];
% loadData = [];
% distanceData = [];
end
properties (Access = public)
voltage
distance
load
f1
f2
timeData = [];
loadData = [];
distanceData = [];
end
methods (Access = public)
%
function getdat(app,src,~)
[d, ~] = read(src,src.ScansAvailableFcnCount,"OutputFormat","Matrix");
voltage = mean(d(:,1));
app.VoltageEditField.Value = voltage;
app.LoadNEditField.Value = voltage * 4.19; %* 10497;
load =app.LoadNEditField.Value ;
app.VoltageLEditField.Value = mean(d(:,2));
distance = (app.VoltageLEditField.Value – 0.7966) * 4.51;
app.DistancemmEditField.Value = distance;
% Append data to arrays
app.timeData = [app.timeData; datetime(‘now’)];
app.loadData = [app.loadData; load];
app.distanceData = [app.distanceData; distance];
% Plot all data
yyaxis(app.UIAxes, ‘left’);
app.f1= plot(app.UIAxes, app.timeData, app.loadData);
ylabel(app.UIAxes, ‘Load (N)’);
yyaxis(app.UIAxes, ‘right’);
app.f2= plot(app.UIAxes, app.timeData, app.distanceData, ‘r’);
ylabel(app.UIAxes, ‘Displacement (mm)’);
xlabel(app.UIAxes, ‘Time’);
app.UIAxes.XGrid = ‘on’;
app.UIAxes.YGrid = ‘on’;
%{
plot(app.UIAxes, app.timeData, app.loadData, ‘b’, app.timeData, app.distanceData, ‘r’);
xlabel(app.UIAxes, ‘Time’);
ylabel(app.UIAxes, ‘Load (N) / Distance (mm)’);
legend(app.UIAxes, ‘Load’, ‘Distance’);
%}
end
end
% Callbacks that handle component events
methods (Access = private)
% Value changed function: Switch
function SwitchValueChanged(app, event)
value = app.Switch.Value;
if strcmp(value,"On")
app.Lamp.Color = ‘g’;
app.dq = daq("ni");
app.dq.ScansAvailableFcn = @(src,event) getdat(app, src, event);
ch1 = addinput(app.dq, ‘Dev1’, ‘ai0′,’Voltage’);
ch2 = addinput(app.dq, ‘Dev1’, ‘ai1′,’Voltage’);
app.dq.Rate = app.R;
app.dq.UserData = [0 0];
start(app.dq,"Continuous");
else
% app.dq.ScansAvailableFcn = @(src,event) getdat(app, src, event);
stop(app.dq);
app.Lamp.Color = ‘r’;
% delete(app.f1);
%
% delete(app.f2);
removechannel(app.dq,1:length(app.dq))
% start(app.dq,"Continuous");
% removechannel(app.dq,2)
% daqreset
end
end
% Button pushed function: SAVEDATAButton
function SAVEDATAButtonPushed(app, event)
% Prompt the user to choose a filename and location for saving the data
[filename, filepath] = uiputfile(‘*.csv’, ‘Save Data As’);
if isequal(filename,0) || isequal(filepath,0)
% User canceled the operation
return;
end
% Combine the filename and path
fullpath = fullfile(filepath, filename);
% Open or create the CSV file
fid = fopen(fullpath, ‘w’);
% Write headers to the CSV file
fprintf(fid, ‘Time,Load (N),Displacement (mm)n’);
% Write data to the CSV file
for i = 1:numel(app.timeData)
fprintf(fid, ‘%s,%f,%fn’, …
datestr(app.timeData(i)), …
app.loadData(i), …
app.distanceData(i));
end
% Close the file
fclose(fid);
end
% Callback function
function SystemLogSizeChanged(app, event)
% position = app.SystemLog.Position;
% if strcmp(app.Lamp.Color,’g’)
%
end
% Button pushed function: CleardataButton
function CleardataButtonPushed(app, event)
% app.dq.ScansAvailableFcn = @(src,event) getdat(app, src, event);
stop(app.dq);
% Clear the session and channels.
% app.timeData = [app.timeData; datetime(‘now’)];
% app.loadData = [app.loadData; app.load];
% app.distanceData = [app.distanceData; app.distance];
delete(app.f1);
delete (‘app.timeData’)
delete (‘app.distanceData’)
delete (‘app.loadData’)
delete(app.f2);
% daqreset
% start(app.dq);
% app.dq
% stop(app.dq);
% cla(app.load,"reset");
% delete (app.load);
% cla(app.distance,"reset");
% delete(app.distance);
% cla(app.UIAxes);
% cla()
% delete(app.dq);
% delete(app.distance);
% delete(app.UIAxes)
% cla(app.UIAxes,"reset");
% app.dq.release(‘ni’);
end
end
% Component initialization
methods (Access = private)
% Create UIFigure and components
function createComponents(app)
% Create UIFigure and hide until all components are created
app.UIFigure = uifigure(‘Visible’, ‘off’);
app.UIFigure.Position = [100 100 1051 699];
app.UIFigure.Name = ‘MATLAB App’;
% Create TabGroup
app.TabGroup = uitabgroup(app.UIFigure);
app.TabGroup.Position = [1 0 1051 699];
% Create Tab
app.Tab = uitab(app.TabGroup);
app.Tab.Title = ‘Tab’;
% Create UIAxes
app.UIAxes = uiaxes(app.Tab);
xlabel(app.UIAxes, ‘Displacement (mm)’)
ylabel(app.UIAxes, ‘Force (N)’)
zlabel(app.UIAxes, ‘Z’)
app.UIAxes.YGrid = ‘on’;
app.UIAxes.Position = [15 26 828 505];
% Create SwitchLabel
app.SwitchLabel = uilabel(app.Tab);
app.SwitchLabel.HorizontalAlignment = ‘center’;
app.SwitchLabel.Position = [40 599 40 22];
app.SwitchLabel.Text = ‘Switch’;
% Create Switch
app.Switch = uiswitch(app.Tab, ‘slider’);
app.Switch.ValueChangedFcn = createCallbackFcn(app, @SwitchValueChanged, true);
app.Switch.Position = [37 636 45 20];
% Create LampLabel
app.LampLabel = uilabel(app.Tab);
app.LampLabel.HorizontalAlignment = ‘right’;
app.LampLabel.Position = [25 562 35 22];
app.LampLabel.Text = ‘Lamp’;
% Create Lamp
app.Lamp = uilamp(app.Tab);
app.Lamp.Position = [75 562 20 20];
app.Lamp.Color = [1 0 0];
% Create SAVEDATAButton
app.SAVEDATAButton = uibutton(app.Tab, ‘push’);
app.SAVEDATAButton.ButtonPushedFcn = createCallbackFcn(app, @SAVEDATAButtonPushed, true);
app.SAVEDATAButton.Position = [940 25 100 23];
app.SAVEDATAButton.Text = ‘SAVE DATA’;
% Create VoltageEditFieldLabel
app.VoltageEditFieldLabel = uilabel(app.Tab);
app.VoltageEditFieldLabel.HorizontalAlignment = ‘right’;
app.VoltageEditFieldLabel.Position = [878 226 46 22];
app.VoltageEditFieldLabel.Text = ‘Voltage’;
% Create VoltageEditField
app.VoltageEditField = uieditfield(app.Tab, ‘numeric’);
app.VoltageEditField.Position = [939 226 100 22];
% Create LoadNEditFieldLabel
app.LoadNEditFieldLabel = uilabel(app.Tab);
app.LoadNEditFieldLabel.HorizontalAlignment = ‘right’;
app.LoadNEditFieldLabel.Position = [872 133 52 22];
app.LoadNEditFieldLabel.Text = ‘Load (N)’;
% Create LoadNEditField
app.LoadNEditField = uieditfield(app.Tab, ‘numeric’);
app.LoadNEditField.Position = [939 133 100 22];
% Create VoltageLEditFieldLabel
app.VoltageLEditFieldLabel = uilabel(app.Tab);
app.VoltageLEditFieldLabel.HorizontalAlignment = ‘right’;
app.VoltageLEditFieldLabel.Position = [861 188 63 22];
app.VoltageLEditFieldLabel.Text = ‘Voltage (L)’;
% Create VoltageLEditField
app.VoltageLEditField = uieditfield(app.Tab, ‘numeric’);
app.VoltageLEditField.Position = [939 188 100 22];
% Create DistancemmEditFieldLabel
app.DistancemmEditFieldLabel = uilabel(app.Tab);
app.DistancemmEditFieldLabel.HorizontalAlignment = ‘right’;
app.DistancemmEditFieldLabel.Position = [841 82 83 22];
app.DistancemmEditFieldLabel.Text = ‘Distance (mm)’;
% Create DistancemmEditField
app.DistancemmEditField = uieditfield(app.Tab, ‘numeric’);
app.DistancemmEditField.Position = [939 82 100 22];
% Create CleardataButton
app.CleardataButton = uibutton(app.Tab, ‘push’);
app.CleardataButton.ButtonPushedFcn = createCallbackFcn(app, @CleardataButtonPushed, true);
app.CleardataButton.Position = [938 280 100 23];
app.CleardataButton.Text = ‘Clear data’;
% Show the figure after all components are created
app.UIFigure.Visible = ‘on’;
end
end
% App creation and deletion
methods (Access = public)
% Construct app
function app = app2
% Create UIFigure and components
createComponents(app)
% Register the app with App Designer
registerApp(app, app.UIFigure)
if nargout == 0
clear app
end
end
% Code that executes before app deletion
function delete(app)
% Delete UIFigure when app is deleted
delete(app.UIFigure)
end
end
end Hope you all well, i have GUI app which is getting data from national instrument and give back live plot after trun switch on and when switch is off the recorded data wil stop and real time data will stop, however i am trying to intesert another button to clear the previous or delete them from store array however it won’t happened i tried clear func and clf to remove plot and delete the array nothing working i will place the code blow and screen shot of the app design if you could help me to solve this i would be supre greatfull to you what i want is that the previouse data from block 1 and 2 get deleted after clear data button is clicked
classdef app2 < matlab.apps.AppBase
% Properties that correspond to app components
properties (Access = public)
UIFigure matlab.ui.Figure
TabGroup matlab.ui.container.TabGroup
Tab matlab.ui.container.Tab
CleardataButton matlab.ui.control.Button
DistancemmEditField matlab.ui.control.NumericEditField
DistancemmEditFieldLabel matlab.ui.control.Label
VoltageLEditField matlab.ui.control.NumericEditField
VoltageLEditFieldLabel matlab.ui.control.Label
LoadNEditField matlab.ui.control.NumericEditField
LoadNEditFieldLabel matlab.ui.control.Label
VoltageEditField matlab.ui.control.NumericEditField
VoltageEditFieldLabel matlab.ui.control.Label
SAVEDATAButton matlab.ui.control.Button
Lamp matlab.ui.control.Lamp
LampLabel matlab.ui.control.Label
Switch matlab.ui.control.Switch
SwitchLabel matlab.ui.control.Label
UIAxes matlab.ui.control.UIAxes
end
properties (Access = private)
dq = daq("ni"); % Create a DataAcquisition object.
R = 5000;% Description
% % Arrays to store data for plotting
% timeData = [];
% loadData = [];
% distanceData = [];
end
properties (Access = public)
voltage
distance
load
f1
f2
timeData = [];
loadData = [];
distanceData = [];
end
methods (Access = public)
%
function getdat(app,src,~)
[d, ~] = read(src,src.ScansAvailableFcnCount,"OutputFormat","Matrix");
voltage = mean(d(:,1));
app.VoltageEditField.Value = voltage;
app.LoadNEditField.Value = voltage * 4.19; %* 10497;
load =app.LoadNEditField.Value ;
app.VoltageLEditField.Value = mean(d(:,2));
distance = (app.VoltageLEditField.Value – 0.7966) * 4.51;
app.DistancemmEditField.Value = distance;
% Append data to arrays
app.timeData = [app.timeData; datetime(‘now’)];
app.loadData = [app.loadData; load];
app.distanceData = [app.distanceData; distance];
% Plot all data
yyaxis(app.UIAxes, ‘left’);
app.f1= plot(app.UIAxes, app.timeData, app.loadData);
ylabel(app.UIAxes, ‘Load (N)’);
yyaxis(app.UIAxes, ‘right’);
app.f2= plot(app.UIAxes, app.timeData, app.distanceData, ‘r’);
ylabel(app.UIAxes, ‘Displacement (mm)’);
xlabel(app.UIAxes, ‘Time’);
app.UIAxes.XGrid = ‘on’;
app.UIAxes.YGrid = ‘on’;
%{
plot(app.UIAxes, app.timeData, app.loadData, ‘b’, app.timeData, app.distanceData, ‘r’);
xlabel(app.UIAxes, ‘Time’);
ylabel(app.UIAxes, ‘Load (N) / Distance (mm)’);
legend(app.UIAxes, ‘Load’, ‘Distance’);
%}
end
end
% Callbacks that handle component events
methods (Access = private)
% Value changed function: Switch
function SwitchValueChanged(app, event)
value = app.Switch.Value;
if strcmp(value,"On")
app.Lamp.Color = ‘g’;
app.dq = daq("ni");
app.dq.ScansAvailableFcn = @(src,event) getdat(app, src, event);
ch1 = addinput(app.dq, ‘Dev1’, ‘ai0′,’Voltage’);
ch2 = addinput(app.dq, ‘Dev1’, ‘ai1′,’Voltage’);
app.dq.Rate = app.R;
app.dq.UserData = [0 0];
start(app.dq,"Continuous");
else
% app.dq.ScansAvailableFcn = @(src,event) getdat(app, src, event);
stop(app.dq);
app.Lamp.Color = ‘r’;
% delete(app.f1);
%
% delete(app.f2);
removechannel(app.dq,1:length(app.dq))
% start(app.dq,"Continuous");
% removechannel(app.dq,2)
% daqreset
end
end
% Button pushed function: SAVEDATAButton
function SAVEDATAButtonPushed(app, event)
% Prompt the user to choose a filename and location for saving the data
[filename, filepath] = uiputfile(‘*.csv’, ‘Save Data As’);
if isequal(filename,0) || isequal(filepath,0)
% User canceled the operation
return;
end
% Combine the filename and path
fullpath = fullfile(filepath, filename);
% Open or create the CSV file
fid = fopen(fullpath, ‘w’);
% Write headers to the CSV file
fprintf(fid, ‘Time,Load (N),Displacement (mm)n’);
% Write data to the CSV file
for i = 1:numel(app.timeData)
fprintf(fid, ‘%s,%f,%fn’, …
datestr(app.timeData(i)), …
app.loadData(i), …
app.distanceData(i));
end
% Close the file
fclose(fid);
end
% Callback function
function SystemLogSizeChanged(app, event)
% position = app.SystemLog.Position;
% if strcmp(app.Lamp.Color,’g’)
%
end
% Button pushed function: CleardataButton
function CleardataButtonPushed(app, event)
% app.dq.ScansAvailableFcn = @(src,event) getdat(app, src, event);
stop(app.dq);
% Clear the session and channels.
% app.timeData = [app.timeData; datetime(‘now’)];
% app.loadData = [app.loadData; app.load];
% app.distanceData = [app.distanceData; app.distance];
delete(app.f1);
delete (‘app.timeData’)
delete (‘app.distanceData’)
delete (‘app.loadData’)
delete(app.f2);
% daqreset
% start(app.dq);
% app.dq
% stop(app.dq);
% cla(app.load,"reset");
% delete (app.load);
% cla(app.distance,"reset");
% delete(app.distance);
% cla(app.UIAxes);
% cla()
% delete(app.dq);
% delete(app.distance);
% delete(app.UIAxes)
% cla(app.UIAxes,"reset");
% app.dq.release(‘ni’);
end
end
% Component initialization
methods (Access = private)
% Create UIFigure and components
function createComponents(app)
% Create UIFigure and hide until all components are created
app.UIFigure = uifigure(‘Visible’, ‘off’);
app.UIFigure.Position = [100 100 1051 699];
app.UIFigure.Name = ‘MATLAB App’;
% Create TabGroup
app.TabGroup = uitabgroup(app.UIFigure);
app.TabGroup.Position = [1 0 1051 699];
% Create Tab
app.Tab = uitab(app.TabGroup);
app.Tab.Title = ‘Tab’;
% Create UIAxes
app.UIAxes = uiaxes(app.Tab);
xlabel(app.UIAxes, ‘Displacement (mm)’)
ylabel(app.UIAxes, ‘Force (N)’)
zlabel(app.UIAxes, ‘Z’)
app.UIAxes.YGrid = ‘on’;
app.UIAxes.Position = [15 26 828 505];
% Create SwitchLabel
app.SwitchLabel = uilabel(app.Tab);
app.SwitchLabel.HorizontalAlignment = ‘center’;
app.SwitchLabel.Position = [40 599 40 22];
app.SwitchLabel.Text = ‘Switch’;
% Create Switch
app.Switch = uiswitch(app.Tab, ‘slider’);
app.Switch.ValueChangedFcn = createCallbackFcn(app, @SwitchValueChanged, true);
app.Switch.Position = [37 636 45 20];
% Create LampLabel
app.LampLabel = uilabel(app.Tab);
app.LampLabel.HorizontalAlignment = ‘right’;
app.LampLabel.Position = [25 562 35 22];
app.LampLabel.Text = ‘Lamp’;
% Create Lamp
app.Lamp = uilamp(app.Tab);
app.Lamp.Position = [75 562 20 20];
app.Lamp.Color = [1 0 0];
% Create SAVEDATAButton
app.SAVEDATAButton = uibutton(app.Tab, ‘push’);
app.SAVEDATAButton.ButtonPushedFcn = createCallbackFcn(app, @SAVEDATAButtonPushed, true);
app.SAVEDATAButton.Position = [940 25 100 23];
app.SAVEDATAButton.Text = ‘SAVE DATA’;
% Create VoltageEditFieldLabel
app.VoltageEditFieldLabel = uilabel(app.Tab);
app.VoltageEditFieldLabel.HorizontalAlignment = ‘right’;
app.VoltageEditFieldLabel.Position = [878 226 46 22];
app.VoltageEditFieldLabel.Text = ‘Voltage’;
% Create VoltageEditField
app.VoltageEditField = uieditfield(app.Tab, ‘numeric’);
app.VoltageEditField.Position = [939 226 100 22];
% Create LoadNEditFieldLabel
app.LoadNEditFieldLabel = uilabel(app.Tab);
app.LoadNEditFieldLabel.HorizontalAlignment = ‘right’;
app.LoadNEditFieldLabel.Position = [872 133 52 22];
app.LoadNEditFieldLabel.Text = ‘Load (N)’;
% Create LoadNEditField
app.LoadNEditField = uieditfield(app.Tab, ‘numeric’);
app.LoadNEditField.Position = [939 133 100 22];
% Create VoltageLEditFieldLabel
app.VoltageLEditFieldLabel = uilabel(app.Tab);
app.VoltageLEditFieldLabel.HorizontalAlignment = ‘right’;
app.VoltageLEditFieldLabel.Position = [861 188 63 22];
app.VoltageLEditFieldLabel.Text = ‘Voltage (L)’;
% Create VoltageLEditField
app.VoltageLEditField = uieditfield(app.Tab, ‘numeric’);
app.VoltageLEditField.Position = [939 188 100 22];
% Create DistancemmEditFieldLabel
app.DistancemmEditFieldLabel = uilabel(app.Tab);
app.DistancemmEditFieldLabel.HorizontalAlignment = ‘right’;
app.DistancemmEditFieldLabel.Position = [841 82 83 22];
app.DistancemmEditFieldLabel.Text = ‘Distance (mm)’;
% Create DistancemmEditField
app.DistancemmEditField = uieditfield(app.Tab, ‘numeric’);
app.DistancemmEditField.Position = [939 82 100 22];
% Create CleardataButton
app.CleardataButton = uibutton(app.Tab, ‘push’);
app.CleardataButton.ButtonPushedFcn = createCallbackFcn(app, @CleardataButtonPushed, true);
app.CleardataButton.Position = [938 280 100 23];
app.CleardataButton.Text = ‘Clear data’;
% Show the figure after all components are created
app.UIFigure.Visible = ‘on’;
end
end
% App creation and deletion
methods (Access = public)
% Construct app
function app = app2
% Create UIFigure and components
createComponents(app)
% Register the app with App Designer
registerApp(app, app.UIFigure)
if nargout == 0
clear app
end
end
% Code that executes before app deletion
function delete(app)
% Delete UIFigure when app is deleted
delete(app.UIFigure)
end
end
end matrix array, replacement, real time, gui, clear data, matrix, data MATLAB Answers — New Questions
Why does my matlab code cannot detect the number of periods in a specific time range
I have developed a matlab code which imports pNRF Files that contain a measurement signal of light distance of a wheel surface in order to detect the number of cracks on that surface. There are in the file 3 signals, 2 rotary encoder signals and one light distance signal.
The Code does mostly what I want it to do:
It can import the Data accurately and successfully.
It can plot all the 3 signals
It can detect the cracks automatically using a threshold
One thing thats important and that the code is doing wrong, is that it detects the wrong number of the periods in the time range where a crack is being detected. (See the following picture, the back rectangles are the Cracks detected).
Now what I would like to do is to calculate the number of the Periods on the Signal Ch B1 (increment Encoder A) in the time where a crack is being detected. In this example the number of the periods is about 5,2 Periods of the first Crack and about nearly 1 Period of the second crack.
This is a substract of the 200line Code that i have to determine how many cracks I have:
% Zusammenfassung der Risse anzeigen
disp(‘Anzahl der detektierten Risse:’);
disp(numCracks);
disp(‘Breite der detektierten Risse in Inkrementen und Mikrometern:’);
for i = 1:numCracks
rissIndizes = risseGruppen.PixelIdxList{i};
Crackstart = min(rissIndizes);
Crackstart = max(rissIndizes);
Periods_Yellow_Signal = locs_gelb(locs_gelb >= Crackstart & locs_gelb <= Crackend);
CracksthicknessinPeriods = length(Periods_Yellow_Signal);
rissBreiteMicrometer = CracksthicknessinPeriods * INC_TO_MICROMETER;
fprintf(‘Crack %d: Thickness = %d Periods, %.2f Micrometer (Signal: Ch B1_A)n’, i, rissBreiteInkrement, rissBreiteMicrometer);
fprintf(‘Number of Periods: %dn’, rissBreiteInkrement);
end
What am I doing wrong here?
I would so thankful for any help! Thanks a lot in advance.I have developed a matlab code which imports pNRF Files that contain a measurement signal of light distance of a wheel surface in order to detect the number of cracks on that surface. There are in the file 3 signals, 2 rotary encoder signals and one light distance signal.
The Code does mostly what I want it to do:
It can import the Data accurately and successfully.
It can plot all the 3 signals
It can detect the cracks automatically using a threshold
One thing thats important and that the code is doing wrong, is that it detects the wrong number of the periods in the time range where a crack is being detected. (See the following picture, the back rectangles are the Cracks detected).
Now what I would like to do is to calculate the number of the Periods on the Signal Ch B1 (increment Encoder A) in the time where a crack is being detected. In this example the number of the periods is about 5,2 Periods of the first Crack and about nearly 1 Period of the second crack.
This is a substract of the 200line Code that i have to determine how many cracks I have:
% Zusammenfassung der Risse anzeigen
disp(‘Anzahl der detektierten Risse:’);
disp(numCracks);
disp(‘Breite der detektierten Risse in Inkrementen und Mikrometern:’);
for i = 1:numCracks
rissIndizes = risseGruppen.PixelIdxList{i};
Crackstart = min(rissIndizes);
Crackstart = max(rissIndizes);
Periods_Yellow_Signal = locs_gelb(locs_gelb >= Crackstart & locs_gelb <= Crackend);
CracksthicknessinPeriods = length(Periods_Yellow_Signal);
rissBreiteMicrometer = CracksthicknessinPeriods * INC_TO_MICROMETER;
fprintf(‘Crack %d: Thickness = %d Periods, %.2f Micrometer (Signal: Ch B1_A)n’, i, rissBreiteInkrement, rissBreiteMicrometer);
fprintf(‘Number of Periods: %dn’, rissBreiteInkrement);
end
What am I doing wrong here?
I would so thankful for any help! Thanks a lot in advance. I have developed a matlab code which imports pNRF Files that contain a measurement signal of light distance of a wheel surface in order to detect the number of cracks on that surface. There are in the file 3 signals, 2 rotary encoder signals and one light distance signal.
The Code does mostly what I want it to do:
It can import the Data accurately and successfully.
It can plot all the 3 signals
It can detect the cracks automatically using a threshold
One thing thats important and that the code is doing wrong, is that it detects the wrong number of the periods in the time range where a crack is being detected. (See the following picture, the back rectangles are the Cracks detected).
Now what I would like to do is to calculate the number of the Periods on the Signal Ch B1 (increment Encoder A) in the time where a crack is being detected. In this example the number of the periods is about 5,2 Periods of the first Crack and about nearly 1 Period of the second crack.
This is a substract of the 200line Code that i have to determine how many cracks I have:
% Zusammenfassung der Risse anzeigen
disp(‘Anzahl der detektierten Risse:’);
disp(numCracks);
disp(‘Breite der detektierten Risse in Inkrementen und Mikrometern:’);
for i = 1:numCracks
rissIndizes = risseGruppen.PixelIdxList{i};
Crackstart = min(rissIndizes);
Crackstart = max(rissIndizes);
Periods_Yellow_Signal = locs_gelb(locs_gelb >= Crackstart & locs_gelb <= Crackend);
CracksthicknessinPeriods = length(Periods_Yellow_Signal);
rissBreiteMicrometer = CracksthicknessinPeriods * INC_TO_MICROMETER;
fprintf(‘Crack %d: Thickness = %d Periods, %.2f Micrometer (Signal: Ch B1_A)n’, i, rissBreiteInkrement, rissBreiteMicrometer);
fprintf(‘Number of Periods: %dn’, rissBreiteInkrement);
end
What am I doing wrong here?
I would so thankful for any help! Thanks a lot in advance. periods, frequency, signal, signal processing, cracks, thickness MATLAB Answers — New Questions
Entra Cloud Sync Not Applying Assigned OU Filters
I am working to setup Entra Cloud Sync to sync a single OU from my on-premises AD to Entra AD. I have installed the latest Entra Cloud Sync agent on my single DC and setup the necessary configuration in the Entra Cloud Sync portal area. I have applied a scoping filter for the single OU that I need to sync for two AD security groups. This all saves properly. However, when I go to enable the configuration, I get an overview of what changes will occur and the scoping filters section at the bottom shows clearly “All Users” even though my configuration has defined scoping filters setup. I cannot proceed with all users as I have some areas and users that I cannot modify AD permissions. I have deleted and re-setup my configuration multiple times but the same continues.
Any input and suggestions are appreciated.
Scoping filters
Object scope filters
All users
I am working to setup Entra Cloud Sync to sync a single OU from my on-premises AD to Entra AD. I have installed the latest Entra Cloud Sync agent on my single DC and setup the necessary configuration in the Entra Cloud Sync portal area. I have applied a scoping filter for the single OU that I need to sync for two AD security groups. This all saves properly. However, when I go to enable the configuration, I get an overview of what changes will occur and the scoping filters section at the bottom shows clearly “All Users” even though my configuration has defined scoping filters setup. I cannot proceed with all users as I have some areas and users that I cannot modify AD permissions. I have deleted and re-setup my configuration multiple times but the same continues. Any input and suggestions are appreciated.Scoping filtersObject scope filtersAll users Read More
Info about account recovery form
Long story short, it’s been three whole weeks since I’ve been locked out of my email. Microsoft detected suspicious activity into my account cause I’ve switched broadband provider and this error started occuring the day I was done with the migration.
I’ve tried to compile the recovery form several times now but the response I got is that there weren’t enough informations to work with.
Now, I’ve managed to recover a Skype account tied with my blocked email, the only thing is this account was created before the live and outlook domains were even merged, so I’m wondering if it’s still okay if I provide information relevant to that account?
Also, am I supposed to write down my contact’s skype name or usernames?
Thanks in advance.
Long story short, it’s been three whole weeks since I’ve been locked out of my email. Microsoft detected suspicious activity into my account cause I’ve switched broadband provider and this error started occuring the day I was done with the migration.I’ve tried to compile the recovery form several times now but the response I got is that there weren’t enough informations to work with. Now, I’ve managed to recover a Skype account tied with my blocked email, the only thing is this account was created before the live and outlook domains were even merged, so I’m wondering if it’s still okay if I provide information relevant to that account? Also, am I supposed to write down my contact’s skype name or usernames? Thanks in advance. Read More
Worker crashed while executing code
Warning: 1 worker(s) crashed while executing code in the current parallel pool. MATLAB may attempt to run the code again on the remaining workers of the pool, unless an spmd block has run. View the crash dump files to determine what caused the workers to crash.
As I have the home licenses I’m not sure what to do with the error above. The script is training a Trebagger model with parallel turned on. It does use a lot of memory but still fits within the 32GB I have. The log is :-
——————————————————————————–
abort() detected at 2024-06-09 14:55:26 +0100
——————————————————————————–
Configuration:
Crash Decoding : Disabled – No sandbox or build area path
Crash Mode : continue (default)
Default Encoding : UTF-8
Deployed : false
Graphics Driver : Uninitialized hardware
Graphics card 1 : NVIDIA ( 0x10de ) NVIDIA GeForce RTX 3060 Ti Version 32.0.15.5599 (2024-6-1)
Graphics card 2 : Intel Corporation ( 0x8086 ) Intel(R) UHD Graphics 770 Version 31.0.101.4577 (2023-7-24)
Java Version : Java 1.8.0_202-b08 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
MATLAB Architecture : win64
MATLAB Entitlement ID : 5834768
MATLAB Root : C:Program FilesMATLABR2024a
MATLAB Version : 24.1.0.2603908 (R2024a) Update 3
OpenGL : hardware
Operating System : Microsoft Windows 11 Home
Process ID : 24484
Processor ID : x86 Family 6 Model 151 Stepping 2, GenuineIntel
Session Key : 21d9c0b4-6172-4c58-b200-f26395bd30e7
Window System : Version 10.0 (Build 22631)
Fault Count: 1
Abnormal termination:
abort()
Current Thread: ” id 15936
Register State (captured):
RAX = 00007ffc736e7208 RBX = 00007ffc736e7208
RCX = 0000000b268f8790 RDX = 00007ffc736918f0
RSP = 0000000b268f86d0 RBP = 0000000b268f9460
RSI = 0000000000000000 RDI = 00007ffc736e7208
R8 = 0000000000000003 R9 = 0000000b268f8648
R10 = 0000000000000014 R11 = 0000000000000000
R12 = 0000000b268f9368 R13 = 0000000000000000
R14 = 00007ffc736d7138 R15 = 0000000b268f8da0
RIP = 00007ffc735d1c8a EFL = 00000202
CS = 0033 FS = 0053 GS = 002b
Stack Trace (captured):
[ 0] 0x00007ffc735cb093 C:Program FilesMATLABR2024abinwin64libmwfl.dll+00045203 foundation::core::diag::thread_context::unspecified_bool+00000051
[ 1] 0x00007ffc735c94c8 C:Program FilesMATLABR2024abinwin64libmwfl.dll+00038088 foundation::core::diag::stacktrace_base::capture+00000024
[ 2] 0x00007ffc735cd90f C:Program FilesMATLABR2024abinwin64libmwfl.dll+00055567 foundation::core::diag::symbols::getSymbolAddress+00009855
[ 3] 0x00007ffc735d07d7 C:Program FilesMATLABR2024abinwin64libmwfl.dll+00067543 foundation::core::diag::is_terminate_message_enabled+00000503
[ 4] 0x00007ffbf21c1868 C:Program FilesMATLABR2024abinwin64mcr.dll+00792680 mnFullExitFcn+00034808
[ 5] 0x00007ffbf21c10cd C:Program FilesMATLABR2024abinwin64mcr.dll+00790733 mnFullExitFcn+00032861
[ 6] 0x00007ffbf21bd315 C:Program FilesMATLABR2024abinwin64mcr.dll+00774933 mnFullExitFcn+00017061
[ 7] 0x00007ffbf21bed5f C:Program FilesMATLABR2024abinwin64mcr.dll+00781663 mnFullExitFcn+00023791
[ 8] 0x00007ffcb8f7e6d5 C:WINDOWSSystem32ucrtbase.dll+00517845 raise+00000485
[ 9] 0x00007ffcb8f7f6e1 C:WINDOWSSystem32ucrtbase.dll+00521953 abort+00000049
[ 10] 0x00007ffcb8f7ee19 C:WINDOWSSystem32ucrtbase.dll+00519705 terminate+00000041
[ 11] 0x00007ffcb3ea1aab C:Program FilesMATLABR2024abinwin64VCRUNTIME140_1.dll+00006827 _NLG_Return2+00002395
[ 12] 0x00007ffcb3ea2317 C:Program FilesMATLABR2024abinwin64VCRUNTIME140_1.dll+00008983 _NLG_Return2+00004551
[ 13] 0x00007ffcb3ea237a C:Program FilesMATLABR2024abinwin64VCRUNTIME140_1.dll+00009082 _NLG_Return2+00004650
[ 14] 0x00007ffcb3ea4159 C:Program FilesMATLABR2024abinwin64VCRUNTIME140_1.dll+00016729 _CxxFrameHandler4+00000169
[ 15] 0x00007ffcbb9549ff C:WINDOWSSYSTEM32ntdll.dll+00674303 _chkstk+00000303
[ 16] 0x00007ffcbb8ce466 C:WINDOWSSYSTEM32ntdll.dll+00124006 RtlFindCharInUnicodeString+00002710
[ 17] 0x00007ffcbb904465 C:WINDOWSSYSTEM32ntdll.dll+00345189 RtlRaiseException+00000405
[ 18] 0x00007ffcb90f543c C:WINDOWSSystem32KERNELBASE.dll+00414780 RaiseException+00000108
[ 19] 0x00007ffcb3ea2793 C:Program FilesMATLABR2024abinwin64VCRUNTIME140_1.dll+00010131 _NLG_Return2+00005699
[ 20] 0x00007ffcbb954246 C:WINDOWSSYSTEM32ntdll.dll+00672326 RtlCaptureContext2+00001190
[ 21] 0x00007ffbeadd968a C:Program FilesMATLABR2024abinwin64libmwparallelplrlicensing.dll+00104074 mwboost::serialization::singleton_module::lock+00009098
[ 22] 0x00007ffbeadc4d6f C:Program FilesMATLABR2024abinwin64libmwparallelplrlicensing.dll+00019823
[ 23] 0x00007ffcb8f29333 C:WINDOWSSystem32ucrtbase.dll+00168755 recalloc+00000163
[ 24] 0x00007ffcb9f0257d C:WINDOWSSystem32KERNEL32.DLL+00075133 BaseThreadInitThunk+00000029
[ 25] 0x00007ffcbb90aa48 C:WINDOWSSYSTEM32ntdll.dll+00371272 RtlUserThreadStart+00000040
It doesn’t always happen but I’d like to know if anyone has an idea why this might be happening and if it affects the training or not.Warning: 1 worker(s) crashed while executing code in the current parallel pool. MATLAB may attempt to run the code again on the remaining workers of the pool, unless an spmd block has run. View the crash dump files to determine what caused the workers to crash.
As I have the home licenses I’m not sure what to do with the error above. The script is training a Trebagger model with parallel turned on. It does use a lot of memory but still fits within the 32GB I have. The log is :-
——————————————————————————–
abort() detected at 2024-06-09 14:55:26 +0100
——————————————————————————–
Configuration:
Crash Decoding : Disabled – No sandbox or build area path
Crash Mode : continue (default)
Default Encoding : UTF-8
Deployed : false
Graphics Driver : Uninitialized hardware
Graphics card 1 : NVIDIA ( 0x10de ) NVIDIA GeForce RTX 3060 Ti Version 32.0.15.5599 (2024-6-1)
Graphics card 2 : Intel Corporation ( 0x8086 ) Intel(R) UHD Graphics 770 Version 31.0.101.4577 (2023-7-24)
Java Version : Java 1.8.0_202-b08 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
MATLAB Architecture : win64
MATLAB Entitlement ID : 5834768
MATLAB Root : C:Program FilesMATLABR2024a
MATLAB Version : 24.1.0.2603908 (R2024a) Update 3
OpenGL : hardware
Operating System : Microsoft Windows 11 Home
Process ID : 24484
Processor ID : x86 Family 6 Model 151 Stepping 2, GenuineIntel
Session Key : 21d9c0b4-6172-4c58-b200-f26395bd30e7
Window System : Version 10.0 (Build 22631)
Fault Count: 1
Abnormal termination:
abort()
Current Thread: ” id 15936
Register State (captured):
RAX = 00007ffc736e7208 RBX = 00007ffc736e7208
RCX = 0000000b268f8790 RDX = 00007ffc736918f0
RSP = 0000000b268f86d0 RBP = 0000000b268f9460
RSI = 0000000000000000 RDI = 00007ffc736e7208
R8 = 0000000000000003 R9 = 0000000b268f8648
R10 = 0000000000000014 R11 = 0000000000000000
R12 = 0000000b268f9368 R13 = 0000000000000000
R14 = 00007ffc736d7138 R15 = 0000000b268f8da0
RIP = 00007ffc735d1c8a EFL = 00000202
CS = 0033 FS = 0053 GS = 002b
Stack Trace (captured):
[ 0] 0x00007ffc735cb093 C:Program FilesMATLABR2024abinwin64libmwfl.dll+00045203 foundation::core::diag::thread_context::unspecified_bool+00000051
[ 1] 0x00007ffc735c94c8 C:Program FilesMATLABR2024abinwin64libmwfl.dll+00038088 foundation::core::diag::stacktrace_base::capture+00000024
[ 2] 0x00007ffc735cd90f C:Program FilesMATLABR2024abinwin64libmwfl.dll+00055567 foundation::core::diag::symbols::getSymbolAddress+00009855
[ 3] 0x00007ffc735d07d7 C:Program FilesMATLABR2024abinwin64libmwfl.dll+00067543 foundation::core::diag::is_terminate_message_enabled+00000503
[ 4] 0x00007ffbf21c1868 C:Program FilesMATLABR2024abinwin64mcr.dll+00792680 mnFullExitFcn+00034808
[ 5] 0x00007ffbf21c10cd C:Program FilesMATLABR2024abinwin64mcr.dll+00790733 mnFullExitFcn+00032861
[ 6] 0x00007ffbf21bd315 C:Program FilesMATLABR2024abinwin64mcr.dll+00774933 mnFullExitFcn+00017061
[ 7] 0x00007ffbf21bed5f C:Program FilesMATLABR2024abinwin64mcr.dll+00781663 mnFullExitFcn+00023791
[ 8] 0x00007ffcb8f7e6d5 C:WINDOWSSystem32ucrtbase.dll+00517845 raise+00000485
[ 9] 0x00007ffcb8f7f6e1 C:WINDOWSSystem32ucrtbase.dll+00521953 abort+00000049
[ 10] 0x00007ffcb8f7ee19 C:WINDOWSSystem32ucrtbase.dll+00519705 terminate+00000041
[ 11] 0x00007ffcb3ea1aab C:Program FilesMATLABR2024abinwin64VCRUNTIME140_1.dll+00006827 _NLG_Return2+00002395
[ 12] 0x00007ffcb3ea2317 C:Program FilesMATLABR2024abinwin64VCRUNTIME140_1.dll+00008983 _NLG_Return2+00004551
[ 13] 0x00007ffcb3ea237a C:Program FilesMATLABR2024abinwin64VCRUNTIME140_1.dll+00009082 _NLG_Return2+00004650
[ 14] 0x00007ffcb3ea4159 C:Program FilesMATLABR2024abinwin64VCRUNTIME140_1.dll+00016729 _CxxFrameHandler4+00000169
[ 15] 0x00007ffcbb9549ff C:WINDOWSSYSTEM32ntdll.dll+00674303 _chkstk+00000303
[ 16] 0x00007ffcbb8ce466 C:WINDOWSSYSTEM32ntdll.dll+00124006 RtlFindCharInUnicodeString+00002710
[ 17] 0x00007ffcbb904465 C:WINDOWSSYSTEM32ntdll.dll+00345189 RtlRaiseException+00000405
[ 18] 0x00007ffcb90f543c C:WINDOWSSystem32KERNELBASE.dll+00414780 RaiseException+00000108
[ 19] 0x00007ffcb3ea2793 C:Program FilesMATLABR2024abinwin64VCRUNTIME140_1.dll+00010131 _NLG_Return2+00005699
[ 20] 0x00007ffcbb954246 C:WINDOWSSYSTEM32ntdll.dll+00672326 RtlCaptureContext2+00001190
[ 21] 0x00007ffbeadd968a C:Program FilesMATLABR2024abinwin64libmwparallelplrlicensing.dll+00104074 mwboost::serialization::singleton_module::lock+00009098
[ 22] 0x00007ffbeadc4d6f C:Program FilesMATLABR2024abinwin64libmwparallelplrlicensing.dll+00019823
[ 23] 0x00007ffcb8f29333 C:WINDOWSSystem32ucrtbase.dll+00168755 recalloc+00000163
[ 24] 0x00007ffcb9f0257d C:WINDOWSSystem32KERNEL32.DLL+00075133 BaseThreadInitThunk+00000029
[ 25] 0x00007ffcbb90aa48 C:WINDOWSSYSTEM32ntdll.dll+00371272 RtlUserThreadStart+00000040
It doesn’t always happen but I’d like to know if anyone has an idea why this might be happening and if it affects the training or not. Warning: 1 worker(s) crashed while executing code in the current parallel pool. MATLAB may attempt to run the code again on the remaining workers of the pool, unless an spmd block has run. View the crash dump files to determine what caused the workers to crash.
As I have the home licenses I’m not sure what to do with the error above. The script is training a Trebagger model with parallel turned on. It does use a lot of memory but still fits within the 32GB I have. The log is :-
——————————————————————————–
abort() detected at 2024-06-09 14:55:26 +0100
——————————————————————————–
Configuration:
Crash Decoding : Disabled – No sandbox or build area path
Crash Mode : continue (default)
Default Encoding : UTF-8
Deployed : false
Graphics Driver : Uninitialized hardware
Graphics card 1 : NVIDIA ( 0x10de ) NVIDIA GeForce RTX 3060 Ti Version 32.0.15.5599 (2024-6-1)
Graphics card 2 : Intel Corporation ( 0x8086 ) Intel(R) UHD Graphics 770 Version 31.0.101.4577 (2023-7-24)
Java Version : Java 1.8.0_202-b08 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
MATLAB Architecture : win64
MATLAB Entitlement ID : 5834768
MATLAB Root : C:Program FilesMATLABR2024a
MATLAB Version : 24.1.0.2603908 (R2024a) Update 3
OpenGL : hardware
Operating System : Microsoft Windows 11 Home
Process ID : 24484
Processor ID : x86 Family 6 Model 151 Stepping 2, GenuineIntel
Session Key : 21d9c0b4-6172-4c58-b200-f26395bd30e7
Window System : Version 10.0 (Build 22631)
Fault Count: 1
Abnormal termination:
abort()
Current Thread: ” id 15936
Register State (captured):
RAX = 00007ffc736e7208 RBX = 00007ffc736e7208
RCX = 0000000b268f8790 RDX = 00007ffc736918f0
RSP = 0000000b268f86d0 RBP = 0000000b268f9460
RSI = 0000000000000000 RDI = 00007ffc736e7208
R8 = 0000000000000003 R9 = 0000000b268f8648
R10 = 0000000000000014 R11 = 0000000000000000
R12 = 0000000b268f9368 R13 = 0000000000000000
R14 = 00007ffc736d7138 R15 = 0000000b268f8da0
RIP = 00007ffc735d1c8a EFL = 00000202
CS = 0033 FS = 0053 GS = 002b
Stack Trace (captured):
[ 0] 0x00007ffc735cb093 C:Program FilesMATLABR2024abinwin64libmwfl.dll+00045203 foundation::core::diag::thread_context::unspecified_bool+00000051
[ 1] 0x00007ffc735c94c8 C:Program FilesMATLABR2024abinwin64libmwfl.dll+00038088 foundation::core::diag::stacktrace_base::capture+00000024
[ 2] 0x00007ffc735cd90f C:Program FilesMATLABR2024abinwin64libmwfl.dll+00055567 foundation::core::diag::symbols::getSymbolAddress+00009855
[ 3] 0x00007ffc735d07d7 C:Program FilesMATLABR2024abinwin64libmwfl.dll+00067543 foundation::core::diag::is_terminate_message_enabled+00000503
[ 4] 0x00007ffbf21c1868 C:Program FilesMATLABR2024abinwin64mcr.dll+00792680 mnFullExitFcn+00034808
[ 5] 0x00007ffbf21c10cd C:Program FilesMATLABR2024abinwin64mcr.dll+00790733 mnFullExitFcn+00032861
[ 6] 0x00007ffbf21bd315 C:Program FilesMATLABR2024abinwin64mcr.dll+00774933 mnFullExitFcn+00017061
[ 7] 0x00007ffbf21bed5f C:Program FilesMATLABR2024abinwin64mcr.dll+00781663 mnFullExitFcn+00023791
[ 8] 0x00007ffcb8f7e6d5 C:WINDOWSSystem32ucrtbase.dll+00517845 raise+00000485
[ 9] 0x00007ffcb8f7f6e1 C:WINDOWSSystem32ucrtbase.dll+00521953 abort+00000049
[ 10] 0x00007ffcb8f7ee19 C:WINDOWSSystem32ucrtbase.dll+00519705 terminate+00000041
[ 11] 0x00007ffcb3ea1aab C:Program FilesMATLABR2024abinwin64VCRUNTIME140_1.dll+00006827 _NLG_Return2+00002395
[ 12] 0x00007ffcb3ea2317 C:Program FilesMATLABR2024abinwin64VCRUNTIME140_1.dll+00008983 _NLG_Return2+00004551
[ 13] 0x00007ffcb3ea237a C:Program FilesMATLABR2024abinwin64VCRUNTIME140_1.dll+00009082 _NLG_Return2+00004650
[ 14] 0x00007ffcb3ea4159 C:Program FilesMATLABR2024abinwin64VCRUNTIME140_1.dll+00016729 _CxxFrameHandler4+00000169
[ 15] 0x00007ffcbb9549ff C:WINDOWSSYSTEM32ntdll.dll+00674303 _chkstk+00000303
[ 16] 0x00007ffcbb8ce466 C:WINDOWSSYSTEM32ntdll.dll+00124006 RtlFindCharInUnicodeString+00002710
[ 17] 0x00007ffcbb904465 C:WINDOWSSYSTEM32ntdll.dll+00345189 RtlRaiseException+00000405
[ 18] 0x00007ffcb90f543c C:WINDOWSSystem32KERNELBASE.dll+00414780 RaiseException+00000108
[ 19] 0x00007ffcb3ea2793 C:Program FilesMATLABR2024abinwin64VCRUNTIME140_1.dll+00010131 _NLG_Return2+00005699
[ 20] 0x00007ffcbb954246 C:WINDOWSSYSTEM32ntdll.dll+00672326 RtlCaptureContext2+00001190
[ 21] 0x00007ffbeadd968a C:Program FilesMATLABR2024abinwin64libmwparallelplrlicensing.dll+00104074 mwboost::serialization::singleton_module::lock+00009098
[ 22] 0x00007ffbeadc4d6f C:Program FilesMATLABR2024abinwin64libmwparallelplrlicensing.dll+00019823
[ 23] 0x00007ffcb8f29333 C:WINDOWSSystem32ucrtbase.dll+00168755 recalloc+00000163
[ 24] 0x00007ffcb9f0257d C:WINDOWSSystem32KERNEL32.DLL+00075133 BaseThreadInitThunk+00000029
[ 25] 0x00007ffcbb90aa48 C:WINDOWSSYSTEM32ntdll.dll+00371272 RtlUserThreadStart+00000040
It doesn’t always happen but I’d like to know if anyone has an idea why this might be happening and if it affects the training or not. worker crash MATLAB Answers — New Questions
Approximation of Solution to Poisson-Equation via RBFs but with a change of Basis
Hello! I am currently trying to implement some idea into Matlab but I can’t do it somehow. Probably because my brain is not big enough or because I don’t have that much experience in Matlab… This might be a long text but maybe I will find someone that is interested in this topic aswell and could help me…
First the Theory behind all that:
Lets say we have an open and bounded Domain and we want to solve the Equation
where is known and we have Dirichlet-Boundarycondition
for some known . One approach to do so is to choose
where holds some collocationpoints ( in the Interior and on the Boundary of ) and is an RBF-Kernel, i.e. for some , e.g. is the Gaussian-RBF. The approximand then should meet the conditions
1) ,
2)
wich leads us to solve the linear system of equations
to get the Coefficients where
1) ,
2) ,
3) ,
4) .
Now this one I was already able to implement for the example
with the analytical solution
where I used the inverse Multiquadric
.
This is the corresponding script:
% IMQ-RBF and Laplacians
rbf = @(e,r) 1./sqrt(1+(e*r).^2); ep = 1;
Lrbf = @(e,r) e^2*((e*r).^2-2)./(1+(e*r).^2).^(5/2);
L2rbf = @(e,r) 3*e^4*(3*(e*r).^4-24*(e*r).^2+8)./(1+(e*r).^2).^(9/2);
% Datafunction and Laplacian
u = @(x) sin(pi*x(:,1)).*cos(pi*x(:,2)/2);
Lu = @(x) -1.25*pi^2*sin(pi*x(:,1)).*cos(pi*x(:,2)/2);
% Generate Evaluation Points
Neval = 100; % Sqrt of Number of Evaluationpoints
a=0;b=4;c=a;d=b; % Bounds for rectangle
[~,~,xeval]=GetRectGrid(a,b,c,d,Neval);
% Reshape for Plot
X = reshape(xeval(:,1),Neval,Neval);
Y = reshape(xeval(:,2),Neval,Neval);
% Evaluate Datafunction on rectangle
ueval = u(xeval);
% Generate Collocatoinpoints
N = 25; % Sqrt of number of collocationpoints
[xint,xbdy,x]=GetRectGrid(a,b,c,d,N);
NI = size(xint,1);
NB = size(xbdy,1);
% Build Evaluationmatrix
DM_int = DistMatr(xeval,xint);
LEM = Lrbf(ep,DM_int);
DM_bdy = DistMatr(xeval,xbdy);
BEM = rbf(ep,DM_bdy);
EM = [LEM BEM];
% Build Collocationmatrix for the system of equations
DM_II = DistMatr(xint,xint);
LLCM = L2rbf(ep,DM_II);
DM_IB = DistMatr(xint,xbdy);
LBCM = Lrbf(ep,DM_IB);
BLCM = LBCM’;
DM_BB = DistMatr(xbdy,xbdy);
BBCM = rbf(ep,DM_BB);
CM = [LLCM LBCM; BLCM BBCM];
% Evaluate Datafunction on Collocatoinpoints
ux = zeros(N^2,1);
ux(1:NI) = Lu(xint);
% Boundary Conditions
indx = find(xbdy(:,2)==0 | xbdy(:,2)==4);
ux(NI+indx) = sin(pi*xbdy(indx,1));
% Evaluate Approximand
warning(‘off’,’MATLAB:nearlySingularMatrix’)
approx = EM * (CMux);
warning(‘on’,’MATLAB:nearlySingularMatrix’)
% Plot Approximand and analytical solution
figure(1)
approx2 = reshape(approx,Neval,Neval);
surf(X,Y,approx2,’FaceAlpha’,0.5,’EdgeColor’,’interp’);
colormap cool; camlight; lighting gouraud; material dull;
title([‘Approximation of solution to Poisson-Equation for N=’,num2str(N^2)])
figure(2);
ueval2 = reshape(ueval,Neval,Neval);
surf(X,Y,ueval2,’FaceAlpha’,0.5,’EdgeColor’,’interp’)
colormap cool; camlight; lighting gouraud; material dull;
title(‘Solution of Poisson-Equation’)
function D = DistMatr(A,B)
% Helping function for Evaluating RBFs.
% See if matrices are compatible
A_width = width(A);
B_width = width(B);
if A_width~=B_width
error(‘The matrices are not compatible.’);
end
%Berechnung der Abstandsmatrix
A2 = sum(A.^2,2);
B2 = sum(B.^2,2);
D = sqrt(max(bsxfun(@plus,A2,B2′) – 2*A*B’,0));
end
function [xint,xbdy,x] = GetRectGrid(a,b,c,d,N)
% Generated Grid on choosen rectangle and sorts for interior and boundary
% points.
% Generate Grid
[X1,X2] = meshgrid(linspace(a,b,N),linspace(c,d,N));
x = [X1(:),X2(:)];
% Sort for interior and boundary points
k = 1;l=1; % Counter (There are probably better solutions to this but idc)
xbdy = zeros(4*N-4,2); % Boundary Points
xint = zeros(N^2-(4*N-4),2); % Interior Points
for j = 1:N^2
if x(j,1) == a || x(j,1) == b || x(j,2) == c || x(j,2) == d
xbdy(k,:) = x(j,:);
k = k+1;
else
xint(l,:) = x(j,:);
l = l+1;
end
end
end
Okay so now I want to do basically the same but first I want to do a change of basis. Currently we are working with the Standardbasis that spans some finite dimensional functionspace. The reason to change the basis is that it appears that you gain better evaluation stability if you want to achieve higher accuracy by e.g. choosing very small values for . There’s a lot of theory behind that but lets just lay that by the side for now.
The Idea is to make a simple change of basis to gain some new basis that spans the same space. Therefore we chose
.
Note that we now have instead of for simplicity. We can rewrite this approach to
where is the Coefficientmatrix that holds the Coefficients . Now theres a Theorem that I will not proof here but I will refer to this work by Maryam Pazouki and Robert Schaback in Theorem 3.1 and Theorem 6.1 but the Theorem basically says that every possible basis we can get by this is uniquley characterizable by a factorization of the Matrix
into some Matrix and the inverse of the Coefficientmatrix , i.e.. . For example if we take the Cholesky-Decomposition of we end up with as the coefficientmatrix wich leads us to the so called Newton-Basis , described here in chapter 3.7. Since the RBF-Kernel is because we take the double Laplacian of it, the Newtonbasisfunktions are too since they are just linear combinations of the Kernel and the laplacian is a linear differential operator. Therefore
and .
In summary I want do the approximation of the solution of the Poisson-Equation but not use the standard rbf basis but do a change of basis into the newton basis and then chose the approach
for the approximand to solve the linear system of equations that I describe above but now it has Submatrices and . Obviously after that I’d like to Plot the resulting approximand to see how it looks. I already tried it, but it didnt work like that… I just have alot of trouble to implement that… Here is my Approach:
% Inverse Multiquadric RBF and its Laplacians
rbf = @(e,r) 1./sqrt(1+(e*r).^2); ep = 2;
Lrbf = @(e,r) e^2*((e*r).^2-2)./(1+(e*r).^2).^(5/2);
L2rbf = @(e,r) 3*e^4*(3*(e*r).^4-24*(e*r).^2+8)./(1+(e*r).^2).^(9/2);
% Datafunction and its Laplacian
u = @(x) sin(pi*x(:,1)).*cos(pi*x(:,2)/2);
Lu = @(x) -1.25*pi^2*sin(pi*x(:,1)).*cos(pi*x(:,2)/2);
% Evaluationpoints
Neval = 100;
a=0;b=4;c=a;d=b;
[~,~,xeval]=GetRectGrid(a,b,c,d,Neval);
X = reshape(xeval(:,1),Neval,Neval);
Y = reshape(xeval(:,2),Neval,Neval);
% Collocationpoints
N = 20;
[xint,xbdy,x]=GetRectGrid(a,b,c,d,N);
x=[xint;xbdy]; % Sorting x… hmm…
NI = size(xint,1);
NB = size(xbdy,1);
% Evaluate Datafunction on Collocationpoints …
ux = zeros(N^2,1);
ux(1:NI) = Lu(xint);
% Boundary Conditions
indx = find(xbdy(:,2)==0 | xbdy(:,2)==4);
ux(NI+indx) = sin(pi*xbdy(indx,1));
% .. and on the Evaluationpoints
ueval = u(xeval);
% Evaluate needed Kernel-Matrices
% % % This part works fine. B is looking good.
A1 = rbf(ep,DistMatr(x,x));
A2 = rbf(ep,DistMatr(xeval,x));
% Cholesky decomposition
L = chol(A1,’lower’);
% Each column is one newtonbasisfunction evaluated on the evaluationpoints
newton = A2/L’;
% This is the Coefficent Matrix
B = inv(L)’;
% Collocationmatrix
% % % This is probably not the way to do it… I dont know how to use B…
DM_II = DistMatr(xint,xint);
LLCM = L2rbf(ep,DM_II)*B(1:NI,1:NI);
DM_IB = DistMatr(xint,xbdy);
LBCM = Lrbf(ep,DM_IB).*B(1:NI,NI+1:end);
DM_BI = DistMatr(xbdy,xint);
BLCM = Lrbf(ep,DM_BI).*B(NI+1:end,1:NI);
DM_BB = DistMatr(xbdy,xbdy)*B(NI+1:end,NI+1:end);
BBCM = rbf(ep,DM_BB);
CM = [LLCM LBCM; BLCM BBCM];
% Evaluate Approximand
warning(‘off’,’MATLAB:nearlySingularMatrix’)
approx = newton * (CMux);
warning(‘on’,’MATLAB:nearlySingularMatrix’)
figure(1) % Here you can see how its just not working how I want it to.
approx2 = reshape(approx,Neval,Neval);
surf(X,Y,approx2,’FaceAlpha’,0.5,’EdgeColor’,’interp’);
colormap cool; camlight; lighting gouraud; material dull;
title([‘Approximation of the solution to the Poisson-Equation for N=’,num2str(N^2)])
figure(2);
ueval2 = reshape(ueval,Neval,Neval);
surf(X,Y,ueval2,’FaceAlpha’,0.5,’EdgeColor’,’interp’)
colormap cool; camlight; lighting gouraud; material dull;
title(‘Solution to the Poisson-Equation’)
I hope someone of you could help me manage this problem. Thank you very much! Kind regards, Max.Hello! I am currently trying to implement some idea into Matlab but I can’t do it somehow. Probably because my brain is not big enough or because I don’t have that much experience in Matlab… This might be a long text but maybe I will find someone that is interested in this topic aswell and could help me…
First the Theory behind all that:
Lets say we have an open and bounded Domain and we want to solve the Equation
where is known and we have Dirichlet-Boundarycondition
for some known . One approach to do so is to choose
where holds some collocationpoints ( in the Interior and on the Boundary of ) and is an RBF-Kernel, i.e. for some , e.g. is the Gaussian-RBF. The approximand then should meet the conditions
1) ,
2)
wich leads us to solve the linear system of equations
to get the Coefficients where
1) ,
2) ,
3) ,
4) .
Now this one I was already able to implement for the example
with the analytical solution
where I used the inverse Multiquadric
.
This is the corresponding script:
% IMQ-RBF and Laplacians
rbf = @(e,r) 1./sqrt(1+(e*r).^2); ep = 1;
Lrbf = @(e,r) e^2*((e*r).^2-2)./(1+(e*r).^2).^(5/2);
L2rbf = @(e,r) 3*e^4*(3*(e*r).^4-24*(e*r).^2+8)./(1+(e*r).^2).^(9/2);
% Datafunction and Laplacian
u = @(x) sin(pi*x(:,1)).*cos(pi*x(:,2)/2);
Lu = @(x) -1.25*pi^2*sin(pi*x(:,1)).*cos(pi*x(:,2)/2);
% Generate Evaluation Points
Neval = 100; % Sqrt of Number of Evaluationpoints
a=0;b=4;c=a;d=b; % Bounds for rectangle
[~,~,xeval]=GetRectGrid(a,b,c,d,Neval);
% Reshape for Plot
X = reshape(xeval(:,1),Neval,Neval);
Y = reshape(xeval(:,2),Neval,Neval);
% Evaluate Datafunction on rectangle
ueval = u(xeval);
% Generate Collocatoinpoints
N = 25; % Sqrt of number of collocationpoints
[xint,xbdy,x]=GetRectGrid(a,b,c,d,N);
NI = size(xint,1);
NB = size(xbdy,1);
% Build Evaluationmatrix
DM_int = DistMatr(xeval,xint);
LEM = Lrbf(ep,DM_int);
DM_bdy = DistMatr(xeval,xbdy);
BEM = rbf(ep,DM_bdy);
EM = [LEM BEM];
% Build Collocationmatrix for the system of equations
DM_II = DistMatr(xint,xint);
LLCM = L2rbf(ep,DM_II);
DM_IB = DistMatr(xint,xbdy);
LBCM = Lrbf(ep,DM_IB);
BLCM = LBCM’;
DM_BB = DistMatr(xbdy,xbdy);
BBCM = rbf(ep,DM_BB);
CM = [LLCM LBCM; BLCM BBCM];
% Evaluate Datafunction on Collocatoinpoints
ux = zeros(N^2,1);
ux(1:NI) = Lu(xint);
% Boundary Conditions
indx = find(xbdy(:,2)==0 | xbdy(:,2)==4);
ux(NI+indx) = sin(pi*xbdy(indx,1));
% Evaluate Approximand
warning(‘off’,’MATLAB:nearlySingularMatrix’)
approx = EM * (CMux);
warning(‘on’,’MATLAB:nearlySingularMatrix’)
% Plot Approximand and analytical solution
figure(1)
approx2 = reshape(approx,Neval,Neval);
surf(X,Y,approx2,’FaceAlpha’,0.5,’EdgeColor’,’interp’);
colormap cool; camlight; lighting gouraud; material dull;
title([‘Approximation of solution to Poisson-Equation for N=’,num2str(N^2)])
figure(2);
ueval2 = reshape(ueval,Neval,Neval);
surf(X,Y,ueval2,’FaceAlpha’,0.5,’EdgeColor’,’interp’)
colormap cool; camlight; lighting gouraud; material dull;
title(‘Solution of Poisson-Equation’)
function D = DistMatr(A,B)
% Helping function for Evaluating RBFs.
% See if matrices are compatible
A_width = width(A);
B_width = width(B);
if A_width~=B_width
error(‘The matrices are not compatible.’);
end
%Berechnung der Abstandsmatrix
A2 = sum(A.^2,2);
B2 = sum(B.^2,2);
D = sqrt(max(bsxfun(@plus,A2,B2′) – 2*A*B’,0));
end
function [xint,xbdy,x] = GetRectGrid(a,b,c,d,N)
% Generated Grid on choosen rectangle and sorts for interior and boundary
% points.
% Generate Grid
[X1,X2] = meshgrid(linspace(a,b,N),linspace(c,d,N));
x = [X1(:),X2(:)];
% Sort for interior and boundary points
k = 1;l=1; % Counter (There are probably better solutions to this but idc)
xbdy = zeros(4*N-4,2); % Boundary Points
xint = zeros(N^2-(4*N-4),2); % Interior Points
for j = 1:N^2
if x(j,1) == a || x(j,1) == b || x(j,2) == c || x(j,2) == d
xbdy(k,:) = x(j,:);
k = k+1;
else
xint(l,:) = x(j,:);
l = l+1;
end
end
end
Okay so now I want to do basically the same but first I want to do a change of basis. Currently we are working with the Standardbasis that spans some finite dimensional functionspace. The reason to change the basis is that it appears that you gain better evaluation stability if you want to achieve higher accuracy by e.g. choosing very small values for . There’s a lot of theory behind that but lets just lay that by the side for now.
The Idea is to make a simple change of basis to gain some new basis that spans the same space. Therefore we chose
.
Note that we now have instead of for simplicity. We can rewrite this approach to
where is the Coefficientmatrix that holds the Coefficients . Now theres a Theorem that I will not proof here but I will refer to this work by Maryam Pazouki and Robert Schaback in Theorem 3.1 and Theorem 6.1 but the Theorem basically says that every possible basis we can get by this is uniquley characterizable by a factorization of the Matrix
into some Matrix and the inverse of the Coefficientmatrix , i.e.. . For example if we take the Cholesky-Decomposition of we end up with as the coefficientmatrix wich leads us to the so called Newton-Basis , described here in chapter 3.7. Since the RBF-Kernel is because we take the double Laplacian of it, the Newtonbasisfunktions are too since they are just linear combinations of the Kernel and the laplacian is a linear differential operator. Therefore
and .
In summary I want do the approximation of the solution of the Poisson-Equation but not use the standard rbf basis but do a change of basis into the newton basis and then chose the approach
for the approximand to solve the linear system of equations that I describe above but now it has Submatrices and . Obviously after that I’d like to Plot the resulting approximand to see how it looks. I already tried it, but it didnt work like that… I just have alot of trouble to implement that… Here is my Approach:
% Inverse Multiquadric RBF and its Laplacians
rbf = @(e,r) 1./sqrt(1+(e*r).^2); ep = 2;
Lrbf = @(e,r) e^2*((e*r).^2-2)./(1+(e*r).^2).^(5/2);
L2rbf = @(e,r) 3*e^4*(3*(e*r).^4-24*(e*r).^2+8)./(1+(e*r).^2).^(9/2);
% Datafunction and its Laplacian
u = @(x) sin(pi*x(:,1)).*cos(pi*x(:,2)/2);
Lu = @(x) -1.25*pi^2*sin(pi*x(:,1)).*cos(pi*x(:,2)/2);
% Evaluationpoints
Neval = 100;
a=0;b=4;c=a;d=b;
[~,~,xeval]=GetRectGrid(a,b,c,d,Neval);
X = reshape(xeval(:,1),Neval,Neval);
Y = reshape(xeval(:,2),Neval,Neval);
% Collocationpoints
N = 20;
[xint,xbdy,x]=GetRectGrid(a,b,c,d,N);
x=[xint;xbdy]; % Sorting x… hmm…
NI = size(xint,1);
NB = size(xbdy,1);
% Evaluate Datafunction on Collocationpoints …
ux = zeros(N^2,1);
ux(1:NI) = Lu(xint);
% Boundary Conditions
indx = find(xbdy(:,2)==0 | xbdy(:,2)==4);
ux(NI+indx) = sin(pi*xbdy(indx,1));
% .. and on the Evaluationpoints
ueval = u(xeval);
% Evaluate needed Kernel-Matrices
% % % This part works fine. B is looking good.
A1 = rbf(ep,DistMatr(x,x));
A2 = rbf(ep,DistMatr(xeval,x));
% Cholesky decomposition
L = chol(A1,’lower’);
% Each column is one newtonbasisfunction evaluated on the evaluationpoints
newton = A2/L’;
% This is the Coefficent Matrix
B = inv(L)’;
% Collocationmatrix
% % % This is probably not the way to do it… I dont know how to use B…
DM_II = DistMatr(xint,xint);
LLCM = L2rbf(ep,DM_II)*B(1:NI,1:NI);
DM_IB = DistMatr(xint,xbdy);
LBCM = Lrbf(ep,DM_IB).*B(1:NI,NI+1:end);
DM_BI = DistMatr(xbdy,xint);
BLCM = Lrbf(ep,DM_BI).*B(NI+1:end,1:NI);
DM_BB = DistMatr(xbdy,xbdy)*B(NI+1:end,NI+1:end);
BBCM = rbf(ep,DM_BB);
CM = [LLCM LBCM; BLCM BBCM];
% Evaluate Approximand
warning(‘off’,’MATLAB:nearlySingularMatrix’)
approx = newton * (CMux);
warning(‘on’,’MATLAB:nearlySingularMatrix’)
figure(1) % Here you can see how its just not working how I want it to.
approx2 = reshape(approx,Neval,Neval);
surf(X,Y,approx2,’FaceAlpha’,0.5,’EdgeColor’,’interp’);
colormap cool; camlight; lighting gouraud; material dull;
title([‘Approximation of the solution to the Poisson-Equation for N=’,num2str(N^2)])
figure(2);
ueval2 = reshape(ueval,Neval,Neval);
surf(X,Y,ueval2,’FaceAlpha’,0.5,’EdgeColor’,’interp’)
colormap cool; camlight; lighting gouraud; material dull;
title(‘Solution to the Poisson-Equation’)
I hope someone of you could help me manage this problem. Thank you very much! Kind regards, Max. Hello! I am currently trying to implement some idea into Matlab but I can’t do it somehow. Probably because my brain is not big enough or because I don’t have that much experience in Matlab… This might be a long text but maybe I will find someone that is interested in this topic aswell and could help me…
First the Theory behind all that:
Lets say we have an open and bounded Domain and we want to solve the Equation
where is known and we have Dirichlet-Boundarycondition
for some known . One approach to do so is to choose
where holds some collocationpoints ( in the Interior and on the Boundary of ) and is an RBF-Kernel, i.e. for some , e.g. is the Gaussian-RBF. The approximand then should meet the conditions
1) ,
2)
wich leads us to solve the linear system of equations
to get the Coefficients where
1) ,
2) ,
3) ,
4) .
Now this one I was already able to implement for the example
with the analytical solution
where I used the inverse Multiquadric
.
This is the corresponding script:
% IMQ-RBF and Laplacians
rbf = @(e,r) 1./sqrt(1+(e*r).^2); ep = 1;
Lrbf = @(e,r) e^2*((e*r).^2-2)./(1+(e*r).^2).^(5/2);
L2rbf = @(e,r) 3*e^4*(3*(e*r).^4-24*(e*r).^2+8)./(1+(e*r).^2).^(9/2);
% Datafunction and Laplacian
u = @(x) sin(pi*x(:,1)).*cos(pi*x(:,2)/2);
Lu = @(x) -1.25*pi^2*sin(pi*x(:,1)).*cos(pi*x(:,2)/2);
% Generate Evaluation Points
Neval = 100; % Sqrt of Number of Evaluationpoints
a=0;b=4;c=a;d=b; % Bounds for rectangle
[~,~,xeval]=GetRectGrid(a,b,c,d,Neval);
% Reshape for Plot
X = reshape(xeval(:,1),Neval,Neval);
Y = reshape(xeval(:,2),Neval,Neval);
% Evaluate Datafunction on rectangle
ueval = u(xeval);
% Generate Collocatoinpoints
N = 25; % Sqrt of number of collocationpoints
[xint,xbdy,x]=GetRectGrid(a,b,c,d,N);
NI = size(xint,1);
NB = size(xbdy,1);
% Build Evaluationmatrix
DM_int = DistMatr(xeval,xint);
LEM = Lrbf(ep,DM_int);
DM_bdy = DistMatr(xeval,xbdy);
BEM = rbf(ep,DM_bdy);
EM = [LEM BEM];
% Build Collocationmatrix for the system of equations
DM_II = DistMatr(xint,xint);
LLCM = L2rbf(ep,DM_II);
DM_IB = DistMatr(xint,xbdy);
LBCM = Lrbf(ep,DM_IB);
BLCM = LBCM’;
DM_BB = DistMatr(xbdy,xbdy);
BBCM = rbf(ep,DM_BB);
CM = [LLCM LBCM; BLCM BBCM];
% Evaluate Datafunction on Collocatoinpoints
ux = zeros(N^2,1);
ux(1:NI) = Lu(xint);
% Boundary Conditions
indx = find(xbdy(:,2)==0 | xbdy(:,2)==4);
ux(NI+indx) = sin(pi*xbdy(indx,1));
% Evaluate Approximand
warning(‘off’,’MATLAB:nearlySingularMatrix’)
approx = EM * (CMux);
warning(‘on’,’MATLAB:nearlySingularMatrix’)
% Plot Approximand and analytical solution
figure(1)
approx2 = reshape(approx,Neval,Neval);
surf(X,Y,approx2,’FaceAlpha’,0.5,’EdgeColor’,’interp’);
colormap cool; camlight; lighting gouraud; material dull;
title([‘Approximation of solution to Poisson-Equation for N=’,num2str(N^2)])
figure(2);
ueval2 = reshape(ueval,Neval,Neval);
surf(X,Y,ueval2,’FaceAlpha’,0.5,’EdgeColor’,’interp’)
colormap cool; camlight; lighting gouraud; material dull;
title(‘Solution of Poisson-Equation’)
function D = DistMatr(A,B)
% Helping function for Evaluating RBFs.
% See if matrices are compatible
A_width = width(A);
B_width = width(B);
if A_width~=B_width
error(‘The matrices are not compatible.’);
end
%Berechnung der Abstandsmatrix
A2 = sum(A.^2,2);
B2 = sum(B.^2,2);
D = sqrt(max(bsxfun(@plus,A2,B2′) – 2*A*B’,0));
end
function [xint,xbdy,x] = GetRectGrid(a,b,c,d,N)
% Generated Grid on choosen rectangle and sorts for interior and boundary
% points.
% Generate Grid
[X1,X2] = meshgrid(linspace(a,b,N),linspace(c,d,N));
x = [X1(:),X2(:)];
% Sort for interior and boundary points
k = 1;l=1; % Counter (There are probably better solutions to this but idc)
xbdy = zeros(4*N-4,2); % Boundary Points
xint = zeros(N^2-(4*N-4),2); % Interior Points
for j = 1:N^2
if x(j,1) == a || x(j,1) == b || x(j,2) == c || x(j,2) == d
xbdy(k,:) = x(j,:);
k = k+1;
else
xint(l,:) = x(j,:);
l = l+1;
end
end
end
Okay so now I want to do basically the same but first I want to do a change of basis. Currently we are working with the Standardbasis that spans some finite dimensional functionspace. The reason to change the basis is that it appears that you gain better evaluation stability if you want to achieve higher accuracy by e.g. choosing very small values for . There’s a lot of theory behind that but lets just lay that by the side for now.
The Idea is to make a simple change of basis to gain some new basis that spans the same space. Therefore we chose
.
Note that we now have instead of for simplicity. We can rewrite this approach to
where is the Coefficientmatrix that holds the Coefficients . Now theres a Theorem that I will not proof here but I will refer to this work by Maryam Pazouki and Robert Schaback in Theorem 3.1 and Theorem 6.1 but the Theorem basically says that every possible basis we can get by this is uniquley characterizable by a factorization of the Matrix
into some Matrix and the inverse of the Coefficientmatrix , i.e.. . For example if we take the Cholesky-Decomposition of we end up with as the coefficientmatrix wich leads us to the so called Newton-Basis , described here in chapter 3.7. Since the RBF-Kernel is because we take the double Laplacian of it, the Newtonbasisfunktions are too since they are just linear combinations of the Kernel and the laplacian is a linear differential operator. Therefore
and .
In summary I want do the approximation of the solution of the Poisson-Equation but not use the standard rbf basis but do a change of basis into the newton basis and then chose the approach
for the approximand to solve the linear system of equations that I describe above but now it has Submatrices and . Obviously after that I’d like to Plot the resulting approximand to see how it looks. I already tried it, but it didnt work like that… I just have alot of trouble to implement that… Here is my Approach:
% Inverse Multiquadric RBF and its Laplacians
rbf = @(e,r) 1./sqrt(1+(e*r).^2); ep = 2;
Lrbf = @(e,r) e^2*((e*r).^2-2)./(1+(e*r).^2).^(5/2);
L2rbf = @(e,r) 3*e^4*(3*(e*r).^4-24*(e*r).^2+8)./(1+(e*r).^2).^(9/2);
% Datafunction and its Laplacian
u = @(x) sin(pi*x(:,1)).*cos(pi*x(:,2)/2);
Lu = @(x) -1.25*pi^2*sin(pi*x(:,1)).*cos(pi*x(:,2)/2);
% Evaluationpoints
Neval = 100;
a=0;b=4;c=a;d=b;
[~,~,xeval]=GetRectGrid(a,b,c,d,Neval);
X = reshape(xeval(:,1),Neval,Neval);
Y = reshape(xeval(:,2),Neval,Neval);
% Collocationpoints
N = 20;
[xint,xbdy,x]=GetRectGrid(a,b,c,d,N);
x=[xint;xbdy]; % Sorting x… hmm…
NI = size(xint,1);
NB = size(xbdy,1);
% Evaluate Datafunction on Collocationpoints …
ux = zeros(N^2,1);
ux(1:NI) = Lu(xint);
% Boundary Conditions
indx = find(xbdy(:,2)==0 | xbdy(:,2)==4);
ux(NI+indx) = sin(pi*xbdy(indx,1));
% .. and on the Evaluationpoints
ueval = u(xeval);
% Evaluate needed Kernel-Matrices
% % % This part works fine. B is looking good.
A1 = rbf(ep,DistMatr(x,x));
A2 = rbf(ep,DistMatr(xeval,x));
% Cholesky decomposition
L = chol(A1,’lower’);
% Each column is one newtonbasisfunction evaluated on the evaluationpoints
newton = A2/L’;
% This is the Coefficent Matrix
B = inv(L)’;
% Collocationmatrix
% % % This is probably not the way to do it… I dont know how to use B…
DM_II = DistMatr(xint,xint);
LLCM = L2rbf(ep,DM_II)*B(1:NI,1:NI);
DM_IB = DistMatr(xint,xbdy);
LBCM = Lrbf(ep,DM_IB).*B(1:NI,NI+1:end);
DM_BI = DistMatr(xbdy,xint);
BLCM = Lrbf(ep,DM_BI).*B(NI+1:end,1:NI);
DM_BB = DistMatr(xbdy,xbdy)*B(NI+1:end,NI+1:end);
BBCM = rbf(ep,DM_BB);
CM = [LLCM LBCM; BLCM BBCM];
% Evaluate Approximand
warning(‘off’,’MATLAB:nearlySingularMatrix’)
approx = newton * (CMux);
warning(‘on’,’MATLAB:nearlySingularMatrix’)
figure(1) % Here you can see how its just not working how I want it to.
approx2 = reshape(approx,Neval,Neval);
surf(X,Y,approx2,’FaceAlpha’,0.5,’EdgeColor’,’interp’);
colormap cool; camlight; lighting gouraud; material dull;
title([‘Approximation of the solution to the Poisson-Equation for N=’,num2str(N^2)])
figure(2);
ueval2 = reshape(ueval,Neval,Neval);
surf(X,Y,ueval2,’FaceAlpha’,0.5,’EdgeColor’,’interp’)
colormap cool; camlight; lighting gouraud; material dull;
title(‘Solution to the Poisson-Equation’)
I hope someone of you could help me manage this problem. Thank you very much! Kind regards, Max. rbf, radial basis function, interpolation, differential equations, kernel, approximation MATLAB Answers — New Questions
Accessing Fit Coefficients from Curve Fitting
Hello, I am attempting to generate a graph of the full width half max (FWHM) of multiple sets of data but want to first fit each dataset to a Gaussian. Currently, I am calculating the FWHM by indexing the first and last instances of the half-max value for each dataset, then graphing all of these values. This works alright; however, I would like to improve upon this by fitting each dataset to a Gaussian distribution and then use the calculated Gaussian coefficients from the fitting in order to find the FWHM, as this would be more accurate. I have been able to fit each dataset to a Gaussian using the fit() function. However, I have run into an issue where I seem to be unable to access the generated Gaussian coefficients, which are what I need in order to be able to recalculate the FWHM. Does anyone know how I might be able to access these coefficients or generate them in such a way that I would be able to access them? Below I have copied the portion of my code where I am fitting the data along with a screenshot of the particular math I am referring to using the Gaussian coefficients to calculate the FWHM. Thank you so much!
y_fit = data.’; % turns data into a variable for fit, transposes to column
l_y = length(y_fit); % generates a variable with the length of y_fit
x_fit = linspace(0,l_y,l_y).’; % creates a column variable simply for the x-axis
data_fit = fit(x_fit,y_fit,’gauss1′); % this creates a fitted data setHello, I am attempting to generate a graph of the full width half max (FWHM) of multiple sets of data but want to first fit each dataset to a Gaussian. Currently, I am calculating the FWHM by indexing the first and last instances of the half-max value for each dataset, then graphing all of these values. This works alright; however, I would like to improve upon this by fitting each dataset to a Gaussian distribution and then use the calculated Gaussian coefficients from the fitting in order to find the FWHM, as this would be more accurate. I have been able to fit each dataset to a Gaussian using the fit() function. However, I have run into an issue where I seem to be unable to access the generated Gaussian coefficients, which are what I need in order to be able to recalculate the FWHM. Does anyone know how I might be able to access these coefficients or generate them in such a way that I would be able to access them? Below I have copied the portion of my code where I am fitting the data along with a screenshot of the particular math I am referring to using the Gaussian coefficients to calculate the FWHM. Thank you so much!
y_fit = data.’; % turns data into a variable for fit, transposes to column
l_y = length(y_fit); % generates a variable with the length of y_fit
x_fit = linspace(0,l_y,l_y).’; % creates a column variable simply for the x-axis
data_fit = fit(x_fit,y_fit,’gauss1′); % this creates a fitted data set Hello, I am attempting to generate a graph of the full width half max (FWHM) of multiple sets of data but want to first fit each dataset to a Gaussian. Currently, I am calculating the FWHM by indexing the first and last instances of the half-max value for each dataset, then graphing all of these values. This works alright; however, I would like to improve upon this by fitting each dataset to a Gaussian distribution and then use the calculated Gaussian coefficients from the fitting in order to find the FWHM, as this would be more accurate. I have been able to fit each dataset to a Gaussian using the fit() function. However, I have run into an issue where I seem to be unable to access the generated Gaussian coefficients, which are what I need in order to be able to recalculate the FWHM. Does anyone know how I might be able to access these coefficients or generate them in such a way that I would be able to access them? Below I have copied the portion of my code where I am fitting the data along with a screenshot of the particular math I am referring to using the Gaussian coefficients to calculate the FWHM. Thank you so much!
y_fit = data.’; % turns data into a variable for fit, transposes to column
l_y = length(y_fit); % generates a variable with the length of y_fit
x_fit = linspace(0,l_y,l_y).’; % creates a column variable simply for the x-axis
data_fit = fit(x_fit,y_fit,’gauss1′); % this creates a fitted data set curve fitting, gaussian distribution MATLAB Answers — New Questions
New Here!! Glad to be here!
Hello Everyone.
I just joined the techcommunity. I am glad to be a part of this community.
Hello Everyone. I just joined the techcommunity. I am glad to be a part of this community. Read More
i need code to generate key using PSO then adding the key to image
i need code to generate key using PSO then adding the key to image.i need code to generate key using PSO then adding the key to image. i need code to generate key using PSO then adding the key to image. image, image processing MATLAB Answers — New Questions
csv to fft matlab
Hello everybody,
I’m trying to convert two csv files to fft and I looked on different forums and tried a few solutions but nothing conclusive.
Someone could help me please.
ThanksHello everybody,
I’m trying to convert two csv files to fft and I looked on different forums and tried a few solutions but nothing conclusive.
Someone could help me please.
Thanks Hello everybody,
I’m trying to convert two csv files to fft and I looked on different forums and tried a few solutions but nothing conclusive.
Someone could help me please.
Thanks fft, csv MATLAB Answers — New Questions
eval function in for-loop and change of numbers bigger through NaN
I have 108 variables with same name but with consecutive numbering. Each of this variables I want to check if there is a value bigger 1000. When yes, then it will be exchanged through NaN.
I try to solve with eval and for-loop, but it doesn’t work.
I know the function which changes a value bigger 1000 through NaN.
Function: Temperatur_1(Temperatur_1>1000)=NaN;
Dynamics variabels are: Temperatur_1, Temperatur_2, etc.
eval-function: eval(strcat(‘Temperatur_’,num2str(e)))
for i=1:108
tbd
end
What is the function for checking each variable for > 1000 and saving it in the same variable?
Thank you in advance for your support and solution.I have 108 variables with same name but with consecutive numbering. Each of this variables I want to check if there is a value bigger 1000. When yes, then it will be exchanged through NaN.
I try to solve with eval and for-loop, but it doesn’t work.
I know the function which changes a value bigger 1000 through NaN.
Function: Temperatur_1(Temperatur_1>1000)=NaN;
Dynamics variabels are: Temperatur_1, Temperatur_2, etc.
eval-function: eval(strcat(‘Temperatur_’,num2str(e)))
for i=1:108
tbd
end
What is the function for checking each variable for > 1000 and saving it in the same variable?
Thank you in advance for your support and solution. I have 108 variables with same name but with consecutive numbering. Each of this variables I want to check if there is a value bigger 1000. When yes, then it will be exchanged through NaN.
I try to solve with eval and for-loop, but it doesn’t work.
I know the function which changes a value bigger 1000 through NaN.
Function: Temperatur_1(Temperatur_1>1000)=NaN;
Dynamics variabels are: Temperatur_1, Temperatur_2, etc.
eval-function: eval(strcat(‘Temperatur_’,num2str(e)))
for i=1:108
tbd
end
What is the function for checking each variable for > 1000 and saving it in the same variable?
Thank you in advance for your support and solution. eval, dynamic variable MATLAB Answers — New Questions
How to use FFT in matlab using imported data in time domain excel file
I have used a multimeter to measure my phototransistor
and I got one excel file with time versus Magnitude.
But I got some noise, so I want to use Matlab to do FFT
from time domain to frequency domain(frequency versus magnitude) called Photorespone.
I attach my file as below.
I wanna make this kind of figure, freq versus amplitude.
<</matlabcentral/answers/uploaded_files/71667/17160838_1646141328735588_1887025192_n.png>>I have used a multimeter to measure my phototransistor
and I got one excel file with time versus Magnitude.
But I got some noise, so I want to use Matlab to do FFT
from time domain to frequency domain(frequency versus magnitude) called Photorespone.
I attach my file as below.
I wanna make this kind of figure, freq versus amplitude.
<</matlabcentral/answers/uploaded_files/71667/17160838_1646141328735588_1887025192_n.png>> I have used a multimeter to measure my phototransistor
and I got one excel file with time versus Magnitude.
But I got some noise, so I want to use Matlab to do FFT
from time domain to frequency domain(frequency versus magnitude) called Photorespone.
I attach my file as below.
I wanna make this kind of figure, freq versus amplitude.
<</matlabcentral/answers/uploaded_files/71667/17160838_1646141328735588_1887025192_n.png>> fft MATLAB Answers — New Questions
switch counts for each item
Dear Experts,
I have a Data (as attached ),
In column “D”, we have item name as “rnti” and each rnti can have switch in ueBwpId (from 0>1>2),
in sheet2, I want to make a summary for each rnti how many switches happened example as below
for rnti = [28559] in column “E”, should have count of all the switches from ueBwpId from 2->1 ,
Thanks in Advance,
Br,
Anupam
Dear Experts, I have a Data (as attached ),In column “D”, we have item name as “rnti” and each rnti can have switch in ueBwpId (from 0>1>2),in sheet2, I want to make a summary for each rnti how many switches happened example as belowfor rnti = [28559] in column “E”, should have count of all the switches from ueBwpId from 2->1 ,Thanks in Advance,Br,Anupam Read More
chanvannak2211.powerappsportals.com
chanvannak2211.powerappsportals.com
chanvannak2211.powerappsportals.com
chanvannak2211.powerappsportals.com chanvannak2211.powerappsportals.com Read More
Help with weekly data project
Hi! I work with attendance data every week and don’t know much about Excel or how I can make things quicker and easier. I work with attendance data, which comes from our ticketing service in three columns – amount of tickets registered in each order, visitor zip code for those tickets, and the day of the week the tickets were for (see example below). Basically, I need the zip codes to each appear in a separate column the amount of times that a ticket is made with that zip code (so if there are 9 total tickets for the zip code 19107, the new column would have nine cells reading 19107). These new columns would represent the day of the week the ticket occurred (see second image below) From this point, I have shortcuts that make the data easy to work with for the purposes of my reporting, so no recommendations are needed for how to take the data forward from there. I just don’t want to have to individually type zip codes for the amount of times they occur. Please let me know what I can do or if further explanation is needed.
Hi! I work with attendance data every week and don’t know much about Excel or how I can make things quicker and easier. I work with attendance data, which comes from our ticketing service in three columns – amount of tickets registered in each order, visitor zip code for those tickets, and the day of the week the tickets were for (see example below). Basically, I need the zip codes to each appear in a separate column the amount of times that a ticket is made with that zip code (so if there are 9 total tickets for the zip code 19107, the new column would have nine cells reading 19107). These new columns would represent the day of the week the ticket occurred (see second image below) From this point, I have shortcuts that make the data easy to work with for the purposes of my reporting, so no recommendations are needed for how to take the data forward from there. I just don’t want to have to individually type zip codes for the amount of times they occur. Please let me know what I can do or if further explanation is needed. Read More