Programming in MatLab and taking the following mathematical expression: x^5 + x
ID: 3778562 • Letter: P
Question
Programming in MatLab and taking the following mathematical expression:x^5 + x + 1=0
Considerations:
• use: clear all, clc, disp, fprint, input, if-else, for, while, subprograms, vectors, matrix...
• do not use: roots, fzero, poly, polyval, residue, floor... Programming in MatLab and taking the following mathematical expression:
x^5 + x + 1=0
Considerations:
• use: clear all, clc, disp, fprint, input, if-else, for, while, subprograms, vectors, matrix...
• do not use: roots, fzero, poly, polyval, residue, floor... Programming in MatLab and taking the following mathematical expression:
x^5 + x + 1=0
Considerations:
• use: clear all, clc, disp, fprint, input, if-else, for, while, subprograms, vectors, matrix...
• do not use: roots, fzero, poly, polyval, residue, floor...
Explanation / Answer
x=input('enter the val of x');
val=x^5+x+1;
if(val<0)
disp('the x val taken is ngative');
else
disp('the x val taken is positive');
end
%///////////////////////////////////////////
n=input('enter the tot value u wnt to enter for x');
for i=1:1:n
val=x^5+x+1;
if(val<0)
fprintf('the val of x:%d',x);
disp(' the x val taken is ngative');
else
fprintf('the val of x:%d',x);
disp(' the x val taken is positive');
end
end
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.