the plot window appears but , no graphs , i am in a bad need to help here

1 view (last 30 days)
Ts=90 ;
L=1 ;
b=0.5 ;
T=30 ;
U=1 ;
Tm=(Ts+T)/2 ;
A=L*b ;
Rcr=5*10^5 ;
K2=[0.140 , 0.654 , 0.29 , 0.96] ;
M2=[0.072 , 4.71*10^(-4) , 2*10^5 , 1.6*10^(-3)] ;
v2=[0.839*10^(-4) , 4.7*10^(-7) , 19*10^(6) , 10^(-6)] ;
Pr2=[1050 , 3.01 , 0.697 , 0.02] ;
for i=1:4
for X=0.0001:0.1:1
%For Plotting 1 Table 1
Xcr(i)=(Rcr*v2(i))/U ;
if X<Xcr(i)
Re2(i)=(U*X)./v2(i) ;
Nu2(i)=(0.332*(Re2(i)).^(1/2))*(Pr2(i)).^(1/3) ;
d2(i)=(5*X)./(Re2(i).^(1/2)) ;
dt2(i)=d2(i)/(Pr2(i).^(1/3)) ;
h2(i)=(K2(i)*Nu2(i))./X ;
Cf2(i)=0.664*Re2(i).^(-1/2) ;
else
Re2(i)=(U*X)./v2(i) ;
Nu2(i)=0.0296*((Re2(i)).^(4/5))*Pr2(i).^(1/3) ;
d2(i)=0.37*X.*Re2(i).^(-1/5) ;
dt2(i)=0.37*X.*Re2(i).^(-1/5) ;
h2(i)=(K2(i)*Nu2(i))./X ;
Cf2(i)=0.0592*Re2(i).^(-1/5) ;
end end end
plot (X,Cf2)
  3 Comments

Sign in to comment.

Answers (2)

Star Strider
Star Strider on 16 Mar 2015
Your problem is that in your plot call, ‘X’ is a single value (0.9), and
Cf2 =
0.0064107 0.0032801 3050.7 0.0038147
You need to resolve that, since only you know what you want to do.
Be sure to check the values of the variables you are using as arguments to plot.
  4 Comments
mahmoud samy
mahmoud samy on 16 Mar 2015
Edited: mahmoud samy on 16 Mar 2015
where is my mistake then .. i wanted every value of i , to pass on every single value of X within the "if" condition , so i wrote X as i did .. how can i solve it?? .. thank u any way sir
Star Strider
Star Strider on 16 Mar 2015
I have no idea what you want to do with your code, so I can’t help you with that.
Do your calculations step-wise. Look at each calculation, see if it produces the result you want, and correct it if it does not. Use the debugging functions in MATLAB, or just remove the semicolons from the ends of each statement in turn until you find the problem.
Once you find the problem, if you cannot figure out the solution of the problem yourself, post the relevant parts of your code, what you want it to produce and what it produces. We can help you then.
We absolutely cannot guess what you are thinking!

Sign in to comment.


Image Analyst
Image Analyst on 16 Mar 2015
Try this:
clc; % Clear the command window.
close all; % Close all figures (except those of imtool.)
workspace; % Make sure the workspace panel is showing.
format long g;
format compact;
fontSize = 20;
Ts=90;
L=1;
b=0.5;
T=30;
U=1;
Tm=(Ts+T)/2;
A=L*b;
Rcr=5*10^5;
K2=[0.140 , 0.654 , 0.29 , 0.96];
M2=[0.072 , 4.71*10^(-4) , 2*10^5 , 1.6*10^(-3)];
v2=[0.839*10^(-4) , 4.7*10^(-7) , 19*10^(6) , 10^(-6)];
Pr2=[1050 , 3.01 , 0.697 , 0.02];
for i=1:4
for X=0.0001:0.1:1
%For Plotting 1 Table 1
Xcr(i)=(Rcr*v2(i))/U;
if X<Xcr(i)
Re2(i)=(U*X)./v2(i);
Nu2(i)=(0.332*(Re2(i)).^(1/2))*(Pr2(i)).^(1/3);
d2(i)=(5*X)./(Re2(i).^(1/2));
dt2(i)=d2(i)/(Pr2(i).^(1/3));
h2(i)=(K2(i)*Nu2(i))./X;
Cf2(i)=0.664*Re2(i).^(-1/2);
else
Re2(i)=(U*X)./v2(i);
Nu2(i)=0.0296*((Re2(i)).^(4/5))*Pr2(i).^(1/3);
d2(i)=0.37*X.*Re2(i).^(-1/5);
dt2(i)=0.37*X.*Re2(i).^(-1/5);
h2(i)=(K2(i)*Nu2(i))./X;
Cf2(i)=0.0592*Re2(i).^(-1/5);
end
end
end
plot (Cf2, 'b-', 'LineWidth', 2)
xlabel('Index of Cf2', 'FontSize', 22);
ylabel('Cf2', 'FontSize', 22);
grid on;

Categories

Find more on Graphics Object Programming in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!