Month: September 2024
Mouse hover in cell to display text LARGER code is very slow
The following code works fine on a small Range..
But when i expand the Range for the whole worksheet..it runs very very slow
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim x As Range
For Each x In Range(“B4:BI84”)
With x.Validation
.Delete
.Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop, _
Operator:=xlBetween
.IgnoreBlank = True
.InCellDropdown = True
.InputMessage = Target.Value ””First Name of Sales Rep”
.ShowError = True
End With
Next x
End Sub
The following code works fine on a small Range..But when i expand the Range for the whole worksheet..it runs very very slow Private Sub Worksheet_SelectionChange(ByVal Target As Range)Dim x As RangeFor Each x In Range(“B4:BI84″)With x.Validation.Delete.Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop, _Operator:=xlBetween.IgnoreBlank = True.InCellDropdown = True.InputMessage = Target.Value ””First Name of Sales Rep”.ShowError = TrueEnd WithNext xEnd Sub Read More
Why am I unable to start the Network License Manager on Linux?
Why do I receive one of the following errors when I try to launch the Network License Manager on Linux?
./lmgrd: Command not found.
/lib64/ld-lsb-x86-64.so.3: bad ELF interpreter: No such file or directory
MLM: can’t initialize: Invalid license file syntax. (-2,40027) EXITING DUE TO SIGNAL 52 Exit reason 20
eval: 1: /var/tmp/lm_TMW.ld: not found
Waiting 300 secs for MATLAB vendor daemon to come up . . .
Type your interrupt character (usually CTRL-C) to quit.
Time = 3 secs : still waiting . . .
/usr/local/MATLAB/R2024a/etc/glnxa64/lmhostid: not found
Error: Your hostname matches the hostname on a SERVER line in
your license file but the lmhostid in that line does not.
Your local lmhostid(s) are:
Your hostname is: licserver1.support.mathworks.com
The SERVER line in question is:
———————————————–
SERVER licserver1.support.mathworks.com 001122DDEE99 27000
———————————————–
Please stop, fix the problem, and try again . . .Why do I receive one of the following errors when I try to launch the Network License Manager on Linux?
./lmgrd: Command not found.
/lib64/ld-lsb-x86-64.so.3: bad ELF interpreter: No such file or directory
MLM: can’t initialize: Invalid license file syntax. (-2,40027) EXITING DUE TO SIGNAL 52 Exit reason 20
eval: 1: /var/tmp/lm_TMW.ld: not found
Waiting 300 secs for MATLAB vendor daemon to come up . . .
Type your interrupt character (usually CTRL-C) to quit.
Time = 3 secs : still waiting . . .
/usr/local/MATLAB/R2024a/etc/glnxa64/lmhostid: not found
Error: Your hostname matches the hostname on a SERVER line in
your license file but the lmhostid in that line does not.
Your local lmhostid(s) are:
Your hostname is: licserver1.support.mathworks.com
The SERVER line in question is:
———————————————–
SERVER licserver1.support.mathworks.com 001122DDEE99 27000
———————————————–
Please stop, fix the problem, and try again . . . Why do I receive one of the following errors when I try to launch the Network License Manager on Linux?
./lmgrd: Command not found.
/lib64/ld-lsb-x86-64.so.3: bad ELF interpreter: No such file or directory
MLM: can’t initialize: Invalid license file syntax. (-2,40027) EXITING DUE TO SIGNAL 52 Exit reason 20
eval: 1: /var/tmp/lm_TMW.ld: not found
Waiting 300 secs for MATLAB vendor daemon to come up . . .
Type your interrupt character (usually CTRL-C) to quit.
Time = 3 secs : still waiting . . .
/usr/local/MATLAB/R2024a/etc/glnxa64/lmhostid: not found
Error: Your hostname matches the hostname on a SERVER line in
your license file but the lmhostid in that line does not.
Your local lmhostid(s) are:
Your hostname is: licserver1.support.mathworks.com
The SERVER line in question is:
———————————————–
SERVER licserver1.support.mathworks.com 001122DDEE99 27000
———————————————–
Please stop, fix the problem, and try again . . . MATLAB Answers — New Questions
Swarmchart maximum diplay for shapley?
I will draw a shapey model with Swarmchart. When I draw it, it shows a maximum of 10 predictors on the right axis. How can I increase it to 20?
Example;
swarmchart(explainer,’Class’,1)I will draw a shapey model with Swarmchart. When I draw it, it shows a maximum of 10 predictors on the right axis. How can I increase it to 20?
Example;
swarmchart(explainer,’Class’,1) I will draw a shapey model with Swarmchart. When I draw it, it shows a maximum of 10 predictors on the right axis. How can I increase it to 20?
Example;
swarmchart(explainer,’Class’,1) swarmchart, shapley MATLAB Answers — New Questions
I have a ECG signal along with a respiration signal, I need to filter it to separate the ECG and the Respiration signals. Also, extract the QRS complex from the filtered ECG.
I have a ECG signal along with a respiration signal, I need to filter it to separate the ECG and the Respiration signals. I can apply a FIR/IIR filter or any appropriate method. Also, i need to extract the QRS complex from the filtered ECG. I have attachted the code that I use to filter the signal extract the QRS complex but the results are not satisfying.I have a ECG signal along with a respiration signal, I need to filter it to separate the ECG and the Respiration signals. I can apply a FIR/IIR filter or any appropriate method. Also, i need to extract the QRS complex from the filtered ECG. I have attachted the code that I use to filter the signal extract the QRS complex but the results are not satisfying. I have a ECG signal along with a respiration signal, I need to filter it to separate the ECG and the Respiration signals. I can apply a FIR/IIR filter or any appropriate method. Also, i need to extract the QRS complex from the filtered ECG. I have attachted the code that I use to filter the signal extract the QRS complex but the results are not satisfying. filter, ecg, qrs complex MATLAB Answers — New Questions
Shortcut set for “evaluate selection” not working / responding in Matlab 2022b Update 4
I got o Preferences > Keyboard > Shortcuts and modify the shortcut for ‘Evaluate Selection’ to e.g., command + <.
However, after accepting changes, selecting code in the editor or command window and pressing command + < (or any other attempted shortcut) won’t work.
Any help would be welcome, thank you.I got o Preferences > Keyboard > Shortcuts and modify the shortcut for ‘Evaluate Selection’ to e.g., command + <.
However, after accepting changes, selecting code in the editor or command window and pressing command + < (or any other attempted shortcut) won’t work.
Any help would be welcome, thank you. I got o Preferences > Keyboard > Shortcuts and modify the shortcut for ‘Evaluate Selection’ to e.g., command + <.
However, after accepting changes, selecting code in the editor or command window and pressing command + < (or any other attempted shortcut) won’t work.
Any help would be welcome, thank you. shortcuts, evaluate, selection MATLAB Answers — New Questions
Partition order
Hello,
could you rearrange the partitions ?
please please please !
When we want to expand partition C, we can’t because we have the recovery partition on the right.
We have to use a third party tool or diskpart with partitions in the right order………..
Hello,could you rearrange the partitions ?please please please !When we want to expand partition C, we can’t because we have the recovery partition on the right.We have to use a third party tool or diskpart with partitions in the right order……….. Read More
Sentinel – Analytic template – MFA Rejected by User
Hi, we are having a few issues with the Sentinel templated analytic rule – MFA Rejected by User (version 2.0.3) – https://github.com/Azure/Azure-Sentinel/blob/master/Solutions/Microsoft%20Entra%20ID/Analytic%20Rules/MFARejectedbyUser.yaml
Over the last 30 days this analytic rule has generated 98 incidents which are all false positives.
The analytic rule works on looking at Entra ID signinlogs against result type 500121 with one or more of the following additional details reported “MFA denied; user declined the authentication” or “fraud”.
It maps UEBA identity information then join the behavior analytics data summarised by IP Address. It’s the summarising of the IP address data which has me questioning the code.
When we get an event in the signin logs it also generates an event in the UEBA behavior analytic table along with a IP investigation score. If you have multiple events in the time period of the rules query period then the summarizing does a SUM() against the IP investigation data which can turn into a high which breaches the threshold.
The default threshold is 20 but I have seen IP investigation scores summed again being between 60 and 100+ but the individual event record for the MFA rejection gives a score of 3 or 4.
Anyone an expert with UEBA and KQL be able to tell me if the original code looks ok? – https://github.com/Azure/Azure-Sentinel/blob/master/Solutions/Microsoft%20Entra%20ID/Analytic%20Rules/MFARejectedbyUser.yaml
Would to be better served by the following code?
let riskScoreCutoff = 20; //Adjust this based on volume of results
SigninLogs
| where ResultType == 500121
| extend additionalDetails_ = tostring(Status.additionalDetails)
| extend UserPrincipalName = tolower(UserPrincipalName)
| where additionalDetails_ =~ “MFA denied; user declined the authentication” or additionalDetails_ has “fraud”
| summarize StartTime = min(TimeGenerated), EndTime = max(TimeGenerated), UserId = any(UserId), AADTenantId=any(AADTenantId), DeviceName=any(DeviceDetail.displayName), IsManaged=any(DeviceDetail.isManaged), OS = any(DeviceDetail.operatingSystem) by UserPrincipalName, IPAddress, AppDisplayName
| extend Name = tostring(split(UserPrincipalName,’@’,0)[0]), UPNSuffix = tostring(split(UserPrincipalName,’@’,1)[0])
| join kind=leftouter (
IdentityInfo
| summarize LatestReportTime = arg_max(TimeGenerated, *) by AccountUPN
| project AccountUPN, Tags, JobTitle, GroupMembership, AssignedRoles, UserType, IsAccountEnabled
| summarize
Tags = make_set(Tags, 1000),
GroupMembership = make_set(GroupMembership, 1000),
AssignedRoles = make_set(AssignedRoles, 1000),
UserType = make_set(UserType, 1000),
UserAccountControl = make_set(UserType, 1000)
by AccountUPN
| extend UserPrincipalName=tolower(AccountUPN)
) on UserPrincipalName
| join kind=leftouter (
BehaviorAnalytics
| where ActivityType in (“FailedLogOn”, “LogOn”)
| where isnotempty(SourceIPAddress)
| project UsersInsights, DevicesInsights, ActivityInsights, InvestigationPriority, SourceIPAddress
| project-rename IPAddress = SourceIPAddress
| summarize
UsersInsights = make_set(UsersInsights, 1000),
DevicesInsights = make_set(DevicesInsights, 1000)
//IPInvestigationPriority = tostring(InvestigationPriority)
by IPAddress, IPInvestigationPriority=InvestigationPriority)
on IPAddress
| extend UEBARiskScore = IPInvestigationPriority
| where UEBARiskScore > riskScoreCutoff
| sort by UEBARiskScore desc
Hi, we are having a few issues with the Sentinel templated analytic rule – MFA Rejected by User (version 2.0.3) – https://github.com/Azure/Azure-Sentinel/blob/master/Solutions/Microsoft%20Entra%20ID/Analytic%20Rules/MFARejectedbyUser.yaml Over the last 30 days this analytic rule has generated 98 incidents which are all false positives. The analytic rule works on looking at Entra ID signinlogs against result type 500121 with one or more of the following additional details reported “MFA denied; user declined the authentication” or “fraud”. It maps UEBA identity information then join the behavior analytics data summarised by IP Address. It’s the summarising of the IP address data which has me questioning the code. When we get an event in the signin logs it also generates an event in the UEBA behavior analytic table along with a IP investigation score. If you have multiple events in the time period of the rules query period then the summarizing does a SUM() against the IP investigation data which can turn into a high which breaches the threshold. The default threshold is 20 but I have seen IP investigation scores summed again being between 60 and 100+ but the individual event record for the MFA rejection gives a score of 3 or 4. Anyone an expert with UEBA and KQL be able to tell me if the original code looks ok? – https://github.com/Azure/Azure-Sentinel/blob/master/Solutions/Microsoft%20Entra%20ID/Analytic%20Rules/MFARejectedbyUser.yaml Would to be better served by the following code? let riskScoreCutoff = 20; //Adjust this based on volume of resultsSigninLogs| where ResultType == 500121| extend additionalDetails_ = tostring(Status.additionalDetails)| extend UserPrincipalName = tolower(UserPrincipalName)| where additionalDetails_ =~ “MFA denied; user declined the authentication” or additionalDetails_ has “fraud”| summarize StartTime = min(TimeGenerated), EndTime = max(TimeGenerated), UserId = any(UserId), AADTenantId=any(AADTenantId), DeviceName=any(DeviceDetail.displayName), IsManaged=any(DeviceDetail.isManaged), OS = any(DeviceDetail.operatingSystem) by UserPrincipalName, IPAddress, AppDisplayName| extend Name = tostring(split(UserPrincipalName,’@’,0)[0]), UPNSuffix = tostring(split(UserPrincipalName,’@’,1)[0])| join kind=leftouter (IdentityInfo| summarize LatestReportTime = arg_max(TimeGenerated, *) by AccountUPN| project AccountUPN, Tags, JobTitle, GroupMembership, AssignedRoles, UserType, IsAccountEnabled| summarizeTags = make_set(Tags, 1000),GroupMembership = make_set(GroupMembership, 1000),AssignedRoles = make_set(AssignedRoles, 1000),UserType = make_set(UserType, 1000),UserAccountControl = make_set(UserType, 1000)by AccountUPN| extend UserPrincipalName=tolower(AccountUPN)) on UserPrincipalName| join kind=leftouter (BehaviorAnalytics| where ActivityType in (“FailedLogOn”, “LogOn”)| where isnotempty(SourceIPAddress)| project UsersInsights, DevicesInsights, ActivityInsights, InvestigationPriority, SourceIPAddress| project-rename IPAddress = SourceIPAddress| summarizeUsersInsights = make_set(UsersInsights, 1000),DevicesInsights = make_set(DevicesInsights, 1000)//IPInvestigationPriority = tostring(InvestigationPriority)by IPAddress, IPInvestigationPriority=InvestigationPriority)on IPAddress| extend UEBARiskScore = IPInvestigationPriority| where UEBARiskScore > riskScoreCutoff| sort by UEBARiskScore desc Read More
IF, AND, OR Formula Help
2.5 2.5ModifierModifierHQUPHQUN
Hello! So I have a spreadsheet I use for invoicing and depending on which box I input the hours in (2.5), determines what modifier I need to use (UP or UN). So I was wondering if anyone could help me generate a formula that if I input tie in the upper box it returns the value of UP or if there is a value in the lower box it would return the value of UN and if there is no value, it would just remain empty.
Thank You!
2.5 2.5ModifierModifierHQUPHQUN Hello! So I have a spreadsheet I use for invoicing and depending on which box I input the hours in (2.5), determines what modifier I need to use (UP or UN). So I was wondering if anyone could help me generate a formula that if I input tie in the upper box it returns the value of UP or if there is a value in the lower box it would return the value of UN and if there is no value, it would just remain empty. Thank You! Read More
Web content plug-in management in M365 Copilot
Hi,
Referring to this announcement MC882258 in message center, MS informed that web content plug-in management will be removed from M365 admin center, rather it will be managed as part of Optional Connected Experience for M365.
We have currently disabled this web content plug-in in our environment but allowed Optional Connected Exp for the users. After this announced change, how web content plug-in will behave? Will it enabled because we have Optional connected exp. enabled? Secondly, what is the reason behind this change? Why MS has taken individual control setting away and mixed it with so many optional connected exp. where we do not have an option to choose which optional connected exp. we want to enable/disable. Its like all or nothing.
Hi,Referring to this announcement MC882258 in message center, MS informed that web content plug-in management will be removed from M365 admin center, rather it will be managed as part of Optional Connected Experience for M365.We have currently disabled this web content plug-in in our environment but allowed Optional Connected Exp for the users. After this announced change, how web content plug-in will behave? Will it enabled because we have Optional connected exp. enabled? Secondly, what is the reason behind this change? Why MS has taken individual control setting away and mixed it with so many optional connected exp. where we do not have an option to choose which optional connected exp. we want to enable/disable. Its like all or nothing. Read More
Error loading CoPilot for Sales in Teams and Outlook
We are facing this issue when I try to use copilot for sales.
The error message is this: Microsoft.SalesProductivity.ServiceFramework.SPServiceCustomErrorCode.ConnectionIdDeletedInPA,
We are facing this issue when I try to use copilot for sales.The error message is this: Microsoft.SalesProductivity.ServiceFramework.SPServiceCustomErrorCode.ConnectionIdDeletedInPA, Read More
M365 mobile app and Copilot
Can someone please explain how Copilot option present in Microsoft 365 mobile app relates to Copilot for M365? We have currently disabled the web content plugin in Copilot settings and also disabled copilot for Bing, Edge and Windows via MS provided PS script but still Copilot option is available in the M365 mobile app. When i did some tests, I can copy paste the content from other Intune managed apps e.g. from Outlook to this Copilot prompt in M365 app (which is also Intune managed) and the other way around also. Ideally this copy paste content should be possible because both the apps (M365 app and Outlook app) are organization managed but if we look at Copilot there, then its not the Copilot for M365 isn’t it? It shows the icon of Commercial Data Protection in chat interface and also it does not search the data from organization resources. So can we somehow disable this Copilot option in M365 app or block copy paste data from other Intune managed apps? Any ideas or views on this?
Can someone please explain how Copilot option present in Microsoft 365 mobile app relates to Copilot for M365? We have currently disabled the web content plugin in Copilot settings and also disabled copilot for Bing, Edge and Windows via MS provided PS script but still Copilot option is available in the M365 mobile app. When i did some tests, I can copy paste the content from other Intune managed apps e.g. from Outlook to this Copilot prompt in M365 app (which is also Intune managed) and the other way around also. Ideally this copy paste content should be possible because both the apps (M365 app and Outlook app) are organization managed but if we look at Copilot there, then its not the Copilot for M365 isn’t it? It shows the icon of Commercial Data Protection in chat interface and also it does not search the data from organization resources. So can we somehow disable this Copilot option in M365 app or block copy paste data from other Intune managed apps? Any ideas or views on this? Read More
DFE Web Protection vs Smartscreen for Edge IOS
Scenario I have is fully enrolled corp managed IOS devices I need to enable smart screen for edge automatically and make sure the user can’t turn it off. Problem 1 is I can’t seem to find a way to do that, problem 2 is trying to find the differences between smart screen and DFE web protection. Ultimately I want the SS protection of a nice “this site was blocked” type message to satisfy my cyber guys. Does web protection pop anything similar? or just block a malicious site? Any assistance or experience gratefully received
Scenario I have is fully enrolled corp managed IOS devices I need to enable smart screen for edge automatically and make sure the user can’t turn it off. Problem 1 is I can’t seem to find a way to do that, problem 2 is trying to find the differences between smart screen and DFE web protection. Ultimately I want the SS protection of a nice “this site was blocked” type message to satisfy my cyber guys. Does web protection pop anything similar? or just block a malicious site? Any assistance or experience gratefully received Read More
Empowering HLS Business Leaders with Copilot for M365
You’re invited to Microsoft’s Chicago Office or Virtually
Join us in person or virtually with experts from Microsoft and Accenture for an immersive and interactive session to show how Copilot for Microsoft 365 will empower an entirely new way of working. Discover how this cutting-edge AI technology is bringing the power of next-generation AI to work and transforming the way how your organization does business.
Hear from industry experts including Dr. Tej Shah, Managing Director at Accenture, and many other healthcare technology thought leaders as they share best practices and innovation case studies they are seeing across the globe
Attendance in person is limited to 25 people only. Reserve your seat today and enjoy complimentary lunch and exclusive swag!
Sessions include:
Executive Opening
The Future of Healthcare
Introducing Copilot for M365
Copilot Overview
Voice of our customers
Empowering HLS Business Leaders with Copilot for M365
October 3rd | 9:30 AM – 2:00 PM CST
Microsoft Chicago Office
200 East Randolph Drive, Suite 200, Chicago, IL 60601
Schedule
9:30 am – 10:00 am
Registration, Check-in, and Continental Breakfast
10:00 am – 10:15 am
Executive Keynote Introduction by Jesse Washington
10:15 am – 11:00 am
The Future of Healthcare & Q&A by Dr. Tej Shah
11:00 am – 11:30 pm
Introducing Copilot for Microsoft 365
11:30 pm – 12:00 pm
Lunch & Networking
12:00 pm – 12:30 pm
Copilot for M365 Overview – Why Copilot
12:30 pm – 1:00 pm
See Copilot for Microsoft 365 in Action with HLS-Specific Use Cases
1:00 pm – 1:30 pm
Voice of the customer – Panel Discussion
1:30 pm – 1:45 pm
Closing & Thank You
Microsoft Tech Community – Latest Blogs –Read More
Learn about a AXImprove’s Microsoft 365 partner solution in Microsoft AppSource
Microsoft 365 lets you create, share, and collaborate all in one place with your favorite apps. Learn about an offer from AXImprove, a high-performing partner on Microsoft AppSource:
ConfigCompare: Gain an unprecedented level of control over system configurations in Microsoft Dynamics 365 Finance and Supply Chain Management with ConfigCompare. This solution from AXImprove identifies configuration differences between environments as they evolve with changing business requirements, helping manage costs while enabling enhanced governance, improved change management, accelerated issue resolution, and more.
Microsoft Tech Community – Latest Blogs –Read More
n-way anova with 2 seperate group and 2 seperate data
Hi
Need a help with n-way anova. I’ve got exel table where A and B git values 0 – user incorrect answer and 1 – correct answer, and the labels to them like below:
A = [1 0 1 0 0 1 0]
B = [1 1 0 0 1 1 1]
LabelsA = [red blue white white white blue red]
LabelsB = [high medium medium high low low high]
And now, using the data I need to use anova to create table and multicompare of the stats to see: probability of the case A. Probability of the case 2 and probability A*B.
Additionally i need to draw the all variances probability like: x1 = red x2 = high, x1 = red x2 = medium … x1 = white, x2 = low. so 9 pairs
Tried anova2 but i cannot do all of the variances with groups. Tried anovan but i can input in there only wektor of the data
Would be grateful for any tip.Hi
Need a help with n-way anova. I’ve got exel table where A and B git values 0 – user incorrect answer and 1 – correct answer, and the labels to them like below:
A = [1 0 1 0 0 1 0]
B = [1 1 0 0 1 1 1]
LabelsA = [red blue white white white blue red]
LabelsB = [high medium medium high low low high]
And now, using the data I need to use anova to create table and multicompare of the stats to see: probability of the case A. Probability of the case 2 and probability A*B.
Additionally i need to draw the all variances probability like: x1 = red x2 = high, x1 = red x2 = medium … x1 = white, x2 = low. so 9 pairs
Tried anova2 but i cannot do all of the variances with groups. Tried anovan but i can input in there only wektor of the data
Would be grateful for any tip. Hi
Need a help with n-way anova. I’ve got exel table where A and B git values 0 – user incorrect answer and 1 – correct answer, and the labels to them like below:
A = [1 0 1 0 0 1 0]
B = [1 1 0 0 1 1 1]
LabelsA = [red blue white white white blue red]
LabelsB = [high medium medium high low low high]
And now, using the data I need to use anova to create table and multicompare of the stats to see: probability of the case A. Probability of the case 2 and probability A*B.
Additionally i need to draw the all variances probability like: x1 = red x2 = high, x1 = red x2 = medium … x1 = white, x2 = low. so 9 pairs
Tried anova2 but i cannot do all of the variances with groups. Tried anovan but i can input in there only wektor of the data
Would be grateful for any tip. anova, n-way anova, statistics, probability, ranova, matlab, anova2 MATLAB Answers — New Questions
Unable to get a continuous curvature for my nozzle contour
Greetings everyone, I am trying to fit a Bezier Curve as shown in the paper provide(fig1), but I am unable to get the desired plot(fig 2 and fig3). I have attached the codes as well as the paper and plot. Any help on this is highly appreciated!.
PS: The inflection point is the last point on xarc, i.e, xarc(end) and Nozzle_WithCircARc.m is the main file. It would be better to run the file cell by cell.
%function Nozzle_WithCircARc(G,Me,n,display)
%% Initialize datapoint matrices
clearvars;close all;clc;
G=1.4;
Me = 2.0;
n = 53; % speed index from pucketts paper
display = 0;
Km = zeros(n,n); % K- vlaues (Constant along right running characteristic lines)
Kp = zeros(n,n); % K+ vlaues (Constant along left running characteristic lines)
Theta = zeros(n,n); % Flow angles relative to the horizontal
Mu = zeros(n,n); % Mach angles
M = zeros(n,n); % Mach Numbers
x = zeros(n,n); % x-coordinates
y = zeros(n,n); % y-coordinates
%% Generate the convergent portion of a nozzle
% The inlet height/area and exit height/area(divergent) are same
% Therefore we have same A/A* = 1.6875
% Corresponding to Mach = 0.3722
%% Find NuMax (maximum expansion angle)
[~, NuMax, ~] = PMF(G,Me,0,0);
ThetaMax = NuMax/2;
%%
%ThetaMax0 = (1.0/1.687)^(2/9) * (NuMax/2);
%% Define some flow parameters of originating characteristic lines
dT = ThetaMax/n;
%no_ref = (ThetaMax – ThetaMax_ref)/dT;
ThetaArc(:,1) = (0:dT:ThetaMax);
NuArc = ThetaArc;
KmArc = ThetaArc + NuArc;
[~, ~, MuArc(:,1)] = PMF(G,0,NuArc(:,1),0);
%% Coordinates of wall along curve from throat
y0 = 1; % Define throat half-height
ThroatCurveRadius = 1.5*y0; % Radius of curvature just downstream of the throat
% for larger factors, ywall deviates from A/A* preferred value is 1.1
%L_e = 1.1 * y0 * sind(ThetaMax);
[xarc, yarc] = Arc(ThroatCurveRadius,ThetaArc); % Finds x- and y-coordinates for given theta-values
yarc(:,1) = yarc(:,1) + y0; % Defines offset due to arc being above horizontal
%% Fill in missing datapoint info along first C+ line
% First centerline datapoint done manually
Km(:,1) = KmArc(2:length(KmArc),1);
Theta(:,1) = ThetaArc(2:length(KmArc),1);
Nu(:,1) = Theta(:,1);
Kp(:,1) = Theta(:,1)-Nu(:,1);
M(1,1) = 1.0001;
Nu(1,1) = 0;
Mu(1,1) = 90;
y(1,1) = 0;
x(1,1) = xarc(2,1) + (y(1,1) – yarc(2,1))/tand((ThetaArc(2,1) – MuArc(2,1) – MuArc(2,1))/2);
% Finds the information at interior nodes along first C+ line
for i=2:n
[M(i,1), Nu(i,1), Mu(i,1)] = PMF(G,0,Nu(i,1),0);
s1 = tand((ThetaArc(i+1,1) – MuArc(i+1,1) + Theta(i,1) – Mu(i,1))/2);
s2 = tand((Theta(i-1,1) + Mu(i-1,1) + Theta(i,1) + Mu(i,1))/2);
x(i,1) = ((y(i-1,1)-x(i-1,1)*s2)-(yarc(i+1,1)-xarc(i+1,1)*s1))/(s1-s2);
y(i,1) = y(i-1,1) + (x(i,1)-x(i-1,1))*s2;
end
%% Find flow properties at remaining interior nodes
for j=2:n;
for i=1:n+1-j;
Km(i,j) = Km(i+1,j-1);
if i==1;
Theta(i,j) = 0;
Kp(i,j) = -Km(i,j);
Nu(i,j) = Km(i,j);
[M(i,j), Nu(i,j), Mu(i,j)] = PMF(G,0,Nu(i,j),0);
s1 = tand((Theta(i+1,j-1)-Mu(i+1,j-1)+Theta(i,j)-Mu(i,j))/2);
x(i,j) = x(i+1,j-1) – y(i+1,j-1)/s1;
y(i,j) = 0;
else
Kp(i,j) = Kp(i-1,j);
Theta(i,j) = (Km(i,j)+Kp(i,j))/2;
Nu(i,j) = (Km(i,j)-Kp(i,j))/2;
[M(i,j), Nu(i,j), Mu(i,j)] = PMF(G,0,Nu(i,j),0);
s1 = tand((Theta(i+1,j-1)-Mu(i+1,j-1)+Theta(i,j)-Mu(i,j))/2);
s2 = tand((Theta(i-1,j)+Mu(i-1,j)+Theta(i,j)+Mu(i,j))/2);
x(i,j) = ((y(i-1,j)-x(i-1,j)*s2)-(y(i+1,j-1)-x(i+1,j-1)*s1))/(s1-s2);
y(i,j) = y(i-1,j) + (x(i,j)-x(i-1,j))*s2;
end
end
end
%% Find wall node information
xwall = zeros(2*n,1);
ywall = xwall;
ThetaWall = ywall;
xwall(1:n,1) = xarc(2:length(xarc),1);
ywall(1:n,1) = yarc(2:length(xarc),1);
ThetaWall(1:n,1) = ThetaArc(2:length(xarc),1);
for i=1:n-1
ThetaWall(n+i,1) = ThetaWall(n-i,1); % criteria for stopping the reflection from the wall
end
%% Location of wall points
for i=1:n
s1 = tand((ThetaWall(n+i-1,1) + ThetaWall(n+i,1))/2);
s2 = tand(Theta(n+1-i,i)+Mu(n+1-i,i));
xwall(n+i,1) = ((y(n+1-i,i)-x(n+1-i,i)*s2)-(ywall(n+i-1,1)-xwall(n+i-1,1)*s1))/(s1-s2);
ywall(n+i,1) = ywall(n+i-1,1) + (xwall(n+i,1)-xwall(n+i-1,1))*s1;
end
%% Provide wall geometry to user
assignin(‘caller’,’xwall’,xwall)
assignin(‘caller’,’ywall’,ywall)
assignin(‘caller’,’Coords’,[xwall ywall])
%% Generate the convergent portion of nozzle
H_in = ywall(end);
L_e = (xwall(end)*(1.0/3.0));
[xconv,yconv] = Convergent_new_3rd(y0,H_in,L_e,n);
%%
% Draw contour and characteristic web
if display == 1
plot(xwall,ywall,’-‘)
axis equal
axis([0 ceil(xwall(length(xwall),1)) 0 ceil(ywall(length(ywall),1))])
hold on
plot(xarc,yarc,’k-‘)
for i=1:n-1
plot(x(1:n+1-i,i),y(1:n+1-i,i))
end
for i=1:n
plot([xarc(i,1) x(i,1)],[yarc(i,1) y(i,1)])
plot([x(n+1-i,i) xwall(i+n,1)],[y(n+1-i,i) ywall(i+n,1)])
end
for c=1:n
for r=2:n+1-c
plot([x(c,r) x(c+1,r-1)],[y(c,r) y(c+1,r-1)])
end
end
%hold on
%contourf(x, y, M, 20, ‘LineColor’, ‘none’); % Draw Mach number contours
%colorbar;
xlabel(‘Length [x/y0]’)
ylabel(‘Height [y/y0]’)
end
%% Non-scaled/non-dimensionalized plot
figure (1)
plot(xwall,ywall,’.b’)
title("Non dimensionalized plot")
axis equal
hold on
plot(xarc,yarc,’-‘)
hold on
plot(xconv,yconv,’-‘)
xlabel(‘xwall’)
ylabel(‘ywall’)
axis equal
%%
%{
plot(xwall,ThetaWall)
xlabel(‘xwall’)
ylabel(‘ThetaWall’)
%%
x1 = linspace(min(xwall),max(xwall),1000);
%y1 = spline(xw,yw,x1);
y1 = interp1(xwall,ywall,x1,’spline’);
figure;
title(‘Subplot 2: Cubic spline interpolation’)
plot(x1,y1,’r’)
%}
%%
%{
for i = 1:length(M)
M_centerline(i) = M(1,i);
end
for i =1:length(x)
x_axial(i) = x(1,i);
end
plot(x_axial’, Mcenterline’,’r’,’LineWidth’,2)
%}
%% Find the scaling factor
Mexit = Me;
[~,~,~,~,area] = flowisentropic(G,Mexit);
Hexit = 11.2798; %mm
Full_Throat_height = Hexit/area;
half_yt = Full_Throat_height/2.0;
%% Scaling of factors
xarc = half_yt.*xarc;
yarc = half_yt.*yarc;
xwall = half_yt.*xwall;
ywall = half_yt.*ywall;
xconv = half_yt.*xconv;
yconv = half_yt.*yconv;
%% Scaled up coordinates in mm
%{
title("Dimensionalized Plot")
plot(xwall,ywall,’-‘)
hold on
plot(xarc,yarc,’-‘)
hold on
plot(xconv,yconv,’-‘)
xlabel(‘xwall’)
ylabel(‘ywall’)
axis equal
%}
%% Combine Coordinates
% Combine xconv and xwall
coords_new_x = [xconv; xwall];
coords_new_y = [yconv; ywall];
%%
figure (2)
hold on;
plot(xconv, yconv, ‘.b’, ‘LineWidth’, 1.5) % Convergent section
plot(xwall, ywall, ‘.r’, ‘LineWidth’, 1.5) % Wall section
plot(xarc,yarc,’.g’,’LineWidth’,1.5) % arc
plot(xconv, -1.*yconv, ‘.b’, ‘LineWidth’, 1.5) % Convergent section
plot(xwall, -1.*ywall, ‘.r’, ‘LineWidth’, 1.5) % Wall section
plot(xarc,-1.*yarc,’.g’,’LineWidth’,1.5) % arc
xlabel(‘x [mm]’);
ylabel(‘y [mm]’);
title(‘Scaled up CD nozzle’);
legend(‘Convergent Section’, ‘Straightening Section’, ‘Initial Expansion (Arc)’);
grid on;
axis equal
%% Export coordinates
x1 = linspace(min(coords_new_x ),max(coords_new_x),1000);
%y1 = spline(xw,yw,x1);
y1 = interp1(coords_new_x,coords_new_y,x1,’spline’);
x2 = x1′;
y2 = y1′;
%figure;
%plot(x1,y1,’r’)
%writematrix(x2,’Spline.xlsx’,’Sheet’,1,’Range’,’A1′);
%writematrix(y2,’Spline.xlsx’,’Sheet’,1,’Range’,’B1′);
%%
%{
plot(x2,y2)
%%
plot(xwall,ywall,’-‘)
axis equal
axis([0 ceil(xwall(length(xwall),1)) 0 ceil(ywall(length(ywall),1))])
hold on
plot(xarc,yarc,’k-‘)
%}
%% Coordinates of wall
%{
writematrix(coords_new_x,’coordinates.xlsx’,’Sheet’,1,’Range’,’A1′);
writematrix(coords_new_y,’coordinates.xlsx’,’Sheet’,1,’Range’,’B1′);
%}
%%
%{
plot(x2,y2,’-k’)
hold on
plot(x2,-1.*(y2),’-r’)
grid on
title("CD Nozzle using a Circular Arc")
axis equal
%}
%% Analyze the discontinuity
% Find second-order derivative of wall contour
dy2_dx2 = zeros(size(xwall));
% Loop over all points except the last two
for i = 1:length(xwall)-2
% Calculate the second-order derivative using the forward difference formula
dy2_dx2(i) = (ywall(i+2) – 2*ywall(i+1) + ywall(i)) / (xwall(i+1) – xwall(i))^2;
end
dy2_dx2(end-1:end) = NaN; % last two points
%% Bezier Curve
threshold = 0.05; % Define a threshold for discontinuity detection (can be adjusted)
discontinuities = find(abs(diff(dy2_dx2)) > threshold);
%%
if ~isempty(discontinuities)
for idx = 1:length(discontinuities)
point_idx = discontinuities(idx); % Index of discontinuity
% Skip a few points around the discontinuity
region_start = max(1, point_idx – 2); % Upstream region
region_end = min(length(xwall), point_idx + 2); % Downstream region
% Use Bézier curve fitting only in this region to smooth the discontinuity
P0 = [xwall(region_start), ywall(region_start)]; % Start point
P1 = [xwall(point_idx), ywall(point_idx)]; % Control point (inflection/discontinuity)
P2 = [xwall(region_end), ywall(region_end)]; % End point
% Parameter t varies between 0 and 1 to interpolate the Bézier curve
t = linspace(0, 1, region_end – region_start + 1)’;
xwall(region_start:region_end) = (1-t).^2 * P0(1) + 2*(1-t).*t * P1(1) + t.^2 * P2(1);
ywall(region_start:region_end) = (1-t).^2 * P0(2) + 2*(1-t).*t * P1(2) + t.^2 * P2(2);
end
end
%%
plot(xwall,ywall,’.b’)
axis equal
%% Checking for continuous second order derivative of wall contour
cont_dy2_dx2 = zeros(size(xwall));
% Loop over all points except the last two (since forward difference needs i+2)
for i = 1:length(xwall)-2
% Calculate the second-order derivative using the forward difference formula
cont_dy2_dx2(i) = (ywall(i+2) – 2*ywall(i+1) + ywall(i)) / (xwall(i+1) – xwall(i))^2;
end
cont_dy2_dx2(end-1:end) = NaN;
plot(xwall./xwall(end), dy2_dx2)Greetings everyone, I am trying to fit a Bezier Curve as shown in the paper provide(fig1), but I am unable to get the desired plot(fig 2 and fig3). I have attached the codes as well as the paper and plot. Any help on this is highly appreciated!.
PS: The inflection point is the last point on xarc, i.e, xarc(end) and Nozzle_WithCircARc.m is the main file. It would be better to run the file cell by cell.
%function Nozzle_WithCircARc(G,Me,n,display)
%% Initialize datapoint matrices
clearvars;close all;clc;
G=1.4;
Me = 2.0;
n = 53; % speed index from pucketts paper
display = 0;
Km = zeros(n,n); % K- vlaues (Constant along right running characteristic lines)
Kp = zeros(n,n); % K+ vlaues (Constant along left running characteristic lines)
Theta = zeros(n,n); % Flow angles relative to the horizontal
Mu = zeros(n,n); % Mach angles
M = zeros(n,n); % Mach Numbers
x = zeros(n,n); % x-coordinates
y = zeros(n,n); % y-coordinates
%% Generate the convergent portion of a nozzle
% The inlet height/area and exit height/area(divergent) are same
% Therefore we have same A/A* = 1.6875
% Corresponding to Mach = 0.3722
%% Find NuMax (maximum expansion angle)
[~, NuMax, ~] = PMF(G,Me,0,0);
ThetaMax = NuMax/2;
%%
%ThetaMax0 = (1.0/1.687)^(2/9) * (NuMax/2);
%% Define some flow parameters of originating characteristic lines
dT = ThetaMax/n;
%no_ref = (ThetaMax – ThetaMax_ref)/dT;
ThetaArc(:,1) = (0:dT:ThetaMax);
NuArc = ThetaArc;
KmArc = ThetaArc + NuArc;
[~, ~, MuArc(:,1)] = PMF(G,0,NuArc(:,1),0);
%% Coordinates of wall along curve from throat
y0 = 1; % Define throat half-height
ThroatCurveRadius = 1.5*y0; % Radius of curvature just downstream of the throat
% for larger factors, ywall deviates from A/A* preferred value is 1.1
%L_e = 1.1 * y0 * sind(ThetaMax);
[xarc, yarc] = Arc(ThroatCurveRadius,ThetaArc); % Finds x- and y-coordinates for given theta-values
yarc(:,1) = yarc(:,1) + y0; % Defines offset due to arc being above horizontal
%% Fill in missing datapoint info along first C+ line
% First centerline datapoint done manually
Km(:,1) = KmArc(2:length(KmArc),1);
Theta(:,1) = ThetaArc(2:length(KmArc),1);
Nu(:,1) = Theta(:,1);
Kp(:,1) = Theta(:,1)-Nu(:,1);
M(1,1) = 1.0001;
Nu(1,1) = 0;
Mu(1,1) = 90;
y(1,1) = 0;
x(1,1) = xarc(2,1) + (y(1,1) – yarc(2,1))/tand((ThetaArc(2,1) – MuArc(2,1) – MuArc(2,1))/2);
% Finds the information at interior nodes along first C+ line
for i=2:n
[M(i,1), Nu(i,1), Mu(i,1)] = PMF(G,0,Nu(i,1),0);
s1 = tand((ThetaArc(i+1,1) – MuArc(i+1,1) + Theta(i,1) – Mu(i,1))/2);
s2 = tand((Theta(i-1,1) + Mu(i-1,1) + Theta(i,1) + Mu(i,1))/2);
x(i,1) = ((y(i-1,1)-x(i-1,1)*s2)-(yarc(i+1,1)-xarc(i+1,1)*s1))/(s1-s2);
y(i,1) = y(i-1,1) + (x(i,1)-x(i-1,1))*s2;
end
%% Find flow properties at remaining interior nodes
for j=2:n;
for i=1:n+1-j;
Km(i,j) = Km(i+1,j-1);
if i==1;
Theta(i,j) = 0;
Kp(i,j) = -Km(i,j);
Nu(i,j) = Km(i,j);
[M(i,j), Nu(i,j), Mu(i,j)] = PMF(G,0,Nu(i,j),0);
s1 = tand((Theta(i+1,j-1)-Mu(i+1,j-1)+Theta(i,j)-Mu(i,j))/2);
x(i,j) = x(i+1,j-1) – y(i+1,j-1)/s1;
y(i,j) = 0;
else
Kp(i,j) = Kp(i-1,j);
Theta(i,j) = (Km(i,j)+Kp(i,j))/2;
Nu(i,j) = (Km(i,j)-Kp(i,j))/2;
[M(i,j), Nu(i,j), Mu(i,j)] = PMF(G,0,Nu(i,j),0);
s1 = tand((Theta(i+1,j-1)-Mu(i+1,j-1)+Theta(i,j)-Mu(i,j))/2);
s2 = tand((Theta(i-1,j)+Mu(i-1,j)+Theta(i,j)+Mu(i,j))/2);
x(i,j) = ((y(i-1,j)-x(i-1,j)*s2)-(y(i+1,j-1)-x(i+1,j-1)*s1))/(s1-s2);
y(i,j) = y(i-1,j) + (x(i,j)-x(i-1,j))*s2;
end
end
end
%% Find wall node information
xwall = zeros(2*n,1);
ywall = xwall;
ThetaWall = ywall;
xwall(1:n,1) = xarc(2:length(xarc),1);
ywall(1:n,1) = yarc(2:length(xarc),1);
ThetaWall(1:n,1) = ThetaArc(2:length(xarc),1);
for i=1:n-1
ThetaWall(n+i,1) = ThetaWall(n-i,1); % criteria for stopping the reflection from the wall
end
%% Location of wall points
for i=1:n
s1 = tand((ThetaWall(n+i-1,1) + ThetaWall(n+i,1))/2);
s2 = tand(Theta(n+1-i,i)+Mu(n+1-i,i));
xwall(n+i,1) = ((y(n+1-i,i)-x(n+1-i,i)*s2)-(ywall(n+i-1,1)-xwall(n+i-1,1)*s1))/(s1-s2);
ywall(n+i,1) = ywall(n+i-1,1) + (xwall(n+i,1)-xwall(n+i-1,1))*s1;
end
%% Provide wall geometry to user
assignin(‘caller’,’xwall’,xwall)
assignin(‘caller’,’ywall’,ywall)
assignin(‘caller’,’Coords’,[xwall ywall])
%% Generate the convergent portion of nozzle
H_in = ywall(end);
L_e = (xwall(end)*(1.0/3.0));
[xconv,yconv] = Convergent_new_3rd(y0,H_in,L_e,n);
%%
% Draw contour and characteristic web
if display == 1
plot(xwall,ywall,’-‘)
axis equal
axis([0 ceil(xwall(length(xwall),1)) 0 ceil(ywall(length(ywall),1))])
hold on
plot(xarc,yarc,’k-‘)
for i=1:n-1
plot(x(1:n+1-i,i),y(1:n+1-i,i))
end
for i=1:n
plot([xarc(i,1) x(i,1)],[yarc(i,1) y(i,1)])
plot([x(n+1-i,i) xwall(i+n,1)],[y(n+1-i,i) ywall(i+n,1)])
end
for c=1:n
for r=2:n+1-c
plot([x(c,r) x(c+1,r-1)],[y(c,r) y(c+1,r-1)])
end
end
%hold on
%contourf(x, y, M, 20, ‘LineColor’, ‘none’); % Draw Mach number contours
%colorbar;
xlabel(‘Length [x/y0]’)
ylabel(‘Height [y/y0]’)
end
%% Non-scaled/non-dimensionalized plot
figure (1)
plot(xwall,ywall,’.b’)
title("Non dimensionalized plot")
axis equal
hold on
plot(xarc,yarc,’-‘)
hold on
plot(xconv,yconv,’-‘)
xlabel(‘xwall’)
ylabel(‘ywall’)
axis equal
%%
%{
plot(xwall,ThetaWall)
xlabel(‘xwall’)
ylabel(‘ThetaWall’)
%%
x1 = linspace(min(xwall),max(xwall),1000);
%y1 = spline(xw,yw,x1);
y1 = interp1(xwall,ywall,x1,’spline’);
figure;
title(‘Subplot 2: Cubic spline interpolation’)
plot(x1,y1,’r’)
%}
%%
%{
for i = 1:length(M)
M_centerline(i) = M(1,i);
end
for i =1:length(x)
x_axial(i) = x(1,i);
end
plot(x_axial’, Mcenterline’,’r’,’LineWidth’,2)
%}
%% Find the scaling factor
Mexit = Me;
[~,~,~,~,area] = flowisentropic(G,Mexit);
Hexit = 11.2798; %mm
Full_Throat_height = Hexit/area;
half_yt = Full_Throat_height/2.0;
%% Scaling of factors
xarc = half_yt.*xarc;
yarc = half_yt.*yarc;
xwall = half_yt.*xwall;
ywall = half_yt.*ywall;
xconv = half_yt.*xconv;
yconv = half_yt.*yconv;
%% Scaled up coordinates in mm
%{
title("Dimensionalized Plot")
plot(xwall,ywall,’-‘)
hold on
plot(xarc,yarc,’-‘)
hold on
plot(xconv,yconv,’-‘)
xlabel(‘xwall’)
ylabel(‘ywall’)
axis equal
%}
%% Combine Coordinates
% Combine xconv and xwall
coords_new_x = [xconv; xwall];
coords_new_y = [yconv; ywall];
%%
figure (2)
hold on;
plot(xconv, yconv, ‘.b’, ‘LineWidth’, 1.5) % Convergent section
plot(xwall, ywall, ‘.r’, ‘LineWidth’, 1.5) % Wall section
plot(xarc,yarc,’.g’,’LineWidth’,1.5) % arc
plot(xconv, -1.*yconv, ‘.b’, ‘LineWidth’, 1.5) % Convergent section
plot(xwall, -1.*ywall, ‘.r’, ‘LineWidth’, 1.5) % Wall section
plot(xarc,-1.*yarc,’.g’,’LineWidth’,1.5) % arc
xlabel(‘x [mm]’);
ylabel(‘y [mm]’);
title(‘Scaled up CD nozzle’);
legend(‘Convergent Section’, ‘Straightening Section’, ‘Initial Expansion (Arc)’);
grid on;
axis equal
%% Export coordinates
x1 = linspace(min(coords_new_x ),max(coords_new_x),1000);
%y1 = spline(xw,yw,x1);
y1 = interp1(coords_new_x,coords_new_y,x1,’spline’);
x2 = x1′;
y2 = y1′;
%figure;
%plot(x1,y1,’r’)
%writematrix(x2,’Spline.xlsx’,’Sheet’,1,’Range’,’A1′);
%writematrix(y2,’Spline.xlsx’,’Sheet’,1,’Range’,’B1′);
%%
%{
plot(x2,y2)
%%
plot(xwall,ywall,’-‘)
axis equal
axis([0 ceil(xwall(length(xwall),1)) 0 ceil(ywall(length(ywall),1))])
hold on
plot(xarc,yarc,’k-‘)
%}
%% Coordinates of wall
%{
writematrix(coords_new_x,’coordinates.xlsx’,’Sheet’,1,’Range’,’A1′);
writematrix(coords_new_y,’coordinates.xlsx’,’Sheet’,1,’Range’,’B1′);
%}
%%
%{
plot(x2,y2,’-k’)
hold on
plot(x2,-1.*(y2),’-r’)
grid on
title("CD Nozzle using a Circular Arc")
axis equal
%}
%% Analyze the discontinuity
% Find second-order derivative of wall contour
dy2_dx2 = zeros(size(xwall));
% Loop over all points except the last two
for i = 1:length(xwall)-2
% Calculate the second-order derivative using the forward difference formula
dy2_dx2(i) = (ywall(i+2) – 2*ywall(i+1) + ywall(i)) / (xwall(i+1) – xwall(i))^2;
end
dy2_dx2(end-1:end) = NaN; % last two points
%% Bezier Curve
threshold = 0.05; % Define a threshold for discontinuity detection (can be adjusted)
discontinuities = find(abs(diff(dy2_dx2)) > threshold);
%%
if ~isempty(discontinuities)
for idx = 1:length(discontinuities)
point_idx = discontinuities(idx); % Index of discontinuity
% Skip a few points around the discontinuity
region_start = max(1, point_idx – 2); % Upstream region
region_end = min(length(xwall), point_idx + 2); % Downstream region
% Use Bézier curve fitting only in this region to smooth the discontinuity
P0 = [xwall(region_start), ywall(region_start)]; % Start point
P1 = [xwall(point_idx), ywall(point_idx)]; % Control point (inflection/discontinuity)
P2 = [xwall(region_end), ywall(region_end)]; % End point
% Parameter t varies between 0 and 1 to interpolate the Bézier curve
t = linspace(0, 1, region_end – region_start + 1)’;
xwall(region_start:region_end) = (1-t).^2 * P0(1) + 2*(1-t).*t * P1(1) + t.^2 * P2(1);
ywall(region_start:region_end) = (1-t).^2 * P0(2) + 2*(1-t).*t * P1(2) + t.^2 * P2(2);
end
end
%%
plot(xwall,ywall,’.b’)
axis equal
%% Checking for continuous second order derivative of wall contour
cont_dy2_dx2 = zeros(size(xwall));
% Loop over all points except the last two (since forward difference needs i+2)
for i = 1:length(xwall)-2
% Calculate the second-order derivative using the forward difference formula
cont_dy2_dx2(i) = (ywall(i+2) – 2*ywall(i+1) + ywall(i)) / (xwall(i+1) – xwall(i))^2;
end
cont_dy2_dx2(end-1:end) = NaN;
plot(xwall./xwall(end), dy2_dx2) Greetings everyone, I am trying to fit a Bezier Curve as shown in the paper provide(fig1), but I am unable to get the desired plot(fig 2 and fig3). I have attached the codes as well as the paper and plot. Any help on this is highly appreciated!.
PS: The inflection point is the last point on xarc, i.e, xarc(end) and Nozzle_WithCircARc.m is the main file. It would be better to run the file cell by cell.
%function Nozzle_WithCircARc(G,Me,n,display)
%% Initialize datapoint matrices
clearvars;close all;clc;
G=1.4;
Me = 2.0;
n = 53; % speed index from pucketts paper
display = 0;
Km = zeros(n,n); % K- vlaues (Constant along right running characteristic lines)
Kp = zeros(n,n); % K+ vlaues (Constant along left running characteristic lines)
Theta = zeros(n,n); % Flow angles relative to the horizontal
Mu = zeros(n,n); % Mach angles
M = zeros(n,n); % Mach Numbers
x = zeros(n,n); % x-coordinates
y = zeros(n,n); % y-coordinates
%% Generate the convergent portion of a nozzle
% The inlet height/area and exit height/area(divergent) are same
% Therefore we have same A/A* = 1.6875
% Corresponding to Mach = 0.3722
%% Find NuMax (maximum expansion angle)
[~, NuMax, ~] = PMF(G,Me,0,0);
ThetaMax = NuMax/2;
%%
%ThetaMax0 = (1.0/1.687)^(2/9) * (NuMax/2);
%% Define some flow parameters of originating characteristic lines
dT = ThetaMax/n;
%no_ref = (ThetaMax – ThetaMax_ref)/dT;
ThetaArc(:,1) = (0:dT:ThetaMax);
NuArc = ThetaArc;
KmArc = ThetaArc + NuArc;
[~, ~, MuArc(:,1)] = PMF(G,0,NuArc(:,1),0);
%% Coordinates of wall along curve from throat
y0 = 1; % Define throat half-height
ThroatCurveRadius = 1.5*y0; % Radius of curvature just downstream of the throat
% for larger factors, ywall deviates from A/A* preferred value is 1.1
%L_e = 1.1 * y0 * sind(ThetaMax);
[xarc, yarc] = Arc(ThroatCurveRadius,ThetaArc); % Finds x- and y-coordinates for given theta-values
yarc(:,1) = yarc(:,1) + y0; % Defines offset due to arc being above horizontal
%% Fill in missing datapoint info along first C+ line
% First centerline datapoint done manually
Km(:,1) = KmArc(2:length(KmArc),1);
Theta(:,1) = ThetaArc(2:length(KmArc),1);
Nu(:,1) = Theta(:,1);
Kp(:,1) = Theta(:,1)-Nu(:,1);
M(1,1) = 1.0001;
Nu(1,1) = 0;
Mu(1,1) = 90;
y(1,1) = 0;
x(1,1) = xarc(2,1) + (y(1,1) – yarc(2,1))/tand((ThetaArc(2,1) – MuArc(2,1) – MuArc(2,1))/2);
% Finds the information at interior nodes along first C+ line
for i=2:n
[M(i,1), Nu(i,1), Mu(i,1)] = PMF(G,0,Nu(i,1),0);
s1 = tand((ThetaArc(i+1,1) – MuArc(i+1,1) + Theta(i,1) – Mu(i,1))/2);
s2 = tand((Theta(i-1,1) + Mu(i-1,1) + Theta(i,1) + Mu(i,1))/2);
x(i,1) = ((y(i-1,1)-x(i-1,1)*s2)-(yarc(i+1,1)-xarc(i+1,1)*s1))/(s1-s2);
y(i,1) = y(i-1,1) + (x(i,1)-x(i-1,1))*s2;
end
%% Find flow properties at remaining interior nodes
for j=2:n;
for i=1:n+1-j;
Km(i,j) = Km(i+1,j-1);
if i==1;
Theta(i,j) = 0;
Kp(i,j) = -Km(i,j);
Nu(i,j) = Km(i,j);
[M(i,j), Nu(i,j), Mu(i,j)] = PMF(G,0,Nu(i,j),0);
s1 = tand((Theta(i+1,j-1)-Mu(i+1,j-1)+Theta(i,j)-Mu(i,j))/2);
x(i,j) = x(i+1,j-1) – y(i+1,j-1)/s1;
y(i,j) = 0;
else
Kp(i,j) = Kp(i-1,j);
Theta(i,j) = (Km(i,j)+Kp(i,j))/2;
Nu(i,j) = (Km(i,j)-Kp(i,j))/2;
[M(i,j), Nu(i,j), Mu(i,j)] = PMF(G,0,Nu(i,j),0);
s1 = tand((Theta(i+1,j-1)-Mu(i+1,j-1)+Theta(i,j)-Mu(i,j))/2);
s2 = tand((Theta(i-1,j)+Mu(i-1,j)+Theta(i,j)+Mu(i,j))/2);
x(i,j) = ((y(i-1,j)-x(i-1,j)*s2)-(y(i+1,j-1)-x(i+1,j-1)*s1))/(s1-s2);
y(i,j) = y(i-1,j) + (x(i,j)-x(i-1,j))*s2;
end
end
end
%% Find wall node information
xwall = zeros(2*n,1);
ywall = xwall;
ThetaWall = ywall;
xwall(1:n,1) = xarc(2:length(xarc),1);
ywall(1:n,1) = yarc(2:length(xarc),1);
ThetaWall(1:n,1) = ThetaArc(2:length(xarc),1);
for i=1:n-1
ThetaWall(n+i,1) = ThetaWall(n-i,1); % criteria for stopping the reflection from the wall
end
%% Location of wall points
for i=1:n
s1 = tand((ThetaWall(n+i-1,1) + ThetaWall(n+i,1))/2);
s2 = tand(Theta(n+1-i,i)+Mu(n+1-i,i));
xwall(n+i,1) = ((y(n+1-i,i)-x(n+1-i,i)*s2)-(ywall(n+i-1,1)-xwall(n+i-1,1)*s1))/(s1-s2);
ywall(n+i,1) = ywall(n+i-1,1) + (xwall(n+i,1)-xwall(n+i-1,1))*s1;
end
%% Provide wall geometry to user
assignin(‘caller’,’xwall’,xwall)
assignin(‘caller’,’ywall’,ywall)
assignin(‘caller’,’Coords’,[xwall ywall])
%% Generate the convergent portion of nozzle
H_in = ywall(end);
L_e = (xwall(end)*(1.0/3.0));
[xconv,yconv] = Convergent_new_3rd(y0,H_in,L_e,n);
%%
% Draw contour and characteristic web
if display == 1
plot(xwall,ywall,’-‘)
axis equal
axis([0 ceil(xwall(length(xwall),1)) 0 ceil(ywall(length(ywall),1))])
hold on
plot(xarc,yarc,’k-‘)
for i=1:n-1
plot(x(1:n+1-i,i),y(1:n+1-i,i))
end
for i=1:n
plot([xarc(i,1) x(i,1)],[yarc(i,1) y(i,1)])
plot([x(n+1-i,i) xwall(i+n,1)],[y(n+1-i,i) ywall(i+n,1)])
end
for c=1:n
for r=2:n+1-c
plot([x(c,r) x(c+1,r-1)],[y(c,r) y(c+1,r-1)])
end
end
%hold on
%contourf(x, y, M, 20, ‘LineColor’, ‘none’); % Draw Mach number contours
%colorbar;
xlabel(‘Length [x/y0]’)
ylabel(‘Height [y/y0]’)
end
%% Non-scaled/non-dimensionalized plot
figure (1)
plot(xwall,ywall,’.b’)
title("Non dimensionalized plot")
axis equal
hold on
plot(xarc,yarc,’-‘)
hold on
plot(xconv,yconv,’-‘)
xlabel(‘xwall’)
ylabel(‘ywall’)
axis equal
%%
%{
plot(xwall,ThetaWall)
xlabel(‘xwall’)
ylabel(‘ThetaWall’)
%%
x1 = linspace(min(xwall),max(xwall),1000);
%y1 = spline(xw,yw,x1);
y1 = interp1(xwall,ywall,x1,’spline’);
figure;
title(‘Subplot 2: Cubic spline interpolation’)
plot(x1,y1,’r’)
%}
%%
%{
for i = 1:length(M)
M_centerline(i) = M(1,i);
end
for i =1:length(x)
x_axial(i) = x(1,i);
end
plot(x_axial’, Mcenterline’,’r’,’LineWidth’,2)
%}
%% Find the scaling factor
Mexit = Me;
[~,~,~,~,area] = flowisentropic(G,Mexit);
Hexit = 11.2798; %mm
Full_Throat_height = Hexit/area;
half_yt = Full_Throat_height/2.0;
%% Scaling of factors
xarc = half_yt.*xarc;
yarc = half_yt.*yarc;
xwall = half_yt.*xwall;
ywall = half_yt.*ywall;
xconv = half_yt.*xconv;
yconv = half_yt.*yconv;
%% Scaled up coordinates in mm
%{
title("Dimensionalized Plot")
plot(xwall,ywall,’-‘)
hold on
plot(xarc,yarc,’-‘)
hold on
plot(xconv,yconv,’-‘)
xlabel(‘xwall’)
ylabel(‘ywall’)
axis equal
%}
%% Combine Coordinates
% Combine xconv and xwall
coords_new_x = [xconv; xwall];
coords_new_y = [yconv; ywall];
%%
figure (2)
hold on;
plot(xconv, yconv, ‘.b’, ‘LineWidth’, 1.5) % Convergent section
plot(xwall, ywall, ‘.r’, ‘LineWidth’, 1.5) % Wall section
plot(xarc,yarc,’.g’,’LineWidth’,1.5) % arc
plot(xconv, -1.*yconv, ‘.b’, ‘LineWidth’, 1.5) % Convergent section
plot(xwall, -1.*ywall, ‘.r’, ‘LineWidth’, 1.5) % Wall section
plot(xarc,-1.*yarc,’.g’,’LineWidth’,1.5) % arc
xlabel(‘x [mm]’);
ylabel(‘y [mm]’);
title(‘Scaled up CD nozzle’);
legend(‘Convergent Section’, ‘Straightening Section’, ‘Initial Expansion (Arc)’);
grid on;
axis equal
%% Export coordinates
x1 = linspace(min(coords_new_x ),max(coords_new_x),1000);
%y1 = spline(xw,yw,x1);
y1 = interp1(coords_new_x,coords_new_y,x1,’spline’);
x2 = x1′;
y2 = y1′;
%figure;
%plot(x1,y1,’r’)
%writematrix(x2,’Spline.xlsx’,’Sheet’,1,’Range’,’A1′);
%writematrix(y2,’Spline.xlsx’,’Sheet’,1,’Range’,’B1′);
%%
%{
plot(x2,y2)
%%
plot(xwall,ywall,’-‘)
axis equal
axis([0 ceil(xwall(length(xwall),1)) 0 ceil(ywall(length(ywall),1))])
hold on
plot(xarc,yarc,’k-‘)
%}
%% Coordinates of wall
%{
writematrix(coords_new_x,’coordinates.xlsx’,’Sheet’,1,’Range’,’A1′);
writematrix(coords_new_y,’coordinates.xlsx’,’Sheet’,1,’Range’,’B1′);
%}
%%
%{
plot(x2,y2,’-k’)
hold on
plot(x2,-1.*(y2),’-r’)
grid on
title("CD Nozzle using a Circular Arc")
axis equal
%}
%% Analyze the discontinuity
% Find second-order derivative of wall contour
dy2_dx2 = zeros(size(xwall));
% Loop over all points except the last two
for i = 1:length(xwall)-2
% Calculate the second-order derivative using the forward difference formula
dy2_dx2(i) = (ywall(i+2) – 2*ywall(i+1) + ywall(i)) / (xwall(i+1) – xwall(i))^2;
end
dy2_dx2(end-1:end) = NaN; % last two points
%% Bezier Curve
threshold = 0.05; % Define a threshold for discontinuity detection (can be adjusted)
discontinuities = find(abs(diff(dy2_dx2)) > threshold);
%%
if ~isempty(discontinuities)
for idx = 1:length(discontinuities)
point_idx = discontinuities(idx); % Index of discontinuity
% Skip a few points around the discontinuity
region_start = max(1, point_idx – 2); % Upstream region
region_end = min(length(xwall), point_idx + 2); % Downstream region
% Use Bézier curve fitting only in this region to smooth the discontinuity
P0 = [xwall(region_start), ywall(region_start)]; % Start point
P1 = [xwall(point_idx), ywall(point_idx)]; % Control point (inflection/discontinuity)
P2 = [xwall(region_end), ywall(region_end)]; % End point
% Parameter t varies between 0 and 1 to interpolate the Bézier curve
t = linspace(0, 1, region_end – region_start + 1)’;
xwall(region_start:region_end) = (1-t).^2 * P0(1) + 2*(1-t).*t * P1(1) + t.^2 * P2(1);
ywall(region_start:region_end) = (1-t).^2 * P0(2) + 2*(1-t).*t * P1(2) + t.^2 * P2(2);
end
end
%%
plot(xwall,ywall,’.b’)
axis equal
%% Checking for continuous second order derivative of wall contour
cont_dy2_dx2 = zeros(size(xwall));
% Loop over all points except the last two (since forward difference needs i+2)
for i = 1:length(xwall)-2
% Calculate the second-order derivative using the forward difference formula
cont_dy2_dx2(i) = (ywall(i+2) – 2*ywall(i+1) + ywall(i)) / (xwall(i+1) – xwall(i))^2;
end
cont_dy2_dx2(end-1:end) = NaN;
plot(xwall./xwall(end), dy2_dx2) #curve fitting, bezier, forward difference MATLAB Answers — New Questions
QUARTERLY AVERAGE AND VARIANCE from MONTHLY DATA
I have a dataset of windspeed for each district of INDIA by month for 50 years (only the first seven are displayed below). I want to find the QUARTERLY average and VARIANCE for each district. Any help would be appreciated. Data example below
Code:
* Example generated by -dataex-. For more info, type help dataex
clear
input str27 state str24 districts float(latitude longitude) byte month float(ws_2023 ws_2022 ws_2021 ws_2020 ws_2019 ws_2018 ws_2017)
"ANDAMAN AND NICOBAR ISLANDS" "North and Middle Andaman" 12.5601 92.8976 1 4.589247 3.613052 4.267717 4.635023 4.930599 3.780835 4.673967
"ANDAMAN AND NICOBAR ISLANDS" "North and Middle Andaman" 12.5601 92.8976 2 4.079226 4.215449 3.877388 4.538066 3.682131 3.676485 3.948466
"ANDAMAN AND NICOBAR ISLANDS" "North and Middle Andaman" 12.5601 92.8976 3 3.171698 2.644508 2.92275 3.351344 3.177872 2.893883 3.182198
"ANDAMAN AND NICOBAR ISLANDS" "North and Middle Andaman" 12.5601 92.8976 4 2.689871 2.156992 2.136186 2.872274 2.989198 2.722031 2.906296
"ANDAMAN AND NICOBAR ISLANDS" "North and Middle Andaman" 12.5601 92.8976 5 4.14325 5.455741 3.406546 3.855165 3.735876 2.974356 3.366552
"ANDAMAN AND NICOBAR ISLANDS" "North and Middle Andaman" 12.5601 92.8976 6 5.78509 4.582315 5.06107 4.991875 5.848218 6.734819 6.140237
"ANDAMAN AND NICOBAR ISLANDS" "North and Middle Andaman" 12.5601 92.8976 7 6.180731 4.725333 5.93688 4.066154 5.917521 6.973715 5.876394
"ANDAMAN AND NICOBAR ISLANDS" "North and Middle Andaman" 12.5601 92.8976 8 5.776236 5.244017 4.860325 5.294113 7.112219 7.073696 5.248257
"ANDAMAN AND NICOBAR ISLANDS" "North and Middle Andaman" 12.5601 92.8976 9 5.926691 4.340836 4.858127 4.631201 4.920815 4.280732 4.387124
"ANDAMAN AND NICOBAR ISLANDS" "North and Middle Andaman" 12.5601 92.8976 10 2.832476 4.086142 3.879084 3.524881 2.504806 3.259824 3.722174
"ANDAMAN AND NICOBAR ISLANDS" "North and Middle Andaman" 12.5601 92.8976 11 3.89687 3.366515 4.069301 4.236919 3.831769 4.167921 4.207607
"ANDAMAN AND NICOBAR ISLANDS" "North and Middle Andaman" 12.5601 92.8976 12 4.377546 4.54319 4.715546 4.315512 4.674977 4.296709 4.937579
"ANDAMAN AND NICOBAR ISLANDS" "South Andaman" 10.7449 92.5 1 6.210341 4.802261 6.2101 6.206068 6.416927 4.771069 6.214251
"ANDAMAN AND NICOBAR ISLANDS" "South Andaman" 10.7449 92.5 2 5.469119 5.677119 5.161079 6.119121 5.056155 5.20627 5.359843
"ANDAMAN AND NICOBAR ISLANDS" "South Andaman" 10.7449 92.5 3 4.022772 3.287575 3.717183 3.603297 3.418595 3.492516 3.59089
"ANDAMAN AND NICOBAR ISLANDS" "South Andaman" 10.7449 92.5 4 3.014578 2.633554 2.704057 3.562704 3.44037 3.314805 3.605515
"ANDAMAN AND NICOBAR ISLANDS" "South Andaman" 10.7449 92.5 5 5.758973 7.633964 4.783988 5.456239 5.274939 3.910879 4.607275
"ANDAMAN AND NICOBAR ISLANDS" "South Andaman" 10.7449 92.5 6 8.273372 6.252726 7.027379 7.017265 8.193433 9.077105 8.145121
"ANDAMAN AND NICOBAR ISLANDS" "South Andaman" 10.7449 92.5 7 8.684149 7.11254 8.41686 5.523673 7.773966 9.72518 8.343679
"ANDAMAN AND NICOBAR ISLANDS" "South Andaman" 10.7449 92.5 8 8.257681 7.702024 7.115208 7.253097 9.670324 9.874477 7.653042
"ANDAMAN AND NICOBAR ISLANDS" "South Andaman" 10.7449 92.5 9 8.256769 6.616227 6.917697 6.731298 6.786049 5.860077 6.402016
"ANDAMAN AND NICOBAR ISLANDS" "South Andaman" 10.7449 92.5 10 3.68233 4.764365 5.604181 5.805154 3.288253 3.944639 5.052252
"ANDAMAN AND NICOBAR ISLANDS" "South Andaman" 10.7449 92.5 11 5.013813 4.12091 4.951137 5.162457 5.361066 5.314161 4.652676
"ANDAMAN AND NICOBAR ISLANDS" "South Andaman" 10.7449 92.5 12 5.805525 6.347145 6.215302 5.600912 6.451589 5.682451 6.354571
"ANDHRA PRADESH" "Chittoor" 13.2172 79.1003 1 2.071669 1.906998 1.939836 2.075697 2.161556 1.867749 2.186907
"ANDHRA PRADESH" "Chittoor" 13.2172 79.1003 2 2.252566 2.123164 2.052436 2.442608 2.446047 2.056368 2.235332
"ANDHRA PRADESH" "Chittoor" 13.2172 79.1003 3 2.232489 2.296364 2.168355 2.435328 2.616105 2.0682 2.37214
"ANDHRA PRADESH" "Chittoor" 13.2172 79.1003 4 2.163504 2.317636 2.062944 2.230672 2.365663 2.306504 2.151902
"ANDHRA PRADESH" "Chittoor" 13.2172 79.1003 5 2.233094 2.828299 2.821097 2.442079 2.263708 2.127188 2.934911
"ANDHRA PRADESH" "Chittoor" 13.2172 79.1003 6 3.514094 2.797159 3.412144 3.196953 3.428785 3.854449 3.74473
"ANDHRA PRADESH" "Chittoor" 13.2172 79.1003 7 4.419012 3.583243 3.530141 2.285392 3.653605 4.687582 4.112722
"ANDHRA PRADESH" "Chittoor" 13.2172 79.1003 8 2.849966 3.091185 2.984837 3.136886 3.922278 5.022915 2.880093
"ANDHRA PRADESH" "Chittoor" 13.2172 79.1003 9 2.927668 2.581071 2.732151 2.731299 2.755776 2.25119 2.190346
"ANDHRA PRADESH" "Chittoor" 13.2172 79.1003 10 1.935015 2.111777 1.777521 2.475076 1.535323 1.955869 1.695318
"ANDHRA PRADESH" "Chittoor" 13.2172 79.1003 11 2.019673 2.092834 2.257045 2.613384 2.126691 2.197218 2.132412
"ANDHRA PRADESH" "Chittoor" 13.2172 79.1003 12 2.483747 2.478249 1.963105 2.345541 2.264333 2.242998 2.073321
"ANDHRA PRADESH" "East Godavari" 17.3213 82.0407 1 1.987441 1.91066 1.86635 1.984144 1.924251 1.669018 1.983049
"ANDHRA PRADESH" "East Godavari" 17.3213 82.0407 2 1.724246 1.956904 1.953315 2.075664 1.991458 1.761446 1.777079
"ANDHRA PRADESH" "East Godavari" 17.3213 82.0407 3 1.760321 1.935036 1.757222 1.722926 1.879776 1.877282 1.911202
"ANDHRA PRADESH" "East Godavari" 17.3213 82.0407 4 1.681082 2.006113 1.659624 1.749227 1.864686 1.898789 2.223191
"ANDHRA PRADESH" "East Godavari" 17.3213 82.0407 5 1.778992 2.451346 2.086234 1.976747 2.230505 1.910879 1.914892
"ANDHRA PRADESH" "East Godavari" 17.3213 82.0407 6 2.416438 2.145792 2.653355 2.153984 2.45271 2.329058 2.48887
"ANDHRA PRADESH" "East Godavari" 17.3213 82.0407 7 3.393621 3.058341 2.791372 2.005118 2.855509 3.480551 3.17864
"ANDHRA PRADESH" "East Godavari" 17.3213 82.0407 8 2.665884 2.605833 2.375462 3.258956 3.166419 3.685513 2.249233
"ANDHRA PRADESH" "East Godavari" 17.3213 82.0407 9 2.15716 2.018571 2.208713 1.722998 2.432045 1.953339 1.662759
"ANDHRA PRADESH" "East Godavari" 17.3213 82.0407 10 1.6794 1.821005 1.460138 1.546854 1.725753 1.699766 1.331305
"ANDHRA PRADESH" "East Godavari" 17.3213 82.0407 11 2.362202 1.841369 2.649868 2.37022 1.928938 1.887892 1.993252
"ANDHRA PRADESH" "East Godavari" 17.3213 82.0407 12 2.372175 2.15403 1.945038 1.970053 2.424489 2.20125 1.92171
"ANDHRA PRADESH" "Guntur" 16.3067 80.4365 1 2.011366 2.08107 1.888078 2.175307 2.046566 1.711987 2.04384
"ANDHRA PRADESH" "Guntur" 16.3067 80.4365 2 1.931765 2.307734 2.067085 2.44749 2.500002 1.985567 2.09666
"ANDHRA PRADESH" "Guntur" 16.3067 80.4365 3 2.373602 2.458717 2.115621 2.740993 2.991105 2.510094 2.925362
"ANDHRA PRADESH" "Guntur" 16.3067 80.4365 4 2.548758 2.958261 2.527299 2.988973 3.118593 3.251816 2.894578
"ANDHRA PRADESH" "Guntur" 16.3067 80.4365 5 2.386414 3.009452 3.237601 2.876161 3.080603 3.112051 2.889013
"ANDHRA PRADESH" "Guntur" 16.3067 80.4365 6 3.161067 3.017374 3.293492 2.636406 3.111402 2.99898 2.789651
"ANDHRA PRADESH" "Guntur" 16.3067 80.4365 7 3.664129 3.093009 3.062856 2.255607 3.121134 3.479086 3.147878
"ANDHRA PRADESH" "Guntur" 16.3067 80.4365 8 2.84606 2.704954 2.66013 3.023605 3.152747 3.65231 2.367398
"ANDHRA PRADESH" "Guntur" 16.3067 80.4365 9 2.383722 2.29152 2.370334 2.238135 2.599038 2.126679 1.888833
"ANDHRA PRADESH" "Guntur" 16.3067 80.4365 10 1.867388 1.978476 1.748224 1.915506 1.639327 2.064756 1.631842
"ANDHRA PRADESH" "Guntur" 16.3067 80.4365 11 2.148823 1.817687 2.462612 2.304302 1.947004 2.018751 2.124355
"ANDHRA PRADESH" "Guntur" 16.3067 80.4365 12 2.385847 2.008522 2.1362 2.018637 2.262868 2.301592 2.08919
"ANDHRA PRADESH" "Krishna" 16.61 80.7214 1 2.016982 2.063248 1.918352 2.203383 1.990902 1.675122 2.033587
"ANDHRA PRADESH" "Krishna" 16.61 80.7214 2 1.856081 2.255 2.059272 2.462871 2.399661 1.932588 1.99705
"ANDHRA PRADESH" "Krishna" 16.61 80.7214 3 2.299871 2.319313 1.99648 2.563258 2.707413 2.299645 2.696358
"ANDHRA PRADESH" "Krishna" 16.61 80.7214 4 2.327566 2.709238 2.341753 2.732137 2.801698 2.962754 2.68071
"ANDHRA PRADESH" "Krishna" 16.61 80.7214 5 2.228699 3.014823 3.060355 2.668153 2.813513 2.880606 2.612157
"ANDHRA PRADESH" "Krishna" 16.61 80.7214 6 3.126399 2.921671 3.138706 2.625664 3.053785 2.862261 2.795511
"ANDHRA PRADESH" "Krishna" 16.61 80.7214 7 3.683172 3.185294 3.050161 2.216544 3.118937 3.509848 3.201589
"ANDHRA PRADESH" "Krishna" 16.61 80.7214 8 2.813833 2.691771 2.644016 3.143722 3.177161 3.748501 2.381069
"ANDHRA PRADESH" "Krishna" 16.61 80.7214 9 2.350031 2.26027 2.358615 2.152197 2.562905 2.069306 1.837807
"ANDHRA PRADESH" "Krishna" 16.61 80.7214 10 1.858355 1.990195 1.677424 1.873514 1.681808 1.952695 1.604742
"ANDHRA PRADESH" "Krishna" 16.61 80.7214 11 2.297016 1.859923 2.603725 2.351421 2.027082 2.004835 2.172207
"ANDHRA PRADESH" "Krishna" 16.61 80.7214 12 2.444685 2.104958 2.152802 2.059896 2.402516 2.272051 2.0992
"ANDHRA PRADESH" "Prakasam" 15.3485 79.5603 1 2.056532 1.886978 1.878557 2.033217 2.102474 1.978589 2.157366
"ANDHRA PRADESH" "Prakasam" 15.3485 79.5603 2 2.212771 2.158808 2.061958 2.473369 2.435305 2.272676 2.309306
"ANDHRA PRADESH" "Prakasam" 15.3485 79.5603 3 2.228094 2.156715 2.145406 2.709743 2.781388 2.305505 2.603585
"ANDHRA PRADESH" "Prakasam" 15.3485 79.5603 4 2.488699 2.457773 2.239213 2.510946 2.591737 2.673691 2.364792
"ANDHRA PRADESH" "Prakasam" 15.3485 79.5603 5 2.438172 2.945487 3.199027 2.526551 2.601599 2.514883 2.920263
"ANDHRA PRADESH" "Prakasam" 15.3485 79.5603 6 3.734309 3.287393 3.806187 3.250664 3.603101 4.160601 3.837503
"ANDHRA PRADESH" "Prakasam" 15.3485 79.5603 7 4.495672 3.738028 3.756704 2.563712 4.048136 4.704184 3.989675
"ANDHRA PRADESH" "Prakasam" 15.3485 79.5603 8 3.301626 3.308958 3.112278 3.540206 4.179602 4.823696 2.978726
"ANDHRA PRADESH" "Prakasam" 15.3485 79.5603 9 3.134211 2.628434 3.065647 2.743994 2.827065 2.477021 2.204995
"ANDHRA PRADESH" "Prakasam" 15.3485 79.5603 10 2.264361 1.964804 1.912775 2.033182 1.671065 2.17169 1.69776
"ANDHRA PRADESH" "Prakasam" 15.3485 79.5603 11 2.124653 1.995422 2.382534 2.313824 1.98924 2.006056 2.220546
"ANDHRA PRADESH" "Prakasam" 15.3485 79.5603 12 2.34654 2.072243 1.885468 2.081381 2.116383 2.190996 2.209795
"ANDHRA PRADESH" "SPS Nellore" 14.2581 79.9193 1 2.44496 2.590836 2.425676 2.605971 2.501644 2.515942 2.757463
"ANDHRA PRADESH" "SPS Nellore" 14.2581 79.9193 2 2.508425 2.762568 2.567573 3.126446 3.197756 2.60129 2.800029
"ANDHRA PRADESH" "SPS Nellore" 14.2581 79.9193 3 3.205389 3.237282 2.953511 3.691676 4.10756 3.36654 4.029366
"ANDHRA PRADESH" "SPS Nellore" 14.2581 79.9193 4 3.662039 3.821054 3.530229 3.994833 4.279237 4.280625 4.094285
"ANDHRA PRADESH" "SPS Nellore" 14.2581 79.9193 5 3.212586 3.671073 4.05303 3.806825 4.215857 3.95336 3.870458
"ANDHRA PRADESH" "SPS Nellore" 14.2581 79.9193 6 3.785578 3.46171 3.949253 3.267265 3.760816 3.631304 3.623147
"ANDHRA PRADESH" "SPS Nellore" 14.2581 79.9193 7 4.028875 3.644278 3.422719 2.675529 3.510783 4.426352 3.740652
"ANDHRA PRADESH" "SPS Nellore" 14.2581 79.9193 8 3.309439 3.221068 3.280735 2.928878 3.648352 4.515591 3.001187
"ANDHRA PRADESH" "SPS Nellore" 14.2581 79.9193 9 3.065851 2.845231 2.899631 2.802588 3.053627 2.959442 2.436929
"ANDHRA PRADESH" "SPS Nellore" 14.2581 79.9193 10 2.54024 2.594199 2.424494 2.607889 2.401534 2.679014 2.344
"ANDHRA PRADESH" "SPS Nellore" 14.2581 79.9193 11 2.683003 2.720275 3.157192 3.142681 2.674055 2.672804 2.926601
"ANDHRA PRADESH" "SPS Nellore" 14.2581 79.9193 12 3.434187 2.877907 2.651093 3.038168 2.910573 2.87581 2.851641
"ANDHRA PRADESH" "Srikakulam" 18.2949 83.8938 1 3.073378 3.212418 2.792619 3.054945 2.819027 2.648022 2.986223
"ANDHRA PRADESH" "Srikakulam" 18.2949 83.8938 2 3.036501 3.030879 3.170356 3.00584 3.223879 2.857637 2.92332
"ANDHRA PRADESH" "Srikakulam" 18.2949 83.8938 3 3.2237 3.786842 3.660542 3.183375 4.176651 4.108239 4.844308
"ANDHRA PRADESH" "Srikakulam" 18.2949 83.8938 4 3.600516 5.530527 4.27437 4.589071 4.829042 5.10582 5.711472
endI have a dataset of windspeed for each district of INDIA by month for 50 years (only the first seven are displayed below). I want to find the QUARTERLY average and VARIANCE for each district. Any help would be appreciated. Data example below
Code:
* Example generated by -dataex-. For more info, type help dataex
clear
input str27 state str24 districts float(latitude longitude) byte month float(ws_2023 ws_2022 ws_2021 ws_2020 ws_2019 ws_2018 ws_2017)
"ANDAMAN AND NICOBAR ISLANDS" "North and Middle Andaman" 12.5601 92.8976 1 4.589247 3.613052 4.267717 4.635023 4.930599 3.780835 4.673967
"ANDAMAN AND NICOBAR ISLANDS" "North and Middle Andaman" 12.5601 92.8976 2 4.079226 4.215449 3.877388 4.538066 3.682131 3.676485 3.948466
"ANDAMAN AND NICOBAR ISLANDS" "North and Middle Andaman" 12.5601 92.8976 3 3.171698 2.644508 2.92275 3.351344 3.177872 2.893883 3.182198
"ANDAMAN AND NICOBAR ISLANDS" "North and Middle Andaman" 12.5601 92.8976 4 2.689871 2.156992 2.136186 2.872274 2.989198 2.722031 2.906296
"ANDAMAN AND NICOBAR ISLANDS" "North and Middle Andaman" 12.5601 92.8976 5 4.14325 5.455741 3.406546 3.855165 3.735876 2.974356 3.366552
"ANDAMAN AND NICOBAR ISLANDS" "North and Middle Andaman" 12.5601 92.8976 6 5.78509 4.582315 5.06107 4.991875 5.848218 6.734819 6.140237
"ANDAMAN AND NICOBAR ISLANDS" "North and Middle Andaman" 12.5601 92.8976 7 6.180731 4.725333 5.93688 4.066154 5.917521 6.973715 5.876394
"ANDAMAN AND NICOBAR ISLANDS" "North and Middle Andaman" 12.5601 92.8976 8 5.776236 5.244017 4.860325 5.294113 7.112219 7.073696 5.248257
"ANDAMAN AND NICOBAR ISLANDS" "North and Middle Andaman" 12.5601 92.8976 9 5.926691 4.340836 4.858127 4.631201 4.920815 4.280732 4.387124
"ANDAMAN AND NICOBAR ISLANDS" "North and Middle Andaman" 12.5601 92.8976 10 2.832476 4.086142 3.879084 3.524881 2.504806 3.259824 3.722174
"ANDAMAN AND NICOBAR ISLANDS" "North and Middle Andaman" 12.5601 92.8976 11 3.89687 3.366515 4.069301 4.236919 3.831769 4.167921 4.207607
"ANDAMAN AND NICOBAR ISLANDS" "North and Middle Andaman" 12.5601 92.8976 12 4.377546 4.54319 4.715546 4.315512 4.674977 4.296709 4.937579
"ANDAMAN AND NICOBAR ISLANDS" "South Andaman" 10.7449 92.5 1 6.210341 4.802261 6.2101 6.206068 6.416927 4.771069 6.214251
"ANDAMAN AND NICOBAR ISLANDS" "South Andaman" 10.7449 92.5 2 5.469119 5.677119 5.161079 6.119121 5.056155 5.20627 5.359843
"ANDAMAN AND NICOBAR ISLANDS" "South Andaman" 10.7449 92.5 3 4.022772 3.287575 3.717183 3.603297 3.418595 3.492516 3.59089
"ANDAMAN AND NICOBAR ISLANDS" "South Andaman" 10.7449 92.5 4 3.014578 2.633554 2.704057 3.562704 3.44037 3.314805 3.605515
"ANDAMAN AND NICOBAR ISLANDS" "South Andaman" 10.7449 92.5 5 5.758973 7.633964 4.783988 5.456239 5.274939 3.910879 4.607275
"ANDAMAN AND NICOBAR ISLANDS" "South Andaman" 10.7449 92.5 6 8.273372 6.252726 7.027379 7.017265 8.193433 9.077105 8.145121
"ANDAMAN AND NICOBAR ISLANDS" "South Andaman" 10.7449 92.5 7 8.684149 7.11254 8.41686 5.523673 7.773966 9.72518 8.343679
"ANDAMAN AND NICOBAR ISLANDS" "South Andaman" 10.7449 92.5 8 8.257681 7.702024 7.115208 7.253097 9.670324 9.874477 7.653042
"ANDAMAN AND NICOBAR ISLANDS" "South Andaman" 10.7449 92.5 9 8.256769 6.616227 6.917697 6.731298 6.786049 5.860077 6.402016
"ANDAMAN AND NICOBAR ISLANDS" "South Andaman" 10.7449 92.5 10 3.68233 4.764365 5.604181 5.805154 3.288253 3.944639 5.052252
"ANDAMAN AND NICOBAR ISLANDS" "South Andaman" 10.7449 92.5 11 5.013813 4.12091 4.951137 5.162457 5.361066 5.314161 4.652676
"ANDAMAN AND NICOBAR ISLANDS" "South Andaman" 10.7449 92.5 12 5.805525 6.347145 6.215302 5.600912 6.451589 5.682451 6.354571
"ANDHRA PRADESH" "Chittoor" 13.2172 79.1003 1 2.071669 1.906998 1.939836 2.075697 2.161556 1.867749 2.186907
"ANDHRA PRADESH" "Chittoor" 13.2172 79.1003 2 2.252566 2.123164 2.052436 2.442608 2.446047 2.056368 2.235332
"ANDHRA PRADESH" "Chittoor" 13.2172 79.1003 3 2.232489 2.296364 2.168355 2.435328 2.616105 2.0682 2.37214
"ANDHRA PRADESH" "Chittoor" 13.2172 79.1003 4 2.163504 2.317636 2.062944 2.230672 2.365663 2.306504 2.151902
"ANDHRA PRADESH" "Chittoor" 13.2172 79.1003 5 2.233094 2.828299 2.821097 2.442079 2.263708 2.127188 2.934911
"ANDHRA PRADESH" "Chittoor" 13.2172 79.1003 6 3.514094 2.797159 3.412144 3.196953 3.428785 3.854449 3.74473
"ANDHRA PRADESH" "Chittoor" 13.2172 79.1003 7 4.419012 3.583243 3.530141 2.285392 3.653605 4.687582 4.112722
"ANDHRA PRADESH" "Chittoor" 13.2172 79.1003 8 2.849966 3.091185 2.984837 3.136886 3.922278 5.022915 2.880093
"ANDHRA PRADESH" "Chittoor" 13.2172 79.1003 9 2.927668 2.581071 2.732151 2.731299 2.755776 2.25119 2.190346
"ANDHRA PRADESH" "Chittoor" 13.2172 79.1003 10 1.935015 2.111777 1.777521 2.475076 1.535323 1.955869 1.695318
"ANDHRA PRADESH" "Chittoor" 13.2172 79.1003 11 2.019673 2.092834 2.257045 2.613384 2.126691 2.197218 2.132412
"ANDHRA PRADESH" "Chittoor" 13.2172 79.1003 12 2.483747 2.478249 1.963105 2.345541 2.264333 2.242998 2.073321
"ANDHRA PRADESH" "East Godavari" 17.3213 82.0407 1 1.987441 1.91066 1.86635 1.984144 1.924251 1.669018 1.983049
"ANDHRA PRADESH" "East Godavari" 17.3213 82.0407 2 1.724246 1.956904 1.953315 2.075664 1.991458 1.761446 1.777079
"ANDHRA PRADESH" "East Godavari" 17.3213 82.0407 3 1.760321 1.935036 1.757222 1.722926 1.879776 1.877282 1.911202
"ANDHRA PRADESH" "East Godavari" 17.3213 82.0407 4 1.681082 2.006113 1.659624 1.749227 1.864686 1.898789 2.223191
"ANDHRA PRADESH" "East Godavari" 17.3213 82.0407 5 1.778992 2.451346 2.086234 1.976747 2.230505 1.910879 1.914892
"ANDHRA PRADESH" "East Godavari" 17.3213 82.0407 6 2.416438 2.145792 2.653355 2.153984 2.45271 2.329058 2.48887
"ANDHRA PRADESH" "East Godavari" 17.3213 82.0407 7 3.393621 3.058341 2.791372 2.005118 2.855509 3.480551 3.17864
"ANDHRA PRADESH" "East Godavari" 17.3213 82.0407 8 2.665884 2.605833 2.375462 3.258956 3.166419 3.685513 2.249233
"ANDHRA PRADESH" "East Godavari" 17.3213 82.0407 9 2.15716 2.018571 2.208713 1.722998 2.432045 1.953339 1.662759
"ANDHRA PRADESH" "East Godavari" 17.3213 82.0407 10 1.6794 1.821005 1.460138 1.546854 1.725753 1.699766 1.331305
"ANDHRA PRADESH" "East Godavari" 17.3213 82.0407 11 2.362202 1.841369 2.649868 2.37022 1.928938 1.887892 1.993252
"ANDHRA PRADESH" "East Godavari" 17.3213 82.0407 12 2.372175 2.15403 1.945038 1.970053 2.424489 2.20125 1.92171
"ANDHRA PRADESH" "Guntur" 16.3067 80.4365 1 2.011366 2.08107 1.888078 2.175307 2.046566 1.711987 2.04384
"ANDHRA PRADESH" "Guntur" 16.3067 80.4365 2 1.931765 2.307734 2.067085 2.44749 2.500002 1.985567 2.09666
"ANDHRA PRADESH" "Guntur" 16.3067 80.4365 3 2.373602 2.458717 2.115621 2.740993 2.991105 2.510094 2.925362
"ANDHRA PRADESH" "Guntur" 16.3067 80.4365 4 2.548758 2.958261 2.527299 2.988973 3.118593 3.251816 2.894578
"ANDHRA PRADESH" "Guntur" 16.3067 80.4365 5 2.386414 3.009452 3.237601 2.876161 3.080603 3.112051 2.889013
"ANDHRA PRADESH" "Guntur" 16.3067 80.4365 6 3.161067 3.017374 3.293492 2.636406 3.111402 2.99898 2.789651
"ANDHRA PRADESH" "Guntur" 16.3067 80.4365 7 3.664129 3.093009 3.062856 2.255607 3.121134 3.479086 3.147878
"ANDHRA PRADESH" "Guntur" 16.3067 80.4365 8 2.84606 2.704954 2.66013 3.023605 3.152747 3.65231 2.367398
"ANDHRA PRADESH" "Guntur" 16.3067 80.4365 9 2.383722 2.29152 2.370334 2.238135 2.599038 2.126679 1.888833
"ANDHRA PRADESH" "Guntur" 16.3067 80.4365 10 1.867388 1.978476 1.748224 1.915506 1.639327 2.064756 1.631842
"ANDHRA PRADESH" "Guntur" 16.3067 80.4365 11 2.148823 1.817687 2.462612 2.304302 1.947004 2.018751 2.124355
"ANDHRA PRADESH" "Guntur" 16.3067 80.4365 12 2.385847 2.008522 2.1362 2.018637 2.262868 2.301592 2.08919
"ANDHRA PRADESH" "Krishna" 16.61 80.7214 1 2.016982 2.063248 1.918352 2.203383 1.990902 1.675122 2.033587
"ANDHRA PRADESH" "Krishna" 16.61 80.7214 2 1.856081 2.255 2.059272 2.462871 2.399661 1.932588 1.99705
"ANDHRA PRADESH" "Krishna" 16.61 80.7214 3 2.299871 2.319313 1.99648 2.563258 2.707413 2.299645 2.696358
"ANDHRA PRADESH" "Krishna" 16.61 80.7214 4 2.327566 2.709238 2.341753 2.732137 2.801698 2.962754 2.68071
"ANDHRA PRADESH" "Krishna" 16.61 80.7214 5 2.228699 3.014823 3.060355 2.668153 2.813513 2.880606 2.612157
"ANDHRA PRADESH" "Krishna" 16.61 80.7214 6 3.126399 2.921671 3.138706 2.625664 3.053785 2.862261 2.795511
"ANDHRA PRADESH" "Krishna" 16.61 80.7214 7 3.683172 3.185294 3.050161 2.216544 3.118937 3.509848 3.201589
"ANDHRA PRADESH" "Krishna" 16.61 80.7214 8 2.813833 2.691771 2.644016 3.143722 3.177161 3.748501 2.381069
"ANDHRA PRADESH" "Krishna" 16.61 80.7214 9 2.350031 2.26027 2.358615 2.152197 2.562905 2.069306 1.837807
"ANDHRA PRADESH" "Krishna" 16.61 80.7214 10 1.858355 1.990195 1.677424 1.873514 1.681808 1.952695 1.604742
"ANDHRA PRADESH" "Krishna" 16.61 80.7214 11 2.297016 1.859923 2.603725 2.351421 2.027082 2.004835 2.172207
"ANDHRA PRADESH" "Krishna" 16.61 80.7214 12 2.444685 2.104958 2.152802 2.059896 2.402516 2.272051 2.0992
"ANDHRA PRADESH" "Prakasam" 15.3485 79.5603 1 2.056532 1.886978 1.878557 2.033217 2.102474 1.978589 2.157366
"ANDHRA PRADESH" "Prakasam" 15.3485 79.5603 2 2.212771 2.158808 2.061958 2.473369 2.435305 2.272676 2.309306
"ANDHRA PRADESH" "Prakasam" 15.3485 79.5603 3 2.228094 2.156715 2.145406 2.709743 2.781388 2.305505 2.603585
"ANDHRA PRADESH" "Prakasam" 15.3485 79.5603 4 2.488699 2.457773 2.239213 2.510946 2.591737 2.673691 2.364792
"ANDHRA PRADESH" "Prakasam" 15.3485 79.5603 5 2.438172 2.945487 3.199027 2.526551 2.601599 2.514883 2.920263
"ANDHRA PRADESH" "Prakasam" 15.3485 79.5603 6 3.734309 3.287393 3.806187 3.250664 3.603101 4.160601 3.837503
"ANDHRA PRADESH" "Prakasam" 15.3485 79.5603 7 4.495672 3.738028 3.756704 2.563712 4.048136 4.704184 3.989675
"ANDHRA PRADESH" "Prakasam" 15.3485 79.5603 8 3.301626 3.308958 3.112278 3.540206 4.179602 4.823696 2.978726
"ANDHRA PRADESH" "Prakasam" 15.3485 79.5603 9 3.134211 2.628434 3.065647 2.743994 2.827065 2.477021 2.204995
"ANDHRA PRADESH" "Prakasam" 15.3485 79.5603 10 2.264361 1.964804 1.912775 2.033182 1.671065 2.17169 1.69776
"ANDHRA PRADESH" "Prakasam" 15.3485 79.5603 11 2.124653 1.995422 2.382534 2.313824 1.98924 2.006056 2.220546
"ANDHRA PRADESH" "Prakasam" 15.3485 79.5603 12 2.34654 2.072243 1.885468 2.081381 2.116383 2.190996 2.209795
"ANDHRA PRADESH" "SPS Nellore" 14.2581 79.9193 1 2.44496 2.590836 2.425676 2.605971 2.501644 2.515942 2.757463
"ANDHRA PRADESH" "SPS Nellore" 14.2581 79.9193 2 2.508425 2.762568 2.567573 3.126446 3.197756 2.60129 2.800029
"ANDHRA PRADESH" "SPS Nellore" 14.2581 79.9193 3 3.205389 3.237282 2.953511 3.691676 4.10756 3.36654 4.029366
"ANDHRA PRADESH" "SPS Nellore" 14.2581 79.9193 4 3.662039 3.821054 3.530229 3.994833 4.279237 4.280625 4.094285
"ANDHRA PRADESH" "SPS Nellore" 14.2581 79.9193 5 3.212586 3.671073 4.05303 3.806825 4.215857 3.95336 3.870458
"ANDHRA PRADESH" "SPS Nellore" 14.2581 79.9193 6 3.785578 3.46171 3.949253 3.267265 3.760816 3.631304 3.623147
"ANDHRA PRADESH" "SPS Nellore" 14.2581 79.9193 7 4.028875 3.644278 3.422719 2.675529 3.510783 4.426352 3.740652
"ANDHRA PRADESH" "SPS Nellore" 14.2581 79.9193 8 3.309439 3.221068 3.280735 2.928878 3.648352 4.515591 3.001187
"ANDHRA PRADESH" "SPS Nellore" 14.2581 79.9193 9 3.065851 2.845231 2.899631 2.802588 3.053627 2.959442 2.436929
"ANDHRA PRADESH" "SPS Nellore" 14.2581 79.9193 10 2.54024 2.594199 2.424494 2.607889 2.401534 2.679014 2.344
"ANDHRA PRADESH" "SPS Nellore" 14.2581 79.9193 11 2.683003 2.720275 3.157192 3.142681 2.674055 2.672804 2.926601
"ANDHRA PRADESH" "SPS Nellore" 14.2581 79.9193 12 3.434187 2.877907 2.651093 3.038168 2.910573 2.87581 2.851641
"ANDHRA PRADESH" "Srikakulam" 18.2949 83.8938 1 3.073378 3.212418 2.792619 3.054945 2.819027 2.648022 2.986223
"ANDHRA PRADESH" "Srikakulam" 18.2949 83.8938 2 3.036501 3.030879 3.170356 3.00584 3.223879 2.857637 2.92332
"ANDHRA PRADESH" "Srikakulam" 18.2949 83.8938 3 3.2237 3.786842 3.660542 3.183375 4.176651 4.108239 4.844308
"ANDHRA PRADESH" "Srikakulam" 18.2949 83.8938 4 3.600516 5.530527 4.27437 4.589071 4.829042 5.10582 5.711472
end I have a dataset of windspeed for each district of INDIA by month for 50 years (only the first seven are displayed below). I want to find the QUARTERLY average and VARIANCE for each district. Any help would be appreciated. Data example below
Code:
* Example generated by -dataex-. For more info, type help dataex
clear
input str27 state str24 districts float(latitude longitude) byte month float(ws_2023 ws_2022 ws_2021 ws_2020 ws_2019 ws_2018 ws_2017)
"ANDAMAN AND NICOBAR ISLANDS" "North and Middle Andaman" 12.5601 92.8976 1 4.589247 3.613052 4.267717 4.635023 4.930599 3.780835 4.673967
"ANDAMAN AND NICOBAR ISLANDS" "North and Middle Andaman" 12.5601 92.8976 2 4.079226 4.215449 3.877388 4.538066 3.682131 3.676485 3.948466
"ANDAMAN AND NICOBAR ISLANDS" "North and Middle Andaman" 12.5601 92.8976 3 3.171698 2.644508 2.92275 3.351344 3.177872 2.893883 3.182198
"ANDAMAN AND NICOBAR ISLANDS" "North and Middle Andaman" 12.5601 92.8976 4 2.689871 2.156992 2.136186 2.872274 2.989198 2.722031 2.906296
"ANDAMAN AND NICOBAR ISLANDS" "North and Middle Andaman" 12.5601 92.8976 5 4.14325 5.455741 3.406546 3.855165 3.735876 2.974356 3.366552
"ANDAMAN AND NICOBAR ISLANDS" "North and Middle Andaman" 12.5601 92.8976 6 5.78509 4.582315 5.06107 4.991875 5.848218 6.734819 6.140237
"ANDAMAN AND NICOBAR ISLANDS" "North and Middle Andaman" 12.5601 92.8976 7 6.180731 4.725333 5.93688 4.066154 5.917521 6.973715 5.876394
"ANDAMAN AND NICOBAR ISLANDS" "North and Middle Andaman" 12.5601 92.8976 8 5.776236 5.244017 4.860325 5.294113 7.112219 7.073696 5.248257
"ANDAMAN AND NICOBAR ISLANDS" "North and Middle Andaman" 12.5601 92.8976 9 5.926691 4.340836 4.858127 4.631201 4.920815 4.280732 4.387124
"ANDAMAN AND NICOBAR ISLANDS" "North and Middle Andaman" 12.5601 92.8976 10 2.832476 4.086142 3.879084 3.524881 2.504806 3.259824 3.722174
"ANDAMAN AND NICOBAR ISLANDS" "North and Middle Andaman" 12.5601 92.8976 11 3.89687 3.366515 4.069301 4.236919 3.831769 4.167921 4.207607
"ANDAMAN AND NICOBAR ISLANDS" "North and Middle Andaman" 12.5601 92.8976 12 4.377546 4.54319 4.715546 4.315512 4.674977 4.296709 4.937579
"ANDAMAN AND NICOBAR ISLANDS" "South Andaman" 10.7449 92.5 1 6.210341 4.802261 6.2101 6.206068 6.416927 4.771069 6.214251
"ANDAMAN AND NICOBAR ISLANDS" "South Andaman" 10.7449 92.5 2 5.469119 5.677119 5.161079 6.119121 5.056155 5.20627 5.359843
"ANDAMAN AND NICOBAR ISLANDS" "South Andaman" 10.7449 92.5 3 4.022772 3.287575 3.717183 3.603297 3.418595 3.492516 3.59089
"ANDAMAN AND NICOBAR ISLANDS" "South Andaman" 10.7449 92.5 4 3.014578 2.633554 2.704057 3.562704 3.44037 3.314805 3.605515
"ANDAMAN AND NICOBAR ISLANDS" "South Andaman" 10.7449 92.5 5 5.758973 7.633964 4.783988 5.456239 5.274939 3.910879 4.607275
"ANDAMAN AND NICOBAR ISLANDS" "South Andaman" 10.7449 92.5 6 8.273372 6.252726 7.027379 7.017265 8.193433 9.077105 8.145121
"ANDAMAN AND NICOBAR ISLANDS" "South Andaman" 10.7449 92.5 7 8.684149 7.11254 8.41686 5.523673 7.773966 9.72518 8.343679
"ANDAMAN AND NICOBAR ISLANDS" "South Andaman" 10.7449 92.5 8 8.257681 7.702024 7.115208 7.253097 9.670324 9.874477 7.653042
"ANDAMAN AND NICOBAR ISLANDS" "South Andaman" 10.7449 92.5 9 8.256769 6.616227 6.917697 6.731298 6.786049 5.860077 6.402016
"ANDAMAN AND NICOBAR ISLANDS" "South Andaman" 10.7449 92.5 10 3.68233 4.764365 5.604181 5.805154 3.288253 3.944639 5.052252
"ANDAMAN AND NICOBAR ISLANDS" "South Andaman" 10.7449 92.5 11 5.013813 4.12091 4.951137 5.162457 5.361066 5.314161 4.652676
"ANDAMAN AND NICOBAR ISLANDS" "South Andaman" 10.7449 92.5 12 5.805525 6.347145 6.215302 5.600912 6.451589 5.682451 6.354571
"ANDHRA PRADESH" "Chittoor" 13.2172 79.1003 1 2.071669 1.906998 1.939836 2.075697 2.161556 1.867749 2.186907
"ANDHRA PRADESH" "Chittoor" 13.2172 79.1003 2 2.252566 2.123164 2.052436 2.442608 2.446047 2.056368 2.235332
"ANDHRA PRADESH" "Chittoor" 13.2172 79.1003 3 2.232489 2.296364 2.168355 2.435328 2.616105 2.0682 2.37214
"ANDHRA PRADESH" "Chittoor" 13.2172 79.1003 4 2.163504 2.317636 2.062944 2.230672 2.365663 2.306504 2.151902
"ANDHRA PRADESH" "Chittoor" 13.2172 79.1003 5 2.233094 2.828299 2.821097 2.442079 2.263708 2.127188 2.934911
"ANDHRA PRADESH" "Chittoor" 13.2172 79.1003 6 3.514094 2.797159 3.412144 3.196953 3.428785 3.854449 3.74473
"ANDHRA PRADESH" "Chittoor" 13.2172 79.1003 7 4.419012 3.583243 3.530141 2.285392 3.653605 4.687582 4.112722
"ANDHRA PRADESH" "Chittoor" 13.2172 79.1003 8 2.849966 3.091185 2.984837 3.136886 3.922278 5.022915 2.880093
"ANDHRA PRADESH" "Chittoor" 13.2172 79.1003 9 2.927668 2.581071 2.732151 2.731299 2.755776 2.25119 2.190346
"ANDHRA PRADESH" "Chittoor" 13.2172 79.1003 10 1.935015 2.111777 1.777521 2.475076 1.535323 1.955869 1.695318
"ANDHRA PRADESH" "Chittoor" 13.2172 79.1003 11 2.019673 2.092834 2.257045 2.613384 2.126691 2.197218 2.132412
"ANDHRA PRADESH" "Chittoor" 13.2172 79.1003 12 2.483747 2.478249 1.963105 2.345541 2.264333 2.242998 2.073321
"ANDHRA PRADESH" "East Godavari" 17.3213 82.0407 1 1.987441 1.91066 1.86635 1.984144 1.924251 1.669018 1.983049
"ANDHRA PRADESH" "East Godavari" 17.3213 82.0407 2 1.724246 1.956904 1.953315 2.075664 1.991458 1.761446 1.777079
"ANDHRA PRADESH" "East Godavari" 17.3213 82.0407 3 1.760321 1.935036 1.757222 1.722926 1.879776 1.877282 1.911202
"ANDHRA PRADESH" "East Godavari" 17.3213 82.0407 4 1.681082 2.006113 1.659624 1.749227 1.864686 1.898789 2.223191
"ANDHRA PRADESH" "East Godavari" 17.3213 82.0407 5 1.778992 2.451346 2.086234 1.976747 2.230505 1.910879 1.914892
"ANDHRA PRADESH" "East Godavari" 17.3213 82.0407 6 2.416438 2.145792 2.653355 2.153984 2.45271 2.329058 2.48887
"ANDHRA PRADESH" "East Godavari" 17.3213 82.0407 7 3.393621 3.058341 2.791372 2.005118 2.855509 3.480551 3.17864
"ANDHRA PRADESH" "East Godavari" 17.3213 82.0407 8 2.665884 2.605833 2.375462 3.258956 3.166419 3.685513 2.249233
"ANDHRA PRADESH" "East Godavari" 17.3213 82.0407 9 2.15716 2.018571 2.208713 1.722998 2.432045 1.953339 1.662759
"ANDHRA PRADESH" "East Godavari" 17.3213 82.0407 10 1.6794 1.821005 1.460138 1.546854 1.725753 1.699766 1.331305
"ANDHRA PRADESH" "East Godavari" 17.3213 82.0407 11 2.362202 1.841369 2.649868 2.37022 1.928938 1.887892 1.993252
"ANDHRA PRADESH" "East Godavari" 17.3213 82.0407 12 2.372175 2.15403 1.945038 1.970053 2.424489 2.20125 1.92171
"ANDHRA PRADESH" "Guntur" 16.3067 80.4365 1 2.011366 2.08107 1.888078 2.175307 2.046566 1.711987 2.04384
"ANDHRA PRADESH" "Guntur" 16.3067 80.4365 2 1.931765 2.307734 2.067085 2.44749 2.500002 1.985567 2.09666
"ANDHRA PRADESH" "Guntur" 16.3067 80.4365 3 2.373602 2.458717 2.115621 2.740993 2.991105 2.510094 2.925362
"ANDHRA PRADESH" "Guntur" 16.3067 80.4365 4 2.548758 2.958261 2.527299 2.988973 3.118593 3.251816 2.894578
"ANDHRA PRADESH" "Guntur" 16.3067 80.4365 5 2.386414 3.009452 3.237601 2.876161 3.080603 3.112051 2.889013
"ANDHRA PRADESH" "Guntur" 16.3067 80.4365 6 3.161067 3.017374 3.293492 2.636406 3.111402 2.99898 2.789651
"ANDHRA PRADESH" "Guntur" 16.3067 80.4365 7 3.664129 3.093009 3.062856 2.255607 3.121134 3.479086 3.147878
"ANDHRA PRADESH" "Guntur" 16.3067 80.4365 8 2.84606 2.704954 2.66013 3.023605 3.152747 3.65231 2.367398
"ANDHRA PRADESH" "Guntur" 16.3067 80.4365 9 2.383722 2.29152 2.370334 2.238135 2.599038 2.126679 1.888833
"ANDHRA PRADESH" "Guntur" 16.3067 80.4365 10 1.867388 1.978476 1.748224 1.915506 1.639327 2.064756 1.631842
"ANDHRA PRADESH" "Guntur" 16.3067 80.4365 11 2.148823 1.817687 2.462612 2.304302 1.947004 2.018751 2.124355
"ANDHRA PRADESH" "Guntur" 16.3067 80.4365 12 2.385847 2.008522 2.1362 2.018637 2.262868 2.301592 2.08919
"ANDHRA PRADESH" "Krishna" 16.61 80.7214 1 2.016982 2.063248 1.918352 2.203383 1.990902 1.675122 2.033587
"ANDHRA PRADESH" "Krishna" 16.61 80.7214 2 1.856081 2.255 2.059272 2.462871 2.399661 1.932588 1.99705
"ANDHRA PRADESH" "Krishna" 16.61 80.7214 3 2.299871 2.319313 1.99648 2.563258 2.707413 2.299645 2.696358
"ANDHRA PRADESH" "Krishna" 16.61 80.7214 4 2.327566 2.709238 2.341753 2.732137 2.801698 2.962754 2.68071
"ANDHRA PRADESH" "Krishna" 16.61 80.7214 5 2.228699 3.014823 3.060355 2.668153 2.813513 2.880606 2.612157
"ANDHRA PRADESH" "Krishna" 16.61 80.7214 6 3.126399 2.921671 3.138706 2.625664 3.053785 2.862261 2.795511
"ANDHRA PRADESH" "Krishna" 16.61 80.7214 7 3.683172 3.185294 3.050161 2.216544 3.118937 3.509848 3.201589
"ANDHRA PRADESH" "Krishna" 16.61 80.7214 8 2.813833 2.691771 2.644016 3.143722 3.177161 3.748501 2.381069
"ANDHRA PRADESH" "Krishna" 16.61 80.7214 9 2.350031 2.26027 2.358615 2.152197 2.562905 2.069306 1.837807
"ANDHRA PRADESH" "Krishna" 16.61 80.7214 10 1.858355 1.990195 1.677424 1.873514 1.681808 1.952695 1.604742
"ANDHRA PRADESH" "Krishna" 16.61 80.7214 11 2.297016 1.859923 2.603725 2.351421 2.027082 2.004835 2.172207
"ANDHRA PRADESH" "Krishna" 16.61 80.7214 12 2.444685 2.104958 2.152802 2.059896 2.402516 2.272051 2.0992
"ANDHRA PRADESH" "Prakasam" 15.3485 79.5603 1 2.056532 1.886978 1.878557 2.033217 2.102474 1.978589 2.157366
"ANDHRA PRADESH" "Prakasam" 15.3485 79.5603 2 2.212771 2.158808 2.061958 2.473369 2.435305 2.272676 2.309306
"ANDHRA PRADESH" "Prakasam" 15.3485 79.5603 3 2.228094 2.156715 2.145406 2.709743 2.781388 2.305505 2.603585
"ANDHRA PRADESH" "Prakasam" 15.3485 79.5603 4 2.488699 2.457773 2.239213 2.510946 2.591737 2.673691 2.364792
"ANDHRA PRADESH" "Prakasam" 15.3485 79.5603 5 2.438172 2.945487 3.199027 2.526551 2.601599 2.514883 2.920263
"ANDHRA PRADESH" "Prakasam" 15.3485 79.5603 6 3.734309 3.287393 3.806187 3.250664 3.603101 4.160601 3.837503
"ANDHRA PRADESH" "Prakasam" 15.3485 79.5603 7 4.495672 3.738028 3.756704 2.563712 4.048136 4.704184 3.989675
"ANDHRA PRADESH" "Prakasam" 15.3485 79.5603 8 3.301626 3.308958 3.112278 3.540206 4.179602 4.823696 2.978726
"ANDHRA PRADESH" "Prakasam" 15.3485 79.5603 9 3.134211 2.628434 3.065647 2.743994 2.827065 2.477021 2.204995
"ANDHRA PRADESH" "Prakasam" 15.3485 79.5603 10 2.264361 1.964804 1.912775 2.033182 1.671065 2.17169 1.69776
"ANDHRA PRADESH" "Prakasam" 15.3485 79.5603 11 2.124653 1.995422 2.382534 2.313824 1.98924 2.006056 2.220546
"ANDHRA PRADESH" "Prakasam" 15.3485 79.5603 12 2.34654 2.072243 1.885468 2.081381 2.116383 2.190996 2.209795
"ANDHRA PRADESH" "SPS Nellore" 14.2581 79.9193 1 2.44496 2.590836 2.425676 2.605971 2.501644 2.515942 2.757463
"ANDHRA PRADESH" "SPS Nellore" 14.2581 79.9193 2 2.508425 2.762568 2.567573 3.126446 3.197756 2.60129 2.800029
"ANDHRA PRADESH" "SPS Nellore" 14.2581 79.9193 3 3.205389 3.237282 2.953511 3.691676 4.10756 3.36654 4.029366
"ANDHRA PRADESH" "SPS Nellore" 14.2581 79.9193 4 3.662039 3.821054 3.530229 3.994833 4.279237 4.280625 4.094285
"ANDHRA PRADESH" "SPS Nellore" 14.2581 79.9193 5 3.212586 3.671073 4.05303 3.806825 4.215857 3.95336 3.870458
"ANDHRA PRADESH" "SPS Nellore" 14.2581 79.9193 6 3.785578 3.46171 3.949253 3.267265 3.760816 3.631304 3.623147
"ANDHRA PRADESH" "SPS Nellore" 14.2581 79.9193 7 4.028875 3.644278 3.422719 2.675529 3.510783 4.426352 3.740652
"ANDHRA PRADESH" "SPS Nellore" 14.2581 79.9193 8 3.309439 3.221068 3.280735 2.928878 3.648352 4.515591 3.001187
"ANDHRA PRADESH" "SPS Nellore" 14.2581 79.9193 9 3.065851 2.845231 2.899631 2.802588 3.053627 2.959442 2.436929
"ANDHRA PRADESH" "SPS Nellore" 14.2581 79.9193 10 2.54024 2.594199 2.424494 2.607889 2.401534 2.679014 2.344
"ANDHRA PRADESH" "SPS Nellore" 14.2581 79.9193 11 2.683003 2.720275 3.157192 3.142681 2.674055 2.672804 2.926601
"ANDHRA PRADESH" "SPS Nellore" 14.2581 79.9193 12 3.434187 2.877907 2.651093 3.038168 2.910573 2.87581 2.851641
"ANDHRA PRADESH" "Srikakulam" 18.2949 83.8938 1 3.073378 3.212418 2.792619 3.054945 2.819027 2.648022 2.986223
"ANDHRA PRADESH" "Srikakulam" 18.2949 83.8938 2 3.036501 3.030879 3.170356 3.00584 3.223879 2.857637 2.92332
"ANDHRA PRADESH" "Srikakulam" 18.2949 83.8938 3 3.2237 3.786842 3.660542 3.183375 4.176651 4.108239 4.844308
"ANDHRA PRADESH" "Srikakulam" 18.2949 83.8938 4 3.600516 5.530527 4.27437 4.589071 4.829042 5.10582 5.711472
end data analysis MATLAB Answers — New Questions
Unable to digital sign the pdf downloaded from sharepoint
Hello All ,
I have an pdf in my local machine, Normally I am able to digital sign that pdf using Adobe Acrobat reader as shown in below picture
When I upload the same pdf to Sharepoint and edit that pdf in sharepoint ad add some text on it like shown in in below image, and download the pdf to local machine and then the digital sign is not working
Digital signature is not being added after adding text into pdf using sharepoint
Here is some more info on error that i got from adobe
Hello All , I have an pdf in my local machine, Normally I am able to digital sign that pdf using Adobe Acrobat reader as shown in below picture When I upload the same pdf to Sharepoint and edit that pdf in sharepoint ad add some text on it like shown in in below image, and download the pdf to local machine and then the digital sign is not working Digital signature is not being added after adding text into pdf using sharepointHere is some more info on error that i got from adobe Read More
Sign In button stopped being shown within the Sign In prompt
Good afternoon,
Today we encountered the issue: the Sign In button stopped being shown within the Sign In prompt of OAuthPrompt class:
We use this class for SSO in MS Teams in our solution for several years without any issues and changes. The implementation is done exactly as suggested in samples and according to documentation from the links below:
Here is our code:
// Prompt for OAUTH
this.addDialog(
new OAuthPrompt(ComponentDialogConstants.OAUTH_PROMPT, {
connectionName: process.env.MS_CONNECTION_NAME,
title: ‘Sign In’,
timeout: 300000
}));
The productive usage of our clients’ integrated bots is affected. The issue is reproduced in all the environments for old, new version of MS Teams and in Web, so there is no workaround. Therefore please consider this issue with the priority very high.
Thank you,
Best regards,
Darya
Good afternoon, Today we encountered the issue: the Sign In button stopped being shown within the Sign In prompt of OAuthPrompt class:We use this class for SSO in MS Teams in our solution for several years without any issues and changes. The implementation is done exactly as suggested in samples and according to documentation from the links below: https://learn.microsoft.com/en-us/javascript/api/botbuilder-dialogs/oauthprompt?view=botbuilder-ts-latest https://github.com/microsoft/BotBuilder-Samples/blob/main/samples/javascript_nodejs/18.bot-authentication/dialogs/mainDialog.js Here is our code: // Prompt for OAUTH
this.addDialog(
new OAuthPrompt(ComponentDialogConstants.OAUTH_PROMPT, {
connectionName: process.env.MS_CONNECTION_NAME,
title: ‘Sign In’,
timeout: 300000
}));
The productive usage of our clients’ integrated bots is affected. The issue is reproduced in all the environments for old, new version of MS Teams and in Web, so there is no workaround. Therefore please consider this issue with the priority very high. Thank you,Best regards,Darya Read More
macro to insert lines when comparing 2 lists or form to update 2 lists
Hello,
i’ve currently got 2 lists :
list 1 is a catalog of toolslist 2 is a the tracking of orders from the catalog
my aim is to declare that there has been an order in the the catalog (list 1) by putting a “Y” in a column and then running a macro that will add the new lines into the list 2 without deleting the old ones and the sorting by “internal ref”
both lists are in the same work book just different pages
My main question is how can i update list 2 with out deleting the lines currently present, nor creating duplicates ?
i was thinking about going ahead this way :
1 – fetch last line of list 2
2 – copy/paste or advanced filter to fetch all the orders
3 – sort by internal ref
but that doesn’t solve the duplicate error … maybe it could be done with an “if” or ticking “unique records only” in the advanced filter?
if this option was to complicated i was thinking of a “place order” form that would update list 1 and then add the affected lines to list 2 … the form would need to be able to place multiple orders at once
list 1 looks like this :
Tool nametool versionInternal refTool priceOdered by XOrdered by YZTool 1ATool 1_ind A99 Tool 1BTool 1_ind B56 YTool 1CTool 1_ind C7Y Tool 2ATool 2_ind A456YYtool 3Atool 3_ind A456YYTool 4ATool 4_ind A46Y
List 2 looks like (once filtered by internal ref):
Internal refTool nametool versionClientinternal priceinternal order dateinternal delivery datecommentsclient ship dateTool 1_ind BTool 1BY Tool 1_ind CTool 1CX Tool 2_ind ATool 2AX Tool 2_ind ATool 2AY tool 3_ind Atool 3AX tool 3_ind Atool 3AY Tool 4_ind ATool 4AX
Hello, i’ve currently got 2 lists : list 1 is a catalog of toolslist 2 is a the tracking of orders from the catalogmy aim is to declare that there has been an order in the the catalog (list 1) by putting a “Y” in a column and then running a macro that will add the new lines into the list 2 without deleting the old ones and the sorting by “internal ref” both lists are in the same work book just different pages My main question is how can i update list 2 with out deleting the lines currently present, nor creating duplicates ? i was thinking about going ahead this way :1 – fetch last line of list 22 – copy/paste or advanced filter to fetch all the orders3 – sort by internal refbut that doesn’t solve the duplicate error … maybe it could be done with an “if” or ticking “unique records only” in the advanced filter? if this option was to complicated i was thinking of a “place order” form that would update list 1 and then add the affected lines to list 2 … the form would need to be able to place multiple orders at once list 1 looks like this :Tool nametool versionInternal refTool priceOdered by XOrdered by YZTool 1ATool 1_ind A99 Tool 1BTool 1_ind B56 YTool 1CTool 1_ind C7Y Tool 2ATool 2_ind A456YYtool 3Atool 3_ind A456YYTool 4ATool 4_ind A46Y List 2 looks like (once filtered by internal ref):Internal refTool nametool versionClientinternal priceinternal order dateinternal delivery datecommentsclient ship dateTool 1_ind BTool 1BY Tool 1_ind CTool 1CX Tool 2_ind ATool 2AX Tool 2_ind ATool 2AY tool 3_ind Atool 3AX tool 3_ind Atool 3AY Tool 4_ind ATool 4AX Read More