The figure in my code does not appear
    4 Ansichten (letzte 30 Tage)
  
       Ältere Kommentare anzeigen
    
    Mohamed T. Adam
 am 16 Jan. 2022
  
    
    
    
    
    Beantwortet: KSSV
      
      
 am 16 Jan. 2022
            The code i am working on is the euler's method for BVP. The code runs without an error but the plot window appears with no graph in it, why does this happen? and how can i fix it?
0 Kommentare
Akzeptierte Antwort
  KSSV
      
      
 am 16 Jan. 2022
        USe marker. As you are plottint point by point. 
clc; close ;clear all
A = 2 ;
Kc = 1 ;
t1 = 0.1 ;
delta_h = 0 ;
h = 0.1 ;
z = 2 ;
figure
hold on
for t = 0:h:10
    delta_h_next = delta_h + (z * h) ;
    z_next = z - ((Kc/A)*z+((Kc/(A*t1)*delta_h))*h) ;
    delta_h = delta_h_next ;
    z = z_next ;
     fprintf('%5.4f   %11.8f \n', t, delta_h);
    plot(delta_h,t,'*-r')
end
Weitere Antworten (1)
  KSSV
      
      
 am 16 Jan. 2022
        Also you can save them into an array and plot after the loop:
A = 2 ;
Kc = 1 ;
t1 = 0.1 ;
delta_h = 0 ;
h = 0.1 ;
z = 2 ;
count = 0 ;
x = zeros([],1) ;
y = zeros([],1) ; 
for t = 0:h:10
    count = count+1 ; 
    delta_h_next = delta_h + (z * h) ;
    z_next = z - ((Kc/A)*z+((Kc/(A*t1)*delta_h))*h) ;
    delta_h = delta_h_next ;
    z = z_next ;
    fprintf('%5.4f   %11.8f \n', t, delta_h);
    x(count) = delta_h ;
    y(count) = t ; 
end
plot(x,y)
0 Kommentare
Siehe auch
Kategorien
				Mehr zu Data Type Identification 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!



