
I must take this plot I have and adjust it so the line starts at different points within the plot and I'm not sure how to do so
24 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I have to take the current plot and not adjust the tangent line but the curved chord distriution line and adjust it to start of .5 for the starting line of CrR plot, and 0 for the ending of the line of CrR plot similarily to how the professor showed within the picture below
Here is the problem statment

Where C(m) is CrR and r(m) is Rht

Here is the code...
%% Calculation Problem 2
%Given Data Problems 1-4
dd = load('NEWPROB6.txt') %Data loading for airfoil
alpha = dd(:,1); %Angle of attacks (Degreed)
CL = dd(:,2); %Lift coefficient
CD = dd(:,3); %Drag coefficient
Rh = 0.75; %Turbine hub radius (m)
Rt = 15; %Turbine blade tip radius (m)
Rht = linspace(Rh,Rt,10); %r/R radius hub to tip (m)
Rr = Rht/Rt;
B = 3; %Number of blades on the turbine
TSR = 8; %Tips-speed ratio
%Calculation Problem 1
CLD = CL./CD %Lift-to-Drag Ratio
TCL = 1.0280 %Lift coefficient associated with maximum lift-to-drag ratio
Talpha = 6 %Target angle of attack (degrees)
%Calculation Problem 2
Phi = atand(2./(3*TSR*(Rr))) %Local inflow angle (degrees)
CrR = Rt*(8*pi*sind(Phi))./(3*B*TCL*TSR); %chord distribution
Beta = Phi-Talpha
subplot(2,1,1)
plot(Rht,CrR, 'b.-', 'LineWidth',2, 'MarkerSize', 20)
halfpoints = round(numel(CrR)/2)
title('Rotor Radius Vs. Chord Distribution')
xlabel('r/R')
ylabel('Chord Distribution (m)')
grid on
hold on
% Assume x and y are your data vectors
xline(Rht(halfpoints), 'Color', 'r')
% Get halfway index
RhtHalf = Rht(halfpoints : end)
CrRHalf = CrR(halfpoints : end)
coefficients = polyfit(RhtHalf, CrRHalf, 1)
RhtFitted = linspace(2, 15, 15)
CrRFitted = polyval(coefficients, RhtFitted);
plot(RhtFitted, CrRFitted, 'R--', 'LineWidth', 2)
grid on
legend('Original Data', 'Linear Fit');
hold off
subplot(2,1,2)
plot(Rht,Beta, 'b.-', 'LineWidth',2, 'MarkerSize', 20)
halfpoints = round(numel(Beta)/2)
title('Rotor Radius Vs. Blade Pitch')
xlabel('r/R')
ylabel('Blade Pitch (degrees)')
grid on
hold on
% Assume x and y are your data vectors
xline(Beta(halfpoints), 'Color', 'r')
% Get halfway index
RhtHalf = Rht(halfpoints : end)
BetaHalf = Beta(halfpoints : end)
coefficients = polyfit(RhtHalf, BetaHalf, 1)
RhtFitted = linspace(2, 15, 15)
BetaFitted = polyval(coefficients, RhtFitted);
plot(RhtFitted, BetaFitted, 'R--', 'LineWidth', 2)
grid on
legend('Chord across rotor', 'Linear Fit');
hold off
Here is the mentioned file
0.0 0.3983 0.0066 0.0017 -0.0927 0.6330 0.6222
0.5 0.4536 0.0066 0.0018 -0.0926 0.6172 0.6320
1.0 0.5091 0.0068 0.0018 -0.0925 0.6013 0.6389
1.5 0.5641 0.0069 0.0019 -0.0924 0.5857 0.6453
2.0 0.6189 0.0070 0.0020 -0.0923 0.5699 0.6517
2.5 0.6733 0.0072 0.0021 -0.0921 0.5540 0.6577
3.0 0.7270 0.0073 0.0023 -0.0917 0.5358 0.6644
3.5 0.7792 0.0075 0.0024 -0.0911 0.5135 0.6714
4.0 0.8310 0.0078 0.0026 -0.0905 0.4921 0.6782
4.5 0.8822 0.0080 0.0028 -0.0897 0.4682 0.6864
5.0 0.9328 0.0083 0.0031 -0.0889 0.4464 0.6948
5.5 0.9812 0.0086 0.0034 -0.0877 0.4199 0.7041
6.0 1.0280 0.0090 0.0037 -0.0861 0.3896 0.7145
6.5 1.0728 0.0094 0.0041 -0.0843 0.3581 0.7262
7.0 1.1138 0.0100 0.0045 -0.0817 0.3214 0.7394
7.5 1.1459 0.0107 0.0051 -0.0776 0.2766 0.7556
8.0 1.1724 0.0117 0.0059 -0.0726 0.2228 0.7750
8.5 1.1957 0.0128 0.0068 -0.0673 0.1745 0.7994
9.0 1.2193 0.0139 0.0079 -0.0622 0.1382 0.8326
9.5 1.2403 0.0149 0.0089 -0.0568 0.1102 0.9219
10.0 1.2659 0.0161 0.0102 -0.0528 0.0907 0.9825
10.5 1.2906 0.0175 0.0114 -0.0489 0.0728 1.0000
11.0 1.3137 0.0191 0.0130 -0.0452 0.0602 1.0000
11.5 1.3367 0.0208 0.0147 -0.0419 0.0518 1.0000
12.0 1.3589 0.0226 0.0166 -0.0387 0.0458 1.0000
12.5 1.3796 0.0247 0.0187 -0.0358 0.0412 1.0000
13.0 1.3951 0.0273 0.0213 -0.0328 0.0368 1.0000
13.5 1.4159 0.0297 0.0238 -0.0307 0.0345 1.0000
14.0 1.4268 0.0330 0.0271 -0.0282 0.0316 1.0000
14.5 1.4433 0.0360 0.0303 -0.0266 0.0300 1.0000
15.0 1.4559 0.0396 0.0340 -0.0251 0.0282 1.0000
15.5 1.4590 0.0443 0.0388 -0.0239 0.0264 1.0000
16.0 1.4703 0.0485 0.0431 -0.0233 0.0253 1.0000
16.5 1.4782 0.0532 0.0480 -0.0231 0.0241 1.0000
17.0 1.4794 0.0590 0.0539 -0.0233 0.0230 1.0000
17.5 1.4707 0.0663 0.0614 -0.0242 0.0220 1.0000
18.0 1.4743 0.0723 0.0676 -0.0254 0.0214 1.0000
18.5 1.4732 0.0792 0.0746 -0.0272 0.0208 1.0000
19.0 1.4701 0.0867 0.0822 -0.0294 0.0201 1.0000
19.5 1.4626 0.0950 0.0907 -0.0324 0.0196 1.0000
20.0 1.4501 0.1043 0.1002 -0.0360 0.0190 1.0000
I am not sure how to exactly adjust the curve to make it start at another point to make it more "realistic"
0 Kommentare
Antworten (1)
Mathieu NOE
am 2 Jun. 2025
hello @ryan
maybe this ?
Nb that Imodified quite a bit your original code
for example as we assume the x axis is the reduced radius (starting at 0 (hub) and ending at 100 % (tip) as in your photo ) , I have changed the code that computes Rr as shown below (IMHO : Rr = (R-Rhub) / (Rtip-Rhub))
then I decided how to modify the shape at the root and the tip to have the requested root at 0.5 m , a S shaped transition to the linear (fit) segment around 20% of the blade length, and at the tip also I introduce a "closing " shape to force the chord length to reach 0 at the tip
the final data (modified chord length) is the green plot
hope it helps

%% Calculation Problem 2
%Given Data Problems 1-4
dd = readmatrix('NEWPROB6.txt'); %Data loading for airfoil
alpha = dd(:,1); %Angle of attacks (Degreed)
CL = dd(:,2); %Lift coefficient
CD = dd(:,3); %Drag coefficient
Rh = 0.75; %Turbine hub radius (m)
Rt = 15; %Turbine blade tip radius (m)
% Rht = linspace(Rh,Rt,10); %r/R radius hub to tip (m)
% Rr = Rht/Rt;
Rht = linspace(0,Rt-Rh,100);
Rr = Rht/(Rt-Rh);%r/R radius hub to tip (m)
B = 3; %Number of blades on the turbine
TSR = 8; %Tips-speed ratio
%Calculation Problem 1
CLD = CL./CD; %Lift-to-Drag Ratio
TCL = 1.0280; %Lift coefficient associated with maximum lift-to-drag ratio
Talpha = 6; %Target angle of attack (degrees)
%Calculation Problem 2
Phi = atand(2./(3*TSR*(Rr))); %Local inflow angle (degrees)
CrR = Rt*(8*pi*sind(Phi))./(3*B*TCL*TSR); %chord distribution
Beta = Phi-Talpha;
% plot(Rht,CrR, 'b.-', 'LineWidth',2, 'MarkerSize', 20)
plot(Rr,CrR, 'b-', 'LineWidth',2, 'MarkerSize', 20)
% title('Rotor Radius Vs. Chord Distribution')
title('Chord Distribution Vs. Rotor Radius')
xlabel('r/R')
ylabel('Chord Distribution (m)')
grid on
hold on
% linear segment (polyfit) done for Rr>0.2 (20%)
ind = Rr>0.2;
Rri = Rr(ind);
CrRi = CrR(ind);
plot(Rri,CrRi, 'c.-', 'LineWidth',2, 'MarkerSize', 20)
coefficients = polyfit(Rri, CrRi, 1);
CrRFitted = polyval(coefficients, Rr);
plot(Rr, CrRFitted, 'r--', 'LineWidth', 2)
grid on
% create a smooth transition for the 0 to 20% of the blade length
% using a sigmoid function of general form : y = a+(1-a)./(1 + exp(-b*(x-c)));
% a must be computed using CrRFitted(1) to get the desired value of 0.5
b = 40;
c = 0.1;
tmp = (1 + exp(b*c));
a= (0.5*tmp/CrRFitted(1) -1)/(tmp-1);
y = a+(1-a)./(1 + exp(-b*(Rr-c))); % sigmoid function
CrR0 = CrRFitted.*y; % CrR0 should start with y = 0.5 at root
% create a smooth end for the last 10% of the blade length
% rounded end
ind = Rr>=0.9;
Rr2 = Rr(ind);
x = (Rr2-Rr2(1))/(1-Rr2(1));
w = (cos(pi/2*x)).^0.5;
CrR0(ind) = CrR0(ind).*w;
plot(Rr, CrR0, 'g', 'LineWidth', 2)
legend('Full Data','Selected Data', 'Linear Fit' ,'Final data');
hold off
2 Kommentare
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!