MATLAB: I would like the program to rerun if the user input yes and stop if no. can someone help me pls

MATLAB: I would like the program to rerun if the user input yes and stop if no. can someone help me pls

i would like the program to rerun if the user input yes and stop if no. can someone help me pls?

x= input('input x =');
y= input('input y=');
z= input('input z=');
a=[5400/x,-2400/x,0;
-2400/y,4200/y,-1800/y;
0,-1800/z,1800/z];
[eigenvector,eigenvalue] = eig(a) %eigenvector,eigenvalue
yes= input ('would you like to try agin? yes or no=')

Best Answer

  • x= input('input x =');
    y= input('input y=');
    z= input('input z=');
    str = 'yes' ;
    while strcmp(str,'yes')
    a=[5400/x,-2400/x,0;
    -2400/y,4200/y,-1800/y;
    0,-1800/z,1800/z];
    [eigenvector,eigenvalue] = eig(a) %eigenvector,eigenvalue
    str = input ('would you like to try agin? yes or no=','s') ;
    end
  • Add a Comment

    Your email address will not be published. Required fields are marked *