I get an error when trying to plot
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Elizabeth Frenzel
am 15 Mai 2023
Beantwortet: Image Analyst
am 15 Mai 2023
I do not get a line when I graph this. I am very new to coding and am struggling with the graphs.
clear
q=38.89 ; %W/m^3
r_o=0.04 ;
T_oo=5 ;
k=0.5 ;
c=10.1 ;
V=.1:1.0 ;
Temp(V)=q/(6*k)*(r_o^2)+(q*r_o)/(3*(c*V^0.425))+T_oo ;
Temp(Temp==0)=[];
figure
plot(.1:1,Temp)
xlabel('V *10^-1(m/s)')
xlim('auto')
ylim('auto')
ylabel('Temp (C)')
title('Temperature of center vs air velocity')
0 Kommentare
Akzeptierte Antwort
Image Analyst
am 15 Mai 2023
Try making V a vector, and then using ./ and .^ because it's a vector:
clear
q=38.89 ; %W/m^3
r_o=0.04 ;
T_oo=5 ;
k=0.5 ;
c=10.1 ;
V = linspace(.1, 1.0, 500);
Temp = q/(6*k)*(r_o^2)+(q*r_o) ./ (3*(c*V.^0.425)) + T_oo
Temp(Temp==0)=[];
figure
plot(V, Temp, 'b-')
grid on;
xlabel('V *10^-1(m/s)')
xlim('auto')
ylim('auto')
ylabel('Temp (C)')
title('Temperature of center vs air velocity')
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Printing and Saving finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!