How to mark points at 1-5 on the x-axis in the plot
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Aijalon Marsh
am 13 Okt. 2023
Bearbeitet: Star Strider
am 13 Okt. 2023
clc;
clear all ;
Ld=(0:0.00005:0.005);
w=0.001;
L=0.007;
P=4*0.001;
Ta=25;
h=375;
Kf=175;
Kd=0.032;
Tb=75;
Ap=3.02*10^-3;
N=238;
Ac=10^-6;
m=92.6;
Lf=L-Ld;
Rtf=(cosh(m.*Lf)+(h./(m.*Kf)).*sinh(m.*Lf))./(sqrt(4*h.*(w)^3*Kf).*(sinh(m.*Lf)+h./(m.*Kf)).*cosh(m.*Lf));
R_fins=Rtf/N;
Rf_cond=Ld/(Kf*N*Ac);
Rd_cond=Ld/(Kd*(Ap-N*Ac));
Ad=Ld./(Kd*Rd_cond);
R_conv=1./(h*Ad);
q=(Tb-Ta)./(Rd_cond+R_conv)+(Tb-Ta)./(Rf_cond+R_fins);
Q=min(q);
figure
plot(Ld, q);
xlabel('Dust layer thickness, Ld (m)');
ylabel('Heat Rate, q(W)');
grid on;
fprintf("Total heat rate %.2f°C\n", Q);
2 Kommentare
Dyuman Joshi
am 13 Okt. 2023
Bearbeitet: Dyuman Joshi
am 13 Okt. 2023
What do you mean by "mark points at 1-5 on the x-axis in the plot"?
Could you give an example of what the expected output is?
Akzeptierte Antwort
Star Strider
am 13 Okt. 2023
Bearbeitet: Star Strider
am 13 Okt. 2023
One possibility —
clc;
clear all ;
Ld=(0:0.00005:0.005);
w=0.001;
L=0.007;
P=4*0.001;
Ta=25;
h=375;
Kf=175;
Kd=0.032;
Tb=75;
Ap=3.02*10^-3;
N=238;
Ac=10^-6;
m=92.6;
Lf=L-Ld;
Rtf=(cosh(m.*Lf)+(h./(m.*Kf)).*sinh(m.*Lf))./(sqrt(4*h.*(w)^3*Kf).*(sinh(m.*Lf)+h./(m.*Kf)).*cosh(m.*Lf));
R_fins=Rtf/N;
Rf_cond=Ld/(Kf*N*Ac);
Rd_cond=Ld/(Kd*(Ap-N*Ac));
Ad=Ld./(Kd*Rd_cond);
R_conv=1./(h*Ad);
q=(Tb-Ta)./(Rd_cond+R_conv)+(Tb-Ta)./(Rf_cond+R_fins);
Q=min(q);
figure
plot(Ld, q);
xlabel('Dust layer thickness, Ld (m)');
ylabel('Heat Rate, q(W)');
grid on;
fprintf("Total heat rate %.2f°C\n", Q);
xlim([0 6]*1E-3)
Ldq = get(gca,'XTick');
qv = interp1(Ld, q, Ldq);
idx = isfinite(qv);
text(Ldq(idx), qv(idx), compose('Ld = %.3f\nq = %8.3f\n\\downarrow',[Ldq(idx); qv(idx)]'), 'Horiz','left', 'Vert','bottom', 'FontSize',8)
.
0 Kommentare
Weitere Antworten (1)
Dyuman Joshi
am 13 Okt. 2023
Bearbeitet: Dyuman Joshi
am 13 Okt. 2023
Ld=(0:0.00005:0.005);
w=0.001;
L=0.007;
P=4*0.001;
Ta=25;
h=375;
Kf=175;
Kd=0.032;
Tb=75;
Ap=3.02*10^-3;
N=238;
Ac=10^-6;
m=92.6;
Lf=L-Ld;
Rtf=(cosh(m.*Lf)+(h./(m.*Kf)).*sinh(m.*Lf))./(sqrt(4*h.*(w)^3*Kf).*(sinh(m.*Lf)+h./(m.*Kf)).*cosh(m.*Lf));
R_fins=Rtf/N;
Rf_cond=Ld/(Kf*N*Ac);
Rd_cond=Ld/(Kd*(Ap-N*Ac));
Ad=Ld./(Kd*Rd_cond);
R_conv=1./(h*Ad);
q=(Tb-Ta)./(Rd_cond+R_conv)+(Tb-Ta)./(Rf_cond+R_fins);
Q=min(q);
figure
p = plot(Ld, q);
xlabel('Dust layer thickness, Ld (m)');
ylabel('Heat Rate, q(W)');
grid on;
fprintf("Total heat rate %.2f°C\n", Q);
Since only 1 data-tip can be added at a time, use a for loop -
%Define the x values to get data-tips for
vec = (1:5)/1e3;
for k=vec
%% Using tolerance to compare floating point numbers
%The highest significant digit of values in Ld is 5, corresponding to
%10^-5 or 1e-5, thus select a tolerance smaller than that
idx = abs(Ld-k)<1e-6;
datatip(p, Ld(idx), q(idx))
end
As the graph is monotonic, there is only 1 y-point corresponding to a single x-point. Thus we can directly use logical-indexing.
For other cases, the code might need modifications.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Graphics Object Programming finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!