Category: News
eye tracked keyboard
for a few days I have been having trouble with the eye tracking keyboard: I start writing a word and when I go to click on the suggested word, the letters I had written plus the complete word appear on the screen.
For example, I write eyed (eyedropper) and when I press the suggested word on the keyboard, eyedeyedropper is written.
The strange thing is on the desktop WhatsApp client, the writing is correct.
What could it be?
Thanks in advance.
for a few days I have been having trouble with the eye tracking keyboard: I start writing a word and when I go to click on the suggested word, the letters I had written plus the complete word appear on the screen.For example, I write eyed (eyedropper) and when I press the suggested word on the keyboard, eyedeyedropper is written.The strange thing is on the desktop WhatsApp client, the writing is correct.What could it be?Thanks in advance. Read More
Error while attempting mesh plot
I was experimenting in the Matlab live script editor and I tried to make a mesh plot of a hilbert spectrum, but instead of the plot I obtained an error:
Warning: Error occurred while executing the listener callback for event POST_REGION defined for class matlab.internal.language.RegionEvaluator:
Error using getByteStreamFromArray
Error during serialization
Error in matlab.internal.editor.figure.SerializedFigureState/serialize
Error in matlab.internal.editor.FigureProxy/createWebFigureSnapshot
Error in matlab.internal.editor.FigureManager
Error in matlab.internal.editor.FigureManager
Error in matlab.internal.editor.FigureManager.saveSnapshot
Error in matlab.internal.editor.FigureManager.snapshotAllFigures
Here is the problematic code:
mesh(seconds(t),f,hs, ‘EdgeColor’, ‘none’, ‘FaceColor’, ‘interp’)
xlabel(‘Time (s)’)
ylabel(‘Frequency (Hz)’)
zlabel(‘Instantaneous Energy’)
Any idea why I am getting this error?I was experimenting in the Matlab live script editor and I tried to make a mesh plot of a hilbert spectrum, but instead of the plot I obtained an error:
Warning: Error occurred while executing the listener callback for event POST_REGION defined for class matlab.internal.language.RegionEvaluator:
Error using getByteStreamFromArray
Error during serialization
Error in matlab.internal.editor.figure.SerializedFigureState/serialize
Error in matlab.internal.editor.FigureProxy/createWebFigureSnapshot
Error in matlab.internal.editor.FigureManager
Error in matlab.internal.editor.FigureManager
Error in matlab.internal.editor.FigureManager.saveSnapshot
Error in matlab.internal.editor.FigureManager.snapshotAllFigures
Here is the problematic code:
mesh(seconds(t),f,hs, ‘EdgeColor’, ‘none’, ‘FaceColor’, ‘interp’)
xlabel(‘Time (s)’)
ylabel(‘Frequency (Hz)’)
zlabel(‘Instantaneous Energy’)
Any idea why I am getting this error? I was experimenting in the Matlab live script editor and I tried to make a mesh plot of a hilbert spectrum, but instead of the plot I obtained an error:
Warning: Error occurred while executing the listener callback for event POST_REGION defined for class matlab.internal.language.RegionEvaluator:
Error using getByteStreamFromArray
Error during serialization
Error in matlab.internal.editor.figure.SerializedFigureState/serialize
Error in matlab.internal.editor.FigureProxy/createWebFigureSnapshot
Error in matlab.internal.editor.FigureManager
Error in matlab.internal.editor.FigureManager
Error in matlab.internal.editor.FigureManager.saveSnapshot
Error in matlab.internal.editor.FigureManager.snapshotAllFigures
Here is the problematic code:
mesh(seconds(t),f,hs, ‘EdgeColor’, ‘none’, ‘FaceColor’, ‘interp’)
xlabel(‘Time (s)’)
ylabel(‘Frequency (Hz)’)
zlabel(‘Instantaneous Energy’)
Any idea why I am getting this error? mesh, error MATLAB Answers — New Questions
Plotting two surface plots in the same figure using two different colormaps
Hello,
I have been trying to plot two surface plots on top of each other in the same figure – one that is semitransparent, and one that is opaque – using two colormaps to display them. Specifically, I would like surface plot 1 to use the ‘turbo’ colormap, and surface plot 2 to use the ‘gray’ colormap and be semitransparent. So far, I have read through a few people with similar problems but their solutions don’t help me (most are requesting only 1 specific color per each map and not an entire colormap). How can I do this? Thanks. I cannot provide code due to proprietary information, so any example code given, I will gladly fit to my own.Hello,
I have been trying to plot two surface plots on top of each other in the same figure – one that is semitransparent, and one that is opaque – using two colormaps to display them. Specifically, I would like surface plot 1 to use the ‘turbo’ colormap, and surface plot 2 to use the ‘gray’ colormap and be semitransparent. So far, I have read through a few people with similar problems but their solutions don’t help me (most are requesting only 1 specific color per each map and not an entire colormap). How can I do this? Thanks. I cannot provide code due to proprietary information, so any example code given, I will gladly fit to my own. Hello,
I have been trying to plot two surface plots on top of each other in the same figure – one that is semitransparent, and one that is opaque – using two colormaps to display them. Specifically, I would like surface plot 1 to use the ‘turbo’ colormap, and surface plot 2 to use the ‘gray’ colormap and be semitransparent. So far, I have read through a few people with similar problems but their solutions don’t help me (most are requesting only 1 specific color per each map and not an entire colormap). How can I do this? Thanks. I cannot provide code due to proprietary information, so any example code given, I will gladly fit to my own. colormap, surf, two surface plots, two colormaps MATLAB Answers — New Questions
I cannot remove Organization from Person Account on MS Teams
Hello, MS Teams members,
I want to remove an old organization on MS Teams from my personal account, but I cannot.
Hello, MS Teams members,I want to remove an old organization on MS Teams from my personal account, but I cannot. Read More
Dynamic array and spilled array – FILTER function behavior
I am attempting to create a dynamic dependent data validation list (using instructions found on the My Online Training YouTube video). A link to the file is found here.
On the Standards Categories TAB, there is a Table (StdCategories) with two columns for Category and Subcategory. The primary data validation list is for the Category values, and the dependent data validation is for the Subcategory values.
Starting in Cell E2, the Categories are populated horizontally using the UNIQUE and TRANSPOSE functions. Starting in Cell E2, the FILTER and SORT functions are used to populate the Subcategory values for each Category. There is some sort of error occurring in every other Column (starting in column F) where the work “None” is used as the error return value. For some reason, the formula is not matching the value in Row 2 with the associated values in the StdCategories table. I’ve verified this using the Evaluate Formula feature. I’ve tried searching for any help on this issue, but I either can’t find it, or I’m not searching with the right terminology.
Is anyone familiar with this odd behavior, or have any suggestions on diagnosing the error?
I am attempting to create a dynamic dependent data validation list (using instructions found on the My Online Training YouTube video). A link to the file is found here. On the Standards Categories TAB, there is a Table (StdCategories) with two columns for Category and Subcategory. The primary data validation list is for the Category values, and the dependent data validation is for the Subcategory values. Starting in Cell E2, the Categories are populated horizontally using the UNIQUE and TRANSPOSE functions. Starting in Cell E2, the FILTER and SORT functions are used to populate the Subcategory values for each Category. There is some sort of error occurring in every other Column (starting in column F) where the work “None” is used as the error return value. For some reason, the formula is not matching the value in Row 2 with the associated values in the StdCategories table. I’ve verified this using the Evaluate Formula feature. I’ve tried searching for any help on this issue, but I either can’t find it, or I’m not searching with the right terminology. Is anyone familiar with this odd behavior, or have any suggestions on diagnosing the error? Read More
need solution during trainning
Hello all, I am new in this community .I need help to solve the below problem. please help me..
statement : You can add a custom function at the end of your script. For data preprocessing, the function should take the data returned from the datastore as input. It should return the transformed data as output.
function dataout = functionName(datain)
% do something with datain
dataout = …
end
Given script :
letterds = datastore("*_M_*.txt");
data = read(letterds);
data = scale(data);
plot(data.X,data.Y)
axis equal
plot(data.Time,data.Y)
ylabel("Vertical position")
xlabel("Time")
Task ; –
Create a function called scale at the end of the script that performs the following operations:
data.Time = (data.Time – data.Time(1))/1000;
data.X = 1.5*data.X;
Because these commands modify the variable data directly, your function should use data as both the input and output variable.
Note that the third line of the script calls the scale function. Your script won’t run until this function has been created.
Also note that local functions must be at the end of a script. This means you will be editing the script sections out of order in this interaction. The section headings show which section of the script to edit in each task.Hello all, I am new in this community .I need help to solve the below problem. please help me..
statement : You can add a custom function at the end of your script. For data preprocessing, the function should take the data returned from the datastore as input. It should return the transformed data as output.
function dataout = functionName(datain)
% do something with datain
dataout = …
end
Given script :
letterds = datastore("*_M_*.txt");
data = read(letterds);
data = scale(data);
plot(data.X,data.Y)
axis equal
plot(data.Time,data.Y)
ylabel("Vertical position")
xlabel("Time")
Task ; –
Create a function called scale at the end of the script that performs the following operations:
data.Time = (data.Time – data.Time(1))/1000;
data.X = 1.5*data.X;
Because these commands modify the variable data directly, your function should use data as both the input and output variable.
Note that the third line of the script calls the scale function. Your script won’t run until this function has been created.
Also note that local functions must be at the end of a script. This means you will be editing the script sections out of order in this interaction. The section headings show which section of the script to edit in each task. Hello all, I am new in this community .I need help to solve the below problem. please help me..
statement : You can add a custom function at the end of your script. For data preprocessing, the function should take the data returned from the datastore as input. It should return the transformed data as output.
function dataout = functionName(datain)
% do something with datain
dataout = …
end
Given script :
letterds = datastore("*_M_*.txt");
data = read(letterds);
data = scale(data);
plot(data.X,data.Y)
axis equal
plot(data.Time,data.Y)
ylabel("Vertical position")
xlabel("Time")
Task ; –
Create a function called scale at the end of the script that performs the following operations:
data.Time = (data.Time – data.Time(1))/1000;
data.X = 1.5*data.X;
Because these commands modify the variable data directly, your function should use data as both the input and output variable.
Note that the third line of the script calls the scale function. Your script won’t run until this function has been created.
Also note that local functions must be at the end of a script. This means you will be editing the script sections out of order in this interaction. The section headings show which section of the script to edit in each task. data transformation MATLAB Answers — New Questions
Reshape nested cell arrays into the a different nested cell array organization
Hello, I have a nested cell array that has been built up such that the first level cell array A is {691×1}; within each cell in A, there is a second level cell array B of {48×1}; lastly within each cell in B there is a third level nested cell array C of {2×1}.
I want to reshape the nested cell array structure such that it is now organized in the order of cell array B {48×1} first; second level cell array C {2×1} and lastly a third level cell array of A {691×1}.
Is there a way to take the original cell array and use a specific function (such as reshape) to get my desired new nested cell array from my current nested cell array?
have: A {691×1} –> B{48×1} –> C{2×1}
want: B{48×1} –> C{2×1} –> A {691×1}
Thanks!Hello, I have a nested cell array that has been built up such that the first level cell array A is {691×1}; within each cell in A, there is a second level cell array B of {48×1}; lastly within each cell in B there is a third level nested cell array C of {2×1}.
I want to reshape the nested cell array structure such that it is now organized in the order of cell array B {48×1} first; second level cell array C {2×1} and lastly a third level cell array of A {691×1}.
Is there a way to take the original cell array and use a specific function (such as reshape) to get my desired new nested cell array from my current nested cell array?
have: A {691×1} –> B{48×1} –> C{2×1}
want: B{48×1} –> C{2×1} –> A {691×1}
Thanks! Hello, I have a nested cell array that has been built up such that the first level cell array A is {691×1}; within each cell in A, there is a second level cell array B of {48×1}; lastly within each cell in B there is a third level nested cell array C of {2×1}.
I want to reshape the nested cell array structure such that it is now organized in the order of cell array B {48×1} first; second level cell array C {2×1} and lastly a third level cell array of A {691×1}.
Is there a way to take the original cell array and use a specific function (such as reshape) to get my desired new nested cell array from my current nested cell array?
have: A {691×1} –> B{48×1} –> C{2×1}
want: B{48×1} –> C{2×1} –> A {691×1}
Thanks! nested cell array, reshape cell array MATLAB Answers — New Questions
Unable to change expired password
I am using Server Next Preview Build 26257. It is a domain controller. I only have the one AD account which I created to do the evaluation. The account password expired today. When I attempt to change it at login, I enter the new password twice as required and hit Enter, but it sends me back and says “The password for this account has expired” with an OK button.
If I try again I get the same result. If I purposely type a mismatch for the new PW it does acknowledge that.
Has anyone else seen this? I can’t think of a workaround.
I am using Server Next Preview Build 26257. It is a domain controller. I only have the one AD account which I created to do the evaluation. The account password expired today. When I attempt to change it at login, I enter the new password twice as required and hit Enter, but it sends me back and says “The password for this account has expired” with an OK button. If I try again I get the same result. If I purposely type a mismatch for the new PW it does acknowledge that. Has anyone else seen this? I can’t think of a workaround. Read More
Explanation of the Microsoft AI Cloud Partner Agreement & Marketplace Publisher Agreement.
We have to clarify two clauses from the agreement:
Microsoft AI Cloud Partner Program Agreement: Section 8 Limitations of Liability (b) it says Privacy and Data Protection, Confidentiality and Publicity and indemnification are carved out of any limitations in paragraph 8.(a).
Can you please confirm our understanding that Microsoft is asking the Company to have the risk of unlimited liability related to these carve-outs ?Microsoft Publisher Agreement: Section 9 (b) has indemnification claims subject to indirect damages and Section 9 (c) have carve-outs for confidentiality, privacy or data protection which we interpret as having the risk of unlimited liability.
Can you please confirm our understanding that Microsoft is asking the Company to have the risk of unlimited liability related to these carve-outs ?
Helllo there, We have to clarify two clauses from the agreement:Microsoft AI Cloud Partner Program Agreement: Section 8 Limitations of Liability (b) it says Privacy and Data Protection, Confidentiality and Publicity and indemnification are carved out of any limitations in paragraph 8.(a). Can you please confirm our understanding that Microsoft is asking the Company to have the risk of unlimited liability related to these carve-outs ?Microsoft Publisher Agreement: Section 9 (b) has indemnification claims subject to indirect damages and Section 9 (c) have carve-outs for confidentiality, privacy or data protection which we interpret as having the risk of unlimited liability. Can you please confirm our understanding that Microsoft is asking the Company to have the risk of unlimited liability related to these carve-outs ? Read More
How to request 10 free M365 licences for NonProfit with a Godaddy M365 account
Hi,
our organization is eligible to M365 offer for non profit, but since we are client to Godaddy M365 , we are automatically redirect to ther logon page when we try to request licences on Microsoft interface.
We have contact Godaddy hoping they will remove those restrictions, in order for us to receive M365 licences, but they told us that if we want to move to microsoft they wil simply delete our instance so allow us to go for Microsoft.
Have someone face that issue? If there are advices, your are welcome.
Sorry for my english
Hi, our organization is eligible to M365 offer for non profit, but since we are client to Godaddy M365 , we are automatically redirect to ther logon page when we try to request licences on Microsoft interface. We have contact Godaddy hoping they will remove those restrictions, in order for us to receive M365 licences, but they told us that if we want to move to microsoft they wil simply delete our instance so allow us to go for Microsoft. Have someone face that issue? If there are advices, your are welcome. Sorry for my english Read More
Can’t Download Files Completely from One Drive
Hi, I tried to download dataset files online for model training, but there is a file where I keep on encountering errors, where the files had 8000+ file inside, but it can’t download completely. The file is around 22.6GB but whenever I tried to download, it is able to download. But even it shows download complete, it is actually not complete. Instead, it shows a txt file showing the error, as shown below. Does anyone knows ways to solve this problem?
Anyone knows how to solve this error?
Hi, I tried to download dataset files online for model training, but there is a file where I keep on encountering errors, where the files had 8000+ file inside, but it can’t download completely. The file is around 22.6GB but whenever I tried to download, it is able to download. But even it shows download complete, it is actually not complete. Instead, it shows a txt file showing the error, as shown below. Does anyone knows ways to solve this problem?Anyone knows how to solve this error? Read More
Copilot Snacks! Copilot for Payers – How Copilot for Sales can be used by Agents and Brokers
Unlocking the Potential of AI in Health Insurance Sales with Copilot for Sales
This discussion offers a glimpse into the future of health insurance sales, where AI-powered tools like Copilot for Sales empower agents to deliver exceptional service while maximizing their productivity. For sales agents and brokers looking to stay ahead in the competitive health insurance market, this video is a must-watch.
Revolutionizing Health Insurance Sales with Copilot for Sales
Integration: Seamlessly connects productivity tools with CRM systems, enhancing data flow and efficiency
Productivity: Offers sales-specific workflows, improving agent efficiency and customer engagement
Personalization: Utilizes AI to tailor customer interactions, summarizing email threads and drafting responses
Competitive Intelligence: Provides real-time competitive insights, aiding agents in offering the best solutions
Efficiency: Streamlines preparation, consolidating information in one place for quicker, more effective meetings
To see all HLS Copilot Snacks video click here.
Special thanks to Ashley Keimach for her expertise and making this video possible
Microsoft Tech Community – Latest Blogs –Read More
Error in reflectarray_gui_v2 (line 42) gui_mainfcn(gui_State, varargin{:});
function varargout = reflectarray_gui_v2(varargin)
% REFLECTARRAY_GUI_V2 MATLAB code for reflectarray_gui_v2.fig
% REFLECTARRAY_GUI_V2, by itself, creates a new REFLECTARRAY_GUI_V2 or raises the existing
% singleton*.
%
% H = REFLECTARRAY_GUI_V2 returns the handle to a new REFLECTARRAY_GUI_V2 or the handle to
% the existing singleton*.
%
% REFLECTARRAY_GUI_V2(‘CALLBACK’,hObject,eventData,handles,…) calls the local
% function named CALLBACK in REFLECTARRAY_GUI_V2.M with the given input arguments.
%
% REFLECTARRAY_GUI_V2(‘Property’,’Value’,…) creates a new REFLECTARRAY_GUI_V2 or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before reflectarray_gui_v2_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to reflectarray_gui_v2_OpeningFcn via varargin.
%
% *See GUI Options on GUIDE’s Tools menu. Choose "GUI allows only one
% instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES
% Edit the above text to modify the response to help reflectarray_gui_v2
% Last Modified by GUIDE v2.5 11-Dec-2019 22:58:28
% Begin initialization code – DO NOT EDIT
gui_Singleton = 1;
gui_State = struct(‘gui_Name’, mfilename, …
‘gui_Singleton’, gui_Singleton, …
‘gui_OpeningFcn’, @reflectarray_gui_v2_OpeningFcn, …
‘gui_OutputFcn’, @reflectarray_gui_v2_OutputFcn, …
‘gui_LayoutFcn’, [] , …
‘gui_Callback’, []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code – DO NOT EDIT
% — Executes just before reflectarray_gui_v2 is made visible.
function reflectarray_gui_v2_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to reflectarray_gui_v2 (see VARARGIN)
% Choose default command line output for reflectarray_gui_v2
handles.output = hObject;
axes(handles.axes1)
matlabImage = imread(‘D:S Mdrive-download-20240802T134608Z-001coord.jpg’);
image(matlabImage)
axis off
axis image
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes reflectarray_gui_v2 wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% — Outputs from this function are returned to the command line.
function varargout = reflectarray_gui_v2_OutputFcn(hObject, eventdata, handles)
% varargout cell array for returning output args (see VARARGOUT);
% hObject handle to figure
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Get default command line output from handles structure
varargout{1} = handles.output;
function edit1_Callback(hObject, eventdata, handles)
% hObject handle to edit1 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,’String’) returns contents of edit1 as text
% str2double(get(hObject,’String’)) returns contents of edit1 as a double
% — Executes during object creation, after setting all properties.
function edit1_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit1 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles empty – handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,’BackgroundColor’), get(0,’defaultUicontrolBackgroundColor’))
set(hObject,’BackgroundColor’,’white’);
end
function edit2_Callback(hObject, eventdata, handles)
% hObject handle to edit2 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,’String’) returns contents of edit2 as text
% str2double(get(hObject,’String’)) returns contents of edit2 as a double
% — Executes during object creation, after setting all properties.
function edit2_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit2 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles empty – handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,’BackgroundColor’), get(0,’defaultUicontrolBackgroundColor’))
set(hObject,’BackgroundColor’,’white’);
end
function edit3_Callback(hObject, eventdata, handles)
% hObject handle to edit3 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,’String’) returns contents of edit3 as text
% str2double(get(hObject,’String’)) returns contents of edit3 as a double
% — Executes during object creation, after setting all properties.
function edit3_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit3 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles empty – handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,’BackgroundColor’), get(0,’defaultUicontrolBackgroundColor’))
set(hObject,’BackgroundColor’,’white’);
end
function edit4_Callback(hObject, eventdata, handles)
% hObject handle to edit4 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,’String’) returns contents of edit4 as text
% str2double(get(hObject,’String’)) returns contents of edit4 as a double
% — Executes during object creation, after setting all properties.
function edit4_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit4 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles empty – handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,’BackgroundColor’), get(0,’defaultUicontrolBackgroundColor’))
set(hObject,’BackgroundColor’,’white’);
end
function edit5_Callback(hObject, eventdata, handles)
% hObject handle to edit5 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,’String’) returns contents of edit5 as text
% str2double(get(hObject,’String’)) returns contents of edit5 as a double
% — Executes during object creation, after setting all properties.
function edit5_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit5 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles empty – handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,’BackgroundColor’), get(0,’defaultUicontrolBackgroundColor’))
set(hObject,’BackgroundColor’,’white’);
end
function edit7_Callback(hObject, eventdata, handles)
% hObject handle to edit7 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,’String’) returns contents of edit7 as text
% str2double(get(hObject,’String’)) returns contents of edit7 as a double
% — Executes during object creation, after setting all properties.
function edit7_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit7 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles empty – handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,’BackgroundColor’), get(0,’defaultUicontrolBackgroundColor’))
set(hObject,’BackgroundColor’,’white’);
end
function edit6_Callback(hObject, eventdata, handles)
% hObject handle to edit6 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,’String’) returns contents of edit6 as text
% str2double(get(hObject,’String’)) returns contents of edit6 as a double
% — Executes during object creation, after setting all properties.
function edit6_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit6 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles empty – handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,’BackgroundColor’), get(0,’defaultUicontrolBackgroundColor’))
set(hObject,’BackgroundColor’,’white’);
end
% — Executes on button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton1 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
handles = guidata(hObject);
freq = str2double(get(handles.edit2,’string’))*10^9;
lambda = physconst(‘LightSpeed’)*1000/freq;
k=2*pi/lambda;
ix=1;
iy=1;
data=handles.data;
phas_u=data(:,1)’;
dim_u=data(:,2)’;
the_dir = str2double(get(handles.edit6,’string’));
phi_dir = str2double(get(handles.edit7,’string’));
pha_zer = str2double(get(handles.edit13,’string’));
x_cor = str2double(get(handles.edit3,’string’));
y_cor = str2double(get(handles.edit4,’string’));
z_cor = str2double(get(handles.edit5,’string’));
rad = str2double(get(handles.edit1,’string’));
uedim = str2double(get(handles.edit12,’string’));
for xi=-rad/2+mod(rad/2,uedim):uedim:rad/2
for yi=-rad/2+mod(rad/2,uedim):uedim:rad/2
if sqrt(xi^2+yi^2)<rad/2
R = sqrt((x_cor-xi)^2+(y_cor-yi)^2+z_cor^2);
phase(ix,iy)=k*(R-sind(the_dir)*(xi*cosd(phi_dir)+yi*sind(phi_dir)))+pha_zer;
m_phase=mod(phase(ix,iy),2*pi);
m_phase_deg=m_phase*180/pi-180;
% phas_lin_map=m_phase_deg*m+n;
if m_phase_deg > phas_u(1,1)
phas_lin_map = phas_u(1,1);
elseif m_phase_deg < phas_u(1,end)
phas_lin_map = phas_u(end,1);
else
dy = diff([0 phas_u]);
dyix = find(dy == 0);
dim_u(dyix) = dim_u(dyix-1)+1E-8;
phas_lin_map = interp1(phas_u, dim_u, m_phase_deg);
end
else
phase(ix,iy)=0;
end
iy=iy+1;
end
ix=ix+1;
iy=1;
end
m_phase=mod(phase,2*pi);
m_phase_deg=m_phase*180/pi;
m_phase_deg(:);
axes(handles.axes2)
surf(m_phase_deg)
view(2)
guidata(hObject, handles);
% — Executes on button press in pushbutton2.
function pushbutton2_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton2 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
handles = guidata(hObject);
addpath(genpath(‘C:UsersseymurDesktopcst-matlabCST-MATLAB-API-master’));
cst = actxserver(‘CSTStudio.application’);
mws = cst.invoke(‘NewMWS’);
CstDefaultUnits(mws)
fmin=2.2;
fmax=2.6;
CstDefineFrequencyRange(mws,fmin,fmax)
CstMeshInitiator(mws)
Xmin=’expanded open’;
Xmax=’expanded open’;
Ymin=’expanded open’;
Ymax=’expanded open’;
Zmin=’expanded open’;
Zmax=’expanded open’;
minfrequency = fmin;
CstDefineOpenBoundary(mws,minfrequency,Xmin,Xmax,Ymin,Ymax,Zmin,Zmax)
XminSpace = 0;
XmaxSpace = 0;
YminSpace = 0;
YmaxSpace = 0;
ZminSpace = 0;
ZmaxSpace = 0;
CstDefineBackroundMaterial(mws,XminSpace,XmaxSpace,YminSpace,YmaxSpace,ZminSpace,ZmaxSpace)
CstCopperAnnealedLossy(mws)
freq = str2double(get(handles.edit2,’string’))*10^9;
lambda = physconst(‘LightSpeed’)*1000/freq;
k=2*pi/lambda;
ix=1;
iy=1;
data=handles.data;
phas_u=data(:,1)’;
dim_u=data(:,2)’;
count=1;
the_dir = str2double(get(handles.edit6,’string’));
phi_dir = str2double(get(handles.edit7,’string’));
pha_zer = str2double(get(handles.edit13,’string’));
x_cor = str2double(get(handles.edit3,’string’));
y_cor = str2double(get(handles.edit4,’string’));
z_cor = str2double(get(handles.edit5,’string’));
rad = str2double(get(handles.edit1,’string’));
uedim = str2double(get(handles.edit12,’string’));
for xi=-rad/2+mod(rad/2,uedim):uedim:rad/2
for yi=-rad/2+mod(rad/2,uedim):uedim:rad/2
if sqrt(xi^2+yi^2)<rad/2
R = sqrt((x_cor-xi)^2+(y_cor-yi)^2+z_cor^2);
phase(ix,iy)=k*(R-sind(the_dir)*(xi*cosd(phi_dir)+yi*sind(phi_dir)))+pha_zer;
m_phase=mod(phase(ix,iy),2*pi);
m_phase_deg=m_phase*180/pi-180;
if m_phase_deg > phas_u(1,1)
phas_lin_map = dim_u(1,1);
elseif m_phase_deg < phas_u(1,end)
phas_lin_map = dim_u(end,1);
else
dy = diff([0 phas_u]);
dyix = find(dy == 0);
dim_u(dyix) = dim_u(dyix-1)+1E-8;
phas_lin_map = interp1(phas_u, dim_u, m_phase_deg);
end
%CST
Name=num2str(count);
component=’reflectarray’;
count=count+1;
material=’Copper (annealed)’;
Xrange = [-phas_lin_map/2+xi phas_lin_map/2+xi];
Yrange = [-phas_lin_map/2+yi phas_lin_map/2+yi];
Zrange = [0 0.1];
Cstbrick(mws, Name, component, material, Xrange, Yrange, Zrange)
else
phase(ix,iy)=0;
end
iy=iy+1;
end
ix=ix+1;
iy=1;
end
guidata(hObject, handles);
% — Executes on button press in pushbutton4.
function pushbutton4_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton4 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
handles = guidata(hObject);
[file,path] = uigetfile(‘*.txt’);
filename = [path file];
delimiter = ‘ ‘;
formatSpec = ‘%f%f%[^nr]’;
fileID = fopen(filename,’r’);
dataArray = textscan(fileID, formatSpec, ‘Delimiter’, delimiter, ‘MultipleDelimsAsOne’, true, ‘TextType’, ‘string’, ‘ReturnOnError’, false);
fclose(fileID);
handles.data = [dataArray{1:end-1}];
clearvars filename delimiter formatSpec fileID dataArray ans;
guidata(hObject, handles);
function edit12_Callback(hObject, eventdata, handles)
% hObject handle to edit12 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,’String’) returns contents of edit12 as text
% str2double(get(hObject,’String’)) returns contents of edit12 as a double
% — Executes during object creation, after setting all properties.
function edit12_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit12 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles empty – handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,’BackgroundColor’), get(0,’defaultUicontrolBackgroundColor’))
set(hObject,’BackgroundColor’,’white’);
end
function edit13_Callback(hObject, eventdata, handles)
% hObject handle to edit13 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,’String’) returns contents of edit13 as text
% str2double(get(hObject,’String’)) returns contents of edit13 as a double
% — Executes during object creation, after setting all properties.
function edit13_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit13 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles empty – handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,’BackgroundColor’), get(0,’defaultUicontrolBackgroundColor’))
set(hObject,’BackgroundColor’,’white’);
endfunction varargout = reflectarray_gui_v2(varargin)
% REFLECTARRAY_GUI_V2 MATLAB code for reflectarray_gui_v2.fig
% REFLECTARRAY_GUI_V2, by itself, creates a new REFLECTARRAY_GUI_V2 or raises the existing
% singleton*.
%
% H = REFLECTARRAY_GUI_V2 returns the handle to a new REFLECTARRAY_GUI_V2 or the handle to
% the existing singleton*.
%
% REFLECTARRAY_GUI_V2(‘CALLBACK’,hObject,eventData,handles,…) calls the local
% function named CALLBACK in REFLECTARRAY_GUI_V2.M with the given input arguments.
%
% REFLECTARRAY_GUI_V2(‘Property’,’Value’,…) creates a new REFLECTARRAY_GUI_V2 or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before reflectarray_gui_v2_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to reflectarray_gui_v2_OpeningFcn via varargin.
%
% *See GUI Options on GUIDE’s Tools menu. Choose "GUI allows only one
% instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES
% Edit the above text to modify the response to help reflectarray_gui_v2
% Last Modified by GUIDE v2.5 11-Dec-2019 22:58:28
% Begin initialization code – DO NOT EDIT
gui_Singleton = 1;
gui_State = struct(‘gui_Name’, mfilename, …
‘gui_Singleton’, gui_Singleton, …
‘gui_OpeningFcn’, @reflectarray_gui_v2_OpeningFcn, …
‘gui_OutputFcn’, @reflectarray_gui_v2_OutputFcn, …
‘gui_LayoutFcn’, [] , …
‘gui_Callback’, []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code – DO NOT EDIT
% — Executes just before reflectarray_gui_v2 is made visible.
function reflectarray_gui_v2_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to reflectarray_gui_v2 (see VARARGIN)
% Choose default command line output for reflectarray_gui_v2
handles.output = hObject;
axes(handles.axes1)
matlabImage = imread(‘D:S Mdrive-download-20240802T134608Z-001coord.jpg’);
image(matlabImage)
axis off
axis image
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes reflectarray_gui_v2 wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% — Outputs from this function are returned to the command line.
function varargout = reflectarray_gui_v2_OutputFcn(hObject, eventdata, handles)
% varargout cell array for returning output args (see VARARGOUT);
% hObject handle to figure
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Get default command line output from handles structure
varargout{1} = handles.output;
function edit1_Callback(hObject, eventdata, handles)
% hObject handle to edit1 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,’String’) returns contents of edit1 as text
% str2double(get(hObject,’String’)) returns contents of edit1 as a double
% — Executes during object creation, after setting all properties.
function edit1_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit1 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles empty – handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,’BackgroundColor’), get(0,’defaultUicontrolBackgroundColor’))
set(hObject,’BackgroundColor’,’white’);
end
function edit2_Callback(hObject, eventdata, handles)
% hObject handle to edit2 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,’String’) returns contents of edit2 as text
% str2double(get(hObject,’String’)) returns contents of edit2 as a double
% — Executes during object creation, after setting all properties.
function edit2_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit2 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles empty – handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,’BackgroundColor’), get(0,’defaultUicontrolBackgroundColor’))
set(hObject,’BackgroundColor’,’white’);
end
function edit3_Callback(hObject, eventdata, handles)
% hObject handle to edit3 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,’String’) returns contents of edit3 as text
% str2double(get(hObject,’String’)) returns contents of edit3 as a double
% — Executes during object creation, after setting all properties.
function edit3_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit3 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles empty – handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,’BackgroundColor’), get(0,’defaultUicontrolBackgroundColor’))
set(hObject,’BackgroundColor’,’white’);
end
function edit4_Callback(hObject, eventdata, handles)
% hObject handle to edit4 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,’String’) returns contents of edit4 as text
% str2double(get(hObject,’String’)) returns contents of edit4 as a double
% — Executes during object creation, after setting all properties.
function edit4_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit4 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles empty – handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,’BackgroundColor’), get(0,’defaultUicontrolBackgroundColor’))
set(hObject,’BackgroundColor’,’white’);
end
function edit5_Callback(hObject, eventdata, handles)
% hObject handle to edit5 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,’String’) returns contents of edit5 as text
% str2double(get(hObject,’String’)) returns contents of edit5 as a double
% — Executes during object creation, after setting all properties.
function edit5_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit5 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles empty – handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,’BackgroundColor’), get(0,’defaultUicontrolBackgroundColor’))
set(hObject,’BackgroundColor’,’white’);
end
function edit7_Callback(hObject, eventdata, handles)
% hObject handle to edit7 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,’String’) returns contents of edit7 as text
% str2double(get(hObject,’String’)) returns contents of edit7 as a double
% — Executes during object creation, after setting all properties.
function edit7_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit7 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles empty – handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,’BackgroundColor’), get(0,’defaultUicontrolBackgroundColor’))
set(hObject,’BackgroundColor’,’white’);
end
function edit6_Callback(hObject, eventdata, handles)
% hObject handle to edit6 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,’String’) returns contents of edit6 as text
% str2double(get(hObject,’String’)) returns contents of edit6 as a double
% — Executes during object creation, after setting all properties.
function edit6_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit6 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles empty – handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,’BackgroundColor’), get(0,’defaultUicontrolBackgroundColor’))
set(hObject,’BackgroundColor’,’white’);
end
% — Executes on button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton1 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
handles = guidata(hObject);
freq = str2double(get(handles.edit2,’string’))*10^9;
lambda = physconst(‘LightSpeed’)*1000/freq;
k=2*pi/lambda;
ix=1;
iy=1;
data=handles.data;
phas_u=data(:,1)’;
dim_u=data(:,2)’;
the_dir = str2double(get(handles.edit6,’string’));
phi_dir = str2double(get(handles.edit7,’string’));
pha_zer = str2double(get(handles.edit13,’string’));
x_cor = str2double(get(handles.edit3,’string’));
y_cor = str2double(get(handles.edit4,’string’));
z_cor = str2double(get(handles.edit5,’string’));
rad = str2double(get(handles.edit1,’string’));
uedim = str2double(get(handles.edit12,’string’));
for xi=-rad/2+mod(rad/2,uedim):uedim:rad/2
for yi=-rad/2+mod(rad/2,uedim):uedim:rad/2
if sqrt(xi^2+yi^2)<rad/2
R = sqrt((x_cor-xi)^2+(y_cor-yi)^2+z_cor^2);
phase(ix,iy)=k*(R-sind(the_dir)*(xi*cosd(phi_dir)+yi*sind(phi_dir)))+pha_zer;
m_phase=mod(phase(ix,iy),2*pi);
m_phase_deg=m_phase*180/pi-180;
% phas_lin_map=m_phase_deg*m+n;
if m_phase_deg > phas_u(1,1)
phas_lin_map = phas_u(1,1);
elseif m_phase_deg < phas_u(1,end)
phas_lin_map = phas_u(end,1);
else
dy = diff([0 phas_u]);
dyix = find(dy == 0);
dim_u(dyix) = dim_u(dyix-1)+1E-8;
phas_lin_map = interp1(phas_u, dim_u, m_phase_deg);
end
else
phase(ix,iy)=0;
end
iy=iy+1;
end
ix=ix+1;
iy=1;
end
m_phase=mod(phase,2*pi);
m_phase_deg=m_phase*180/pi;
m_phase_deg(:);
axes(handles.axes2)
surf(m_phase_deg)
view(2)
guidata(hObject, handles);
% — Executes on button press in pushbutton2.
function pushbutton2_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton2 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
handles = guidata(hObject);
addpath(genpath(‘C:UsersseymurDesktopcst-matlabCST-MATLAB-API-master’));
cst = actxserver(‘CSTStudio.application’);
mws = cst.invoke(‘NewMWS’);
CstDefaultUnits(mws)
fmin=2.2;
fmax=2.6;
CstDefineFrequencyRange(mws,fmin,fmax)
CstMeshInitiator(mws)
Xmin=’expanded open’;
Xmax=’expanded open’;
Ymin=’expanded open’;
Ymax=’expanded open’;
Zmin=’expanded open’;
Zmax=’expanded open’;
minfrequency = fmin;
CstDefineOpenBoundary(mws,minfrequency,Xmin,Xmax,Ymin,Ymax,Zmin,Zmax)
XminSpace = 0;
XmaxSpace = 0;
YminSpace = 0;
YmaxSpace = 0;
ZminSpace = 0;
ZmaxSpace = 0;
CstDefineBackroundMaterial(mws,XminSpace,XmaxSpace,YminSpace,YmaxSpace,ZminSpace,ZmaxSpace)
CstCopperAnnealedLossy(mws)
freq = str2double(get(handles.edit2,’string’))*10^9;
lambda = physconst(‘LightSpeed’)*1000/freq;
k=2*pi/lambda;
ix=1;
iy=1;
data=handles.data;
phas_u=data(:,1)’;
dim_u=data(:,2)’;
count=1;
the_dir = str2double(get(handles.edit6,’string’));
phi_dir = str2double(get(handles.edit7,’string’));
pha_zer = str2double(get(handles.edit13,’string’));
x_cor = str2double(get(handles.edit3,’string’));
y_cor = str2double(get(handles.edit4,’string’));
z_cor = str2double(get(handles.edit5,’string’));
rad = str2double(get(handles.edit1,’string’));
uedim = str2double(get(handles.edit12,’string’));
for xi=-rad/2+mod(rad/2,uedim):uedim:rad/2
for yi=-rad/2+mod(rad/2,uedim):uedim:rad/2
if sqrt(xi^2+yi^2)<rad/2
R = sqrt((x_cor-xi)^2+(y_cor-yi)^2+z_cor^2);
phase(ix,iy)=k*(R-sind(the_dir)*(xi*cosd(phi_dir)+yi*sind(phi_dir)))+pha_zer;
m_phase=mod(phase(ix,iy),2*pi);
m_phase_deg=m_phase*180/pi-180;
if m_phase_deg > phas_u(1,1)
phas_lin_map = dim_u(1,1);
elseif m_phase_deg < phas_u(1,end)
phas_lin_map = dim_u(end,1);
else
dy = diff([0 phas_u]);
dyix = find(dy == 0);
dim_u(dyix) = dim_u(dyix-1)+1E-8;
phas_lin_map = interp1(phas_u, dim_u, m_phase_deg);
end
%CST
Name=num2str(count);
component=’reflectarray’;
count=count+1;
material=’Copper (annealed)’;
Xrange = [-phas_lin_map/2+xi phas_lin_map/2+xi];
Yrange = [-phas_lin_map/2+yi phas_lin_map/2+yi];
Zrange = [0 0.1];
Cstbrick(mws, Name, component, material, Xrange, Yrange, Zrange)
else
phase(ix,iy)=0;
end
iy=iy+1;
end
ix=ix+1;
iy=1;
end
guidata(hObject, handles);
% — Executes on button press in pushbutton4.
function pushbutton4_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton4 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
handles = guidata(hObject);
[file,path] = uigetfile(‘*.txt’);
filename = [path file];
delimiter = ‘ ‘;
formatSpec = ‘%f%f%[^nr]’;
fileID = fopen(filename,’r’);
dataArray = textscan(fileID, formatSpec, ‘Delimiter’, delimiter, ‘MultipleDelimsAsOne’, true, ‘TextType’, ‘string’, ‘ReturnOnError’, false);
fclose(fileID);
handles.data = [dataArray{1:end-1}];
clearvars filename delimiter formatSpec fileID dataArray ans;
guidata(hObject, handles);
function edit12_Callback(hObject, eventdata, handles)
% hObject handle to edit12 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,’String’) returns contents of edit12 as text
% str2double(get(hObject,’String’)) returns contents of edit12 as a double
% — Executes during object creation, after setting all properties.
function edit12_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit12 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles empty – handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,’BackgroundColor’), get(0,’defaultUicontrolBackgroundColor’))
set(hObject,’BackgroundColor’,’white’);
end
function edit13_Callback(hObject, eventdata, handles)
% hObject handle to edit13 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,’String’) returns contents of edit13 as text
% str2double(get(hObject,’String’)) returns contents of edit13 as a double
% — Executes during object creation, after setting all properties.
function edit13_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit13 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles empty – handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,’BackgroundColor’), get(0,’defaultUicontrolBackgroundColor’))
set(hObject,’BackgroundColor’,’white’);
end function varargout = reflectarray_gui_v2(varargin)
% REFLECTARRAY_GUI_V2 MATLAB code for reflectarray_gui_v2.fig
% REFLECTARRAY_GUI_V2, by itself, creates a new REFLECTARRAY_GUI_V2 or raises the existing
% singleton*.
%
% H = REFLECTARRAY_GUI_V2 returns the handle to a new REFLECTARRAY_GUI_V2 or the handle to
% the existing singleton*.
%
% REFLECTARRAY_GUI_V2(‘CALLBACK’,hObject,eventData,handles,…) calls the local
% function named CALLBACK in REFLECTARRAY_GUI_V2.M with the given input arguments.
%
% REFLECTARRAY_GUI_V2(‘Property’,’Value’,…) creates a new REFLECTARRAY_GUI_V2 or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before reflectarray_gui_v2_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to reflectarray_gui_v2_OpeningFcn via varargin.
%
% *See GUI Options on GUIDE’s Tools menu. Choose "GUI allows only one
% instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES
% Edit the above text to modify the response to help reflectarray_gui_v2
% Last Modified by GUIDE v2.5 11-Dec-2019 22:58:28
% Begin initialization code – DO NOT EDIT
gui_Singleton = 1;
gui_State = struct(‘gui_Name’, mfilename, …
‘gui_Singleton’, gui_Singleton, …
‘gui_OpeningFcn’, @reflectarray_gui_v2_OpeningFcn, …
‘gui_OutputFcn’, @reflectarray_gui_v2_OutputFcn, …
‘gui_LayoutFcn’, [] , …
‘gui_Callback’, []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code – DO NOT EDIT
% — Executes just before reflectarray_gui_v2 is made visible.
function reflectarray_gui_v2_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to reflectarray_gui_v2 (see VARARGIN)
% Choose default command line output for reflectarray_gui_v2
handles.output = hObject;
axes(handles.axes1)
matlabImage = imread(‘D:S Mdrive-download-20240802T134608Z-001coord.jpg’);
image(matlabImage)
axis off
axis image
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes reflectarray_gui_v2 wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% — Outputs from this function are returned to the command line.
function varargout = reflectarray_gui_v2_OutputFcn(hObject, eventdata, handles)
% varargout cell array for returning output args (see VARARGOUT);
% hObject handle to figure
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Get default command line output from handles structure
varargout{1} = handles.output;
function edit1_Callback(hObject, eventdata, handles)
% hObject handle to edit1 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,’String’) returns contents of edit1 as text
% str2double(get(hObject,’String’)) returns contents of edit1 as a double
% — Executes during object creation, after setting all properties.
function edit1_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit1 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles empty – handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,’BackgroundColor’), get(0,’defaultUicontrolBackgroundColor’))
set(hObject,’BackgroundColor’,’white’);
end
function edit2_Callback(hObject, eventdata, handles)
% hObject handle to edit2 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,’String’) returns contents of edit2 as text
% str2double(get(hObject,’String’)) returns contents of edit2 as a double
% — Executes during object creation, after setting all properties.
function edit2_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit2 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles empty – handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,’BackgroundColor’), get(0,’defaultUicontrolBackgroundColor’))
set(hObject,’BackgroundColor’,’white’);
end
function edit3_Callback(hObject, eventdata, handles)
% hObject handle to edit3 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,’String’) returns contents of edit3 as text
% str2double(get(hObject,’String’)) returns contents of edit3 as a double
% — Executes during object creation, after setting all properties.
function edit3_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit3 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles empty – handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,’BackgroundColor’), get(0,’defaultUicontrolBackgroundColor’))
set(hObject,’BackgroundColor’,’white’);
end
function edit4_Callback(hObject, eventdata, handles)
% hObject handle to edit4 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,’String’) returns contents of edit4 as text
% str2double(get(hObject,’String’)) returns contents of edit4 as a double
% — Executes during object creation, after setting all properties.
function edit4_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit4 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles empty – handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,’BackgroundColor’), get(0,’defaultUicontrolBackgroundColor’))
set(hObject,’BackgroundColor’,’white’);
end
function edit5_Callback(hObject, eventdata, handles)
% hObject handle to edit5 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,’String’) returns contents of edit5 as text
% str2double(get(hObject,’String’)) returns contents of edit5 as a double
% — Executes during object creation, after setting all properties.
function edit5_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit5 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles empty – handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,’BackgroundColor’), get(0,’defaultUicontrolBackgroundColor’))
set(hObject,’BackgroundColor’,’white’);
end
function edit7_Callback(hObject, eventdata, handles)
% hObject handle to edit7 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,’String’) returns contents of edit7 as text
% str2double(get(hObject,’String’)) returns contents of edit7 as a double
% — Executes during object creation, after setting all properties.
function edit7_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit7 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles empty – handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,’BackgroundColor’), get(0,’defaultUicontrolBackgroundColor’))
set(hObject,’BackgroundColor’,’white’);
end
function edit6_Callback(hObject, eventdata, handles)
% hObject handle to edit6 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,’String’) returns contents of edit6 as text
% str2double(get(hObject,’String’)) returns contents of edit6 as a double
% — Executes during object creation, after setting all properties.
function edit6_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit6 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles empty – handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,’BackgroundColor’), get(0,’defaultUicontrolBackgroundColor’))
set(hObject,’BackgroundColor’,’white’);
end
% — Executes on button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton1 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
handles = guidata(hObject);
freq = str2double(get(handles.edit2,’string’))*10^9;
lambda = physconst(‘LightSpeed’)*1000/freq;
k=2*pi/lambda;
ix=1;
iy=1;
data=handles.data;
phas_u=data(:,1)’;
dim_u=data(:,2)’;
the_dir = str2double(get(handles.edit6,’string’));
phi_dir = str2double(get(handles.edit7,’string’));
pha_zer = str2double(get(handles.edit13,’string’));
x_cor = str2double(get(handles.edit3,’string’));
y_cor = str2double(get(handles.edit4,’string’));
z_cor = str2double(get(handles.edit5,’string’));
rad = str2double(get(handles.edit1,’string’));
uedim = str2double(get(handles.edit12,’string’));
for xi=-rad/2+mod(rad/2,uedim):uedim:rad/2
for yi=-rad/2+mod(rad/2,uedim):uedim:rad/2
if sqrt(xi^2+yi^2)<rad/2
R = sqrt((x_cor-xi)^2+(y_cor-yi)^2+z_cor^2);
phase(ix,iy)=k*(R-sind(the_dir)*(xi*cosd(phi_dir)+yi*sind(phi_dir)))+pha_zer;
m_phase=mod(phase(ix,iy),2*pi);
m_phase_deg=m_phase*180/pi-180;
% phas_lin_map=m_phase_deg*m+n;
if m_phase_deg > phas_u(1,1)
phas_lin_map = phas_u(1,1);
elseif m_phase_deg < phas_u(1,end)
phas_lin_map = phas_u(end,1);
else
dy = diff([0 phas_u]);
dyix = find(dy == 0);
dim_u(dyix) = dim_u(dyix-1)+1E-8;
phas_lin_map = interp1(phas_u, dim_u, m_phase_deg);
end
else
phase(ix,iy)=0;
end
iy=iy+1;
end
ix=ix+1;
iy=1;
end
m_phase=mod(phase,2*pi);
m_phase_deg=m_phase*180/pi;
m_phase_deg(:);
axes(handles.axes2)
surf(m_phase_deg)
view(2)
guidata(hObject, handles);
% — Executes on button press in pushbutton2.
function pushbutton2_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton2 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
handles = guidata(hObject);
addpath(genpath(‘C:UsersseymurDesktopcst-matlabCST-MATLAB-API-master’));
cst = actxserver(‘CSTStudio.application’);
mws = cst.invoke(‘NewMWS’);
CstDefaultUnits(mws)
fmin=2.2;
fmax=2.6;
CstDefineFrequencyRange(mws,fmin,fmax)
CstMeshInitiator(mws)
Xmin=’expanded open’;
Xmax=’expanded open’;
Ymin=’expanded open’;
Ymax=’expanded open’;
Zmin=’expanded open’;
Zmax=’expanded open’;
minfrequency = fmin;
CstDefineOpenBoundary(mws,minfrequency,Xmin,Xmax,Ymin,Ymax,Zmin,Zmax)
XminSpace = 0;
XmaxSpace = 0;
YminSpace = 0;
YmaxSpace = 0;
ZminSpace = 0;
ZmaxSpace = 0;
CstDefineBackroundMaterial(mws,XminSpace,XmaxSpace,YminSpace,YmaxSpace,ZminSpace,ZmaxSpace)
CstCopperAnnealedLossy(mws)
freq = str2double(get(handles.edit2,’string’))*10^9;
lambda = physconst(‘LightSpeed’)*1000/freq;
k=2*pi/lambda;
ix=1;
iy=1;
data=handles.data;
phas_u=data(:,1)’;
dim_u=data(:,2)’;
count=1;
the_dir = str2double(get(handles.edit6,’string’));
phi_dir = str2double(get(handles.edit7,’string’));
pha_zer = str2double(get(handles.edit13,’string’));
x_cor = str2double(get(handles.edit3,’string’));
y_cor = str2double(get(handles.edit4,’string’));
z_cor = str2double(get(handles.edit5,’string’));
rad = str2double(get(handles.edit1,’string’));
uedim = str2double(get(handles.edit12,’string’));
for xi=-rad/2+mod(rad/2,uedim):uedim:rad/2
for yi=-rad/2+mod(rad/2,uedim):uedim:rad/2
if sqrt(xi^2+yi^2)<rad/2
R = sqrt((x_cor-xi)^2+(y_cor-yi)^2+z_cor^2);
phase(ix,iy)=k*(R-sind(the_dir)*(xi*cosd(phi_dir)+yi*sind(phi_dir)))+pha_zer;
m_phase=mod(phase(ix,iy),2*pi);
m_phase_deg=m_phase*180/pi-180;
if m_phase_deg > phas_u(1,1)
phas_lin_map = dim_u(1,1);
elseif m_phase_deg < phas_u(1,end)
phas_lin_map = dim_u(end,1);
else
dy = diff([0 phas_u]);
dyix = find(dy == 0);
dim_u(dyix) = dim_u(dyix-1)+1E-8;
phas_lin_map = interp1(phas_u, dim_u, m_phase_deg);
end
%CST
Name=num2str(count);
component=’reflectarray’;
count=count+1;
material=’Copper (annealed)’;
Xrange = [-phas_lin_map/2+xi phas_lin_map/2+xi];
Yrange = [-phas_lin_map/2+yi phas_lin_map/2+yi];
Zrange = [0 0.1];
Cstbrick(mws, Name, component, material, Xrange, Yrange, Zrange)
else
phase(ix,iy)=0;
end
iy=iy+1;
end
ix=ix+1;
iy=1;
end
guidata(hObject, handles);
% — Executes on button press in pushbutton4.
function pushbutton4_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton4 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
handles = guidata(hObject);
[file,path] = uigetfile(‘*.txt’);
filename = [path file];
delimiter = ‘ ‘;
formatSpec = ‘%f%f%[^nr]’;
fileID = fopen(filename,’r’);
dataArray = textscan(fileID, formatSpec, ‘Delimiter’, delimiter, ‘MultipleDelimsAsOne’, true, ‘TextType’, ‘string’, ‘ReturnOnError’, false);
fclose(fileID);
handles.data = [dataArray{1:end-1}];
clearvars filename delimiter formatSpec fileID dataArray ans;
guidata(hObject, handles);
function edit12_Callback(hObject, eventdata, handles)
% hObject handle to edit12 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,’String’) returns contents of edit12 as text
% str2double(get(hObject,’String’)) returns contents of edit12 as a double
% — Executes during object creation, after setting all properties.
function edit12_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit12 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles empty – handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,’BackgroundColor’), get(0,’defaultUicontrolBackgroundColor’))
set(hObject,’BackgroundColor’,’white’);
end
function edit13_Callback(hObject, eventdata, handles)
% hObject handle to edit13 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,’String’) returns contents of edit13 as text
% str2double(get(hObject,’String’)) returns contents of edit13 as a double
% — Executes during object creation, after setting all properties.
function edit13_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit13 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles empty – handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,’BackgroundColor’), get(0,’defaultUicontrolBackgroundColor’))
set(hObject,’BackgroundColor’,’white’);
end error in reflectarray_gui_v2 (line 42) gui_mai MATLAB Answers — New Questions
Calculate normals from nodes which form a 3D curve
I have a composed cell:
in the first column: the P nodes;
in the second column: the circular geometries
in the third through fifth columns: the components a,b,c of the normal N of the circular geometry
Having other P nodes (see matrix ‘coord’) how can I calculate, for those nodes, the new components of the normal (a,b,c)?
load(‘test_p.mat’)
figure(‘units’,’normalized’,’outerposition’,[0 0 1 1]);
plot3(coord(:,1),coord(:,2),coord(:,3),’k.’,’Markersize’,5);
hold on
for t = 1:height(circle)
plot3(circle{t,1}(:,1),circle{t,1}(:,2),circle{t,1}(:,3),’k.’,’Markersize’,20);
patch(circle{t,2}(:,1),circle{t,2}(:,2),circle{t,2}(:,3),’k’,’FaceAlpha’,0.5);
end
hold off
axis equalI have a composed cell:
in the first column: the P nodes;
in the second column: the circular geometries
in the third through fifth columns: the components a,b,c of the normal N of the circular geometry
Having other P nodes (see matrix ‘coord’) how can I calculate, for those nodes, the new components of the normal (a,b,c)?
load(‘test_p.mat’)
figure(‘units’,’normalized’,’outerposition’,[0 0 1 1]);
plot3(coord(:,1),coord(:,2),coord(:,3),’k.’,’Markersize’,5);
hold on
for t = 1:height(circle)
plot3(circle{t,1}(:,1),circle{t,1}(:,2),circle{t,1}(:,3),’k.’,’Markersize’,20);
patch(circle{t,2}(:,1),circle{t,2}(:,2),circle{t,2}(:,3),’k’,’FaceAlpha’,0.5);
end
hold off
axis equal I have a composed cell:
in the first column: the P nodes;
in the second column: the circular geometries
in the third through fifth columns: the components a,b,c of the normal N of the circular geometry
Having other P nodes (see matrix ‘coord’) how can I calculate, for those nodes, the new components of the normal (a,b,c)?
load(‘test_p.mat’)
figure(‘units’,’normalized’,’outerposition’,[0 0 1 1]);
plot3(coord(:,1),coord(:,2),coord(:,3),’k.’,’Markersize’,5);
hold on
for t = 1:height(circle)
plot3(circle{t,1}(:,1),circle{t,1}(:,2),circle{t,1}(:,3),’k.’,’Markersize’,20);
patch(circle{t,2}(:,1),circle{t,2}(:,2),circle{t,2}(:,3),’k’,’FaceAlpha’,0.5);
end
hold off
axis equal normal, normals, 3d, 3d plots MATLAB Answers — New Questions
Parameter Estimation for a System of Differential Equations
Hello.
Ok, so I’m new to matlab and I’ve got a question regarding parameter estimation for a kinetic model.
I have 4 different reactants and their concentrations are c1, c2, c3 and c4. I also have 4 differential equations, each one related to a concentration (c1, c2, c3 and c4, respectively -see below-) and experimental data for all these concentrations on 12 different times plus the initial condition. The k’s are the rate coefficients. I want to solve this system of ODE’s using ode45 and then use the output to compute the experimental data minus the observed data and use these results to estimate the values of k’s using lsqnonlin, but apparently I can’t solve these ODE’s without numerical values for k -which is what I want to know-. Any help on how to set up the command to solve this?
function dcdt=batch(t,c,k)
dcdt=zeros(4,1);
dcdt(1)=-k(1)*c(1)-k(2)*c(1);
dcdt(2)= k(1)*c(1)+k(4)*c(3)-k(3)*c(2)-k(5)*c(2);
dcdt(3)= k(2)*c(1)+k(3)*c(2)-k(4)*c(3)+k(6)*c(4);
dcdt(4)= k(5)*c(2)-k(6)*c(4);
end
Data:
t c1 c2 c3 c4
0 1 0 0 0
0.1 0.902 0.06997 0.02463 0.00218
0.2 0.8072 0.1353 0.0482 0.008192
0.4 0.6757 0.2123 0.0864 0.0289
0.6 0.5569 0.2789 0.1063 0.06233
0.8 0.4297 0.3292 0.1476 0.09756
1 0.3774 0.3457 0.1485 0.1255
1.5 0.2149 0.3486 0.1821 0.2526
2 0.141 0.3254 0.194 0.3401
3 0.04921 0.2445 0.1742 0.5277
4 0.0178 0.1728 0.1732 0.6323
5 0.006431 0.1091 0.1137 0.7702
6 0.002595 0.08301 0.08224 0.835
Thanks in advance!Hello.
Ok, so I’m new to matlab and I’ve got a question regarding parameter estimation for a kinetic model.
I have 4 different reactants and their concentrations are c1, c2, c3 and c4. I also have 4 differential equations, each one related to a concentration (c1, c2, c3 and c4, respectively -see below-) and experimental data for all these concentrations on 12 different times plus the initial condition. The k’s are the rate coefficients. I want to solve this system of ODE’s using ode45 and then use the output to compute the experimental data minus the observed data and use these results to estimate the values of k’s using lsqnonlin, but apparently I can’t solve these ODE’s without numerical values for k -which is what I want to know-. Any help on how to set up the command to solve this?
function dcdt=batch(t,c,k)
dcdt=zeros(4,1);
dcdt(1)=-k(1)*c(1)-k(2)*c(1);
dcdt(2)= k(1)*c(1)+k(4)*c(3)-k(3)*c(2)-k(5)*c(2);
dcdt(3)= k(2)*c(1)+k(3)*c(2)-k(4)*c(3)+k(6)*c(4);
dcdt(4)= k(5)*c(2)-k(6)*c(4);
end
Data:
t c1 c2 c3 c4
0 1 0 0 0
0.1 0.902 0.06997 0.02463 0.00218
0.2 0.8072 0.1353 0.0482 0.008192
0.4 0.6757 0.2123 0.0864 0.0289
0.6 0.5569 0.2789 0.1063 0.06233
0.8 0.4297 0.3292 0.1476 0.09756
1 0.3774 0.3457 0.1485 0.1255
1.5 0.2149 0.3486 0.1821 0.2526
2 0.141 0.3254 0.194 0.3401
3 0.04921 0.2445 0.1742 0.5277
4 0.0178 0.1728 0.1732 0.6323
5 0.006431 0.1091 0.1137 0.7702
6 0.002595 0.08301 0.08224 0.835
Thanks in advance! Hello.
Ok, so I’m new to matlab and I’ve got a question regarding parameter estimation for a kinetic model.
I have 4 different reactants and their concentrations are c1, c2, c3 and c4. I also have 4 differential equations, each one related to a concentration (c1, c2, c3 and c4, respectively -see below-) and experimental data for all these concentrations on 12 different times plus the initial condition. The k’s are the rate coefficients. I want to solve this system of ODE’s using ode45 and then use the output to compute the experimental data minus the observed data and use these results to estimate the values of k’s using lsqnonlin, but apparently I can’t solve these ODE’s without numerical values for k -which is what I want to know-. Any help on how to set up the command to solve this?
function dcdt=batch(t,c,k)
dcdt=zeros(4,1);
dcdt(1)=-k(1)*c(1)-k(2)*c(1);
dcdt(2)= k(1)*c(1)+k(4)*c(3)-k(3)*c(2)-k(5)*c(2);
dcdt(3)= k(2)*c(1)+k(3)*c(2)-k(4)*c(3)+k(6)*c(4);
dcdt(4)= k(5)*c(2)-k(6)*c(4);
end
Data:
t c1 c2 c3 c4
0 1 0 0 0
0.1 0.902 0.06997 0.02463 0.00218
0.2 0.8072 0.1353 0.0482 0.008192
0.4 0.6757 0.2123 0.0864 0.0289
0.6 0.5569 0.2789 0.1063 0.06233
0.8 0.4297 0.3292 0.1476 0.09756
1 0.3774 0.3457 0.1485 0.1255
1.5 0.2149 0.3486 0.1821 0.2526
2 0.141 0.3254 0.194 0.3401
3 0.04921 0.2445 0.1742 0.5277
4 0.0178 0.1728 0.1732 0.6323
5 0.006431 0.1091 0.1137 0.7702
6 0.002595 0.08301 0.08224 0.835
Thanks in advance! parameter estimation, system of ode’s MATLAB Answers — New Questions
Passing File IDs from Power Apps to Power Automate and merging into PDF, then send an email
Hello,
I’m working on a PowerApps application that allows users to select specific files from a gallery (connected a sharepoint library), display them on a table for confirmation and then merge into a pdf to send to themselves. The process involves passing the IDs of the selected files from PowerApps to Power Automate, filtering the files based on these IDs, extracting the file content and merging them into a PDF.
I’m struggling with passing the IDs from Power Apps to automate. The flow reads the entire library (200+ items) instead of just the selected.
The configuration for my PowerApp button to call the flow is:
Hello, I’m working on a PowerApps application that allows users to select specific files from a gallery (connected a sharepoint library), display them on a table for confirmation and then merge into a pdf to send to themselves. The process involves passing the IDs of the selected files from PowerApps to Power Automate, filtering the files based on these IDs, extracting the file content and merging them into a PDF. I’m struggling with passing the IDs from Power Apps to automate. The flow reads the entire library (200+ items) instead of just the selected. The configuration for my PowerApp button to call the flow is:MergePDF.Run(Concat(SelectedItems, (ID),”,”);Notify(“Export process started. You will receive an email once complete.”, NotificationType.Success, 3000)). Please help ASAP!! Read More
Update formatting on Offer Listing
I want to update my already published offer with formatted text. During publishing, all the formatting and white space were stripped out.
I want to update my already published offer with formatted text. During publishing, all the formatting and white space were stripped out. Read More
PVA and Azure bot
Why Power Virtual Agent is better than Microsoft Azure Bot
A comparison of the features, offering and efficiency of two chatbot platforms
Chatbots are becoming more and more popular as a way to provide customer service, answer queries, and automate tasks. But how do you choose the right chatbot platform for your needs? In this blog post, we will compare two of the most popular chatbot platforms from Microsoft: Power Virtual Agent (PVA) and Azure Bot Service (ABS). We will look at their features, costs, and efficiency, and show you why PVA is a better choice for most scenarios.
Features
PVA and ABS both allow you to create chatbots that can interact with users through various channels, such as websites, mobile apps, social media, and Microsoft Teams. However, PVA has some advantages over ABS in terms of ease of use, functionality, and integration.
PVA is a low-code, no-code platform that lets you create chatbots using a graphical interface, without writing any code. You can design your chatbot’s conversation flow using a visual canvas, and use pre-built templates and entities to handle common scenarios. ABS, on the other hand, requires you to code your chatbot’s logic using C#, JavaScript, or Python, and use the Bot Framework SDK to build and deploy your chatbot. This means that you need to have some programming skills and knowledge of the SDK to use ABS.
PVA has a built-in natural language processing (NLP) engine that can understand user intents and entities, and handle complex and ambiguous user inputs. You can also train your chatbot to recognize custom intents and entities, and use synonyms and phrases to improve its accuracy. ABS does not have a native NLP engine, and you need to use a separate service, such as LUIS or QnA Maker ( integrated and called CLU now), to enable your chatbot to understand natural language. This adds another layer of complexity and cost to your chatbot development.
PVA has a seamless integration with Microsoft Power Platform, which is a suite of tools that can help you create and automate business solutions. You can easily connect your chatbot to Power Apps, Power Automate, Power BI, and Dataverse, and access data and actions from these services. You can also use Power Automate to create workflows and triggers for your chatbot, and use Dataverse to store and manage your chatbot’s data. ABS does not have a direct integration with Power Platform, and you need to use connectors and APIs to access data and actions from other services.
Extensive Pre-Built Connectors
Power Virtual Agents (PVA) stands out with its extensive collection of pre-built connectors, which significantly simplifies the process of integrating with various services and systems. PVA offers over 450 connectors, allowing users to easily connect their chatbots to a wide range of data sources and applications without the need for custom development1. This includes seamless integration with Microsoft Power Platform, enabling connections to Power Apps, Power Automate, Power BI, and Dataverse.
On the other hand, Azure Bot Service (ABS) does not come with a similar range of pre-built connectors. While ABS provides a robust framework for building and deploying chatbots, it requires users to develop custom connectors or use additional services like Logic Apps or Azure Functions to achieve similar integrations. This adds complexity and development effort, making PVA a more accessible and efficient choice for users who need quick and easy integrations.
Seamless Integration with Microsoft Ecosystem
Power Virtual Agents (PVA) offers seamless integration with the Microsoft ecosystem, making it an ideal choice for businesses that rely on Microsoft tools and services. PVA is designed to work effortlessly with the Microsoft Power Platform, which includes Power Apps, Power Automate, Power BI, and Dataverse. This integration allows users to create comprehensive business solutions by connecting their chatbots to various data sources and applications within the Microsoft ecosystem. For example, you can use Power Automate to create workflows and triggers for your chatbot, and Dataverse to store and manage your chatbot’s data.
On the other hand, Azure Bot Service (ABS) does not have the same level of seamless integration with the Microsoft ecosystem. While ABS provides a robust framework for building and deploying chatbots, it requires users to develop custom connectors or use additional services like Logic Apps or Azure Functions to achieve similar integrations. This adds complexity and development effort, making PVA a more accessible and efficient choice for users who need quick and easy integrations.
Efficiency
PVA and ABS both offer high-performance and scalable chatbot solutions that can handle large volumes of traffic and requests. However, PVA has some benefits over ABS in terms of speed, reliability, and maintenance.
PVA allows you to create and deploy chatbots in minutes, without any coding or infrastructure setup. You can use the PVA portal to design, test, and publish your chatbot, and monitor its performance and analytics. You can also update your chatbot’s content and logic at any time, without affecting its availability. ABS, on the other hand, requires you to code, build, and deploy your chatbot using the Bot Framework SDK and Azure services. This can take more time and effort, and you may encounter errors and bugs along the way. You also need to manage and update your chatbot’s code and dependencies, and ensure that your chatbot is compatible with the latest SDK and Azure versions.
PVA provides a reliable and secure chatbot platform that is hosted on Microsoft’s cloud infrastructure. You do not need to worry about the availability, scalability, or security of your chatbot, as Microsoft handles these aspects for you. You can also leverage Microsoft’s compliance and data protection policies, and choose the region where your chatbot’s data is stored and processed. ABS, on the other hand, gives you more control and flexibility over your chatbot’s infrastructure, but also more responsibility and risk. You need to configure and manage your chatbot’s hosting, scaling, and security settings, and ensure that your chatbot meets the compliance and data protection requirements of your region and industry.
In conclusion, PVA is a better choice than ABS for most chatbot scenarios, as it offers more features, lower costs, and higher efficiency. PVA is ideal for business users, non-developers, and anyone who wants to create chatbots quickly and easily, without coding or infrastructure hassles. ABS is more suitable for developers, advanced users, and anyone who wants to create chatbots with custom code and complex logic, and have more control and flexibility over their chatbot’s infrastructure.
Microsoft Tech Community – Latest Blogs –Read More
How do I plot an empty circle with no values in the middle of meshgrid plot3
Hi everyone.
Bascially I am tracking the depth of a surface using grids. x,y coordinates and z for depth. To fill the voids in between grids, I am using meshgrid with natural interpolation. However I have placed a circular piece in the middle of the grid hence on a plot3 it is supposed to be a white circular figue. How do I make sure this is drawn correctly because the image I attached does not look correct. Also how do I make sure that the meshgrid interpolates around the shape of the circle in the middle? This the code I have currently.
x = data(:,1); y = data(:,2); z = data(:,3)
x = table2array(x); y = table2array(y); z = table2array(z)
xlin = linspace(min(x), max(x), 100);
ylin = linspace(min(y), max(y), 100);
[X,Y] = meshgrid(xlin, ylin);
Z = griddata(x,y,z,X,Y,’natural’);
% Z = griddata(x,y,z,X,Y,’cubic’);
% Z = griddata(x,y,z,X,Y,’v4′);
mesh(X,Y,Z)
axis tight; hold on
plot3(x,y,z,’.’,’MarkerSize’,15)Hi everyone.
Bascially I am tracking the depth of a surface using grids. x,y coordinates and z for depth. To fill the voids in between grids, I am using meshgrid with natural interpolation. However I have placed a circular piece in the middle of the grid hence on a plot3 it is supposed to be a white circular figue. How do I make sure this is drawn correctly because the image I attached does not look correct. Also how do I make sure that the meshgrid interpolates around the shape of the circle in the middle? This the code I have currently.
x = data(:,1); y = data(:,2); z = data(:,3)
x = table2array(x); y = table2array(y); z = table2array(z)
xlin = linspace(min(x), max(x), 100);
ylin = linspace(min(y), max(y), 100);
[X,Y] = meshgrid(xlin, ylin);
Z = griddata(x,y,z,X,Y,’natural’);
% Z = griddata(x,y,z,X,Y,’cubic’);
% Z = griddata(x,y,z,X,Y,’v4′);
mesh(X,Y,Z)
axis tight; hold on
plot3(x,y,z,’.’,’MarkerSize’,15) Hi everyone.
Bascially I am tracking the depth of a surface using grids. x,y coordinates and z for depth. To fill the voids in between grids, I am using meshgrid with natural interpolation. However I have placed a circular piece in the middle of the grid hence on a plot3 it is supposed to be a white circular figue. How do I make sure this is drawn correctly because the image I attached does not look correct. Also how do I make sure that the meshgrid interpolates around the shape of the circle in the middle? This the code I have currently.
x = data(:,1); y = data(:,2); z = data(:,3)
x = table2array(x); y = table2array(y); z = table2array(z)
xlin = linspace(min(x), max(x), 100);
ylin = linspace(min(y), max(y), 100);
[X,Y] = meshgrid(xlin, ylin);
Z = griddata(x,y,z,X,Y,’natural’);
% Z = griddata(x,y,z,X,Y,’cubic’);
% Z = griddata(x,y,z,X,Y,’v4′);
mesh(X,Y,Z)
axis tight; hold on
plot3(x,y,z,’.’,’MarkerSize’,15) meshgrid, plot3 MATLAB Answers — New Questions
Help understanding how function handle is used
So I had an extremely helpful replier in an earlier question given me an equation for an interpolation function (I didn’t know about the floor and ceil function which would’ve answered my question and given me the opportunity to try writting the interpolation function myself, but I’m not going to look a gift horse in the mouth)
function fitness = interFt(Ft, x, j, k, t)
% Find the floor and ceiling for j and k
j_floor = floor(j);
j_ceil = ceil(j);
k_floor = floor(k);
k_ceil = ceil(k);
% Calculate probabilities based on the distance from the actual values
p_j_floor = j_ceil – j;
p_j_ceil = j – j_floor;
p_k_floor = k_ceil – k;
p_k_ceil = k – k_floor;
% Calculate the weighted fitness for each combination
fitness = 0;
fitness = fitness + p_j_floor * p_k_floor * Ft(x, j_floor, k_floor, t);
fitness = fitness + p_j_floor * p_k_ceil * Ft(x, j_floor, k_ceil, t);
fitness = fitness + p_j_ceil * p_k_floor * Ft(x, j_ceil, k_floor, t);
fitness = fitness + p_j_ceil * p_k_ceil * Ft(x, j_ceil, k_ceil, t);
end
They also gave me an example of how to use the function, but they used a function handle and i’m not sure how it’s being used
for tt=19:-1:1
for i=1:15
for j=1:15
for k=1:15
% here is a snipet of my code that I’m using with one of the
% examples of how I’m using the InterFt function; it’s set up
% exactly how the replier showed
state1 = interFt(@(x,j,k,t) Ft(x,j,k,t), xp(i),zp(j),yy(k),tt+1);
end
end
end
end
Why is Ft not included in the @()?
Why is it that when I change the x’s to i’s it messes things up (while also changing the x to an i in the written function)?
I know you’re not supposed to include the entire code, but let me know if that’s needed to see what I mean
Here is the link to the original question: https://www.mathworks.com/matlabcentral/answers/2119211-creating-a-function-for-linear-interpolation-based-on-two-changing-states?s_tid=srchtitle
[[I have a lot of code that I think has something wrong with it, and I think has to do with the states, but I’m not sure how I need to "fix" it]]So I had an extremely helpful replier in an earlier question given me an equation for an interpolation function (I didn’t know about the floor and ceil function which would’ve answered my question and given me the opportunity to try writting the interpolation function myself, but I’m not going to look a gift horse in the mouth)
function fitness = interFt(Ft, x, j, k, t)
% Find the floor and ceiling for j and k
j_floor = floor(j);
j_ceil = ceil(j);
k_floor = floor(k);
k_ceil = ceil(k);
% Calculate probabilities based on the distance from the actual values
p_j_floor = j_ceil – j;
p_j_ceil = j – j_floor;
p_k_floor = k_ceil – k;
p_k_ceil = k – k_floor;
% Calculate the weighted fitness for each combination
fitness = 0;
fitness = fitness + p_j_floor * p_k_floor * Ft(x, j_floor, k_floor, t);
fitness = fitness + p_j_floor * p_k_ceil * Ft(x, j_floor, k_ceil, t);
fitness = fitness + p_j_ceil * p_k_floor * Ft(x, j_ceil, k_floor, t);
fitness = fitness + p_j_ceil * p_k_ceil * Ft(x, j_ceil, k_ceil, t);
end
They also gave me an example of how to use the function, but they used a function handle and i’m not sure how it’s being used
for tt=19:-1:1
for i=1:15
for j=1:15
for k=1:15
% here is a snipet of my code that I’m using with one of the
% examples of how I’m using the InterFt function; it’s set up
% exactly how the replier showed
state1 = interFt(@(x,j,k,t) Ft(x,j,k,t), xp(i),zp(j),yy(k),tt+1);
end
end
end
end
Why is Ft not included in the @()?
Why is it that when I change the x’s to i’s it messes things up (while also changing the x to an i in the written function)?
I know you’re not supposed to include the entire code, but let me know if that’s needed to see what I mean
Here is the link to the original question: https://www.mathworks.com/matlabcentral/answers/2119211-creating-a-function-for-linear-interpolation-based-on-two-changing-states?s_tid=srchtitle
[[I have a lot of code that I think has something wrong with it, and I think has to do with the states, but I’m not sure how I need to "fix" it]] So I had an extremely helpful replier in an earlier question given me an equation for an interpolation function (I didn’t know about the floor and ceil function which would’ve answered my question and given me the opportunity to try writting the interpolation function myself, but I’m not going to look a gift horse in the mouth)
function fitness = interFt(Ft, x, j, k, t)
% Find the floor and ceiling for j and k
j_floor = floor(j);
j_ceil = ceil(j);
k_floor = floor(k);
k_ceil = ceil(k);
% Calculate probabilities based on the distance from the actual values
p_j_floor = j_ceil – j;
p_j_ceil = j – j_floor;
p_k_floor = k_ceil – k;
p_k_ceil = k – k_floor;
% Calculate the weighted fitness for each combination
fitness = 0;
fitness = fitness + p_j_floor * p_k_floor * Ft(x, j_floor, k_floor, t);
fitness = fitness + p_j_floor * p_k_ceil * Ft(x, j_floor, k_ceil, t);
fitness = fitness + p_j_ceil * p_k_floor * Ft(x, j_ceil, k_floor, t);
fitness = fitness + p_j_ceil * p_k_ceil * Ft(x, j_ceil, k_ceil, t);
end
They also gave me an example of how to use the function, but they used a function handle and i’m not sure how it’s being used
for tt=19:-1:1
for i=1:15
for j=1:15
for k=1:15
% here is a snipet of my code that I’m using with one of the
% examples of how I’m using the InterFt function; it’s set up
% exactly how the replier showed
state1 = interFt(@(x,j,k,t) Ft(x,j,k,t), xp(i),zp(j),yy(k),tt+1);
end
end
end
end
Why is Ft not included in the @()?
Why is it that when I change the x’s to i’s it messes things up (while also changing the x to an i in the written function)?
I know you’re not supposed to include the entire code, but let me know if that’s needed to see what I mean
Here is the link to the original question: https://www.mathworks.com/matlabcentral/answers/2119211-creating-a-function-for-linear-interpolation-based-on-two-changing-states?s_tid=srchtitle
[[I have a lot of code that I think has something wrong with it, and I think has to do with the states, but I’m not sure how I need to "fix" it]] interpolation, function handle MATLAB Answers — New Questions