I'm having a problem using plot function in a for loop. The plot figure is empty
    2 visualizaciones (últimos 30 días)
  
       Mostrar comentarios más antiguos
    
    Reem Saleh
 el 9 de Dic. de 2022
  
    
    
    
    
    Comentada: Reem Saleh
 el 9 de Dic. de 2022
            clear
clc
disp('Welcome to calculation program')
n=input('Please enter the number of iterations=');
x=input('Please enter the value of vector x=');
for i=1:1:n
    x(i+1)=x(i)-((2*x(i)*tan(x(i))-1)/(2*tan(x(i))+2*x(i)*(sec(x(i))^2)));
    fprintf('The value of iteration no.%1.0f of vector x is=%2.4f\n',i,x(i+1))
    plot(i,x,'*r')
    if x(i)==x(i+1)
        break
    end
end
for i=1:1:n
    if x(i)~=x(i+1)
        disp('The maximum number of iterations have been reached')
        y=input('To re-run press 1 and to stop press any number=');
        if y==1
            midexam3
        elseif y~=1
            break
        end
    end
end
0 comentarios
Respuesta aceptada
Más respuestas (0)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!