how to solve equation
Afficher commentaires plus anciens
when
x=1
y=x.^2+3 /(x-1)
and when
x=2:100, y=x.^3+55
how do you solve this in matlab using vectorization method
Réponse acceptée
Plus de réponses (1)
David Hill
le 17 Août 2021
y=zeros(size(x));
y(x==1)=3;
y(x~=1)=x(x~=1).^3+55;
4 commentaires
Walter Roberson
le 18 Août 2021
You overlooked the /(x-1) when x = 1 ...
David Hill
le 18 Août 2021
He changed the question.
Image Analyst
le 18 Août 2021
Yes. Originally it said
"when x=1, y=x.^2+3 /(x-1) and when x=2:100, y=x.^3+55,"
as I captured in the comment in my code. Then in his comment to me (after your and my Answers were posted) he changed it to x.^2+3/(x+1). And I added a comment to update it to the new formula.
Ls
le 18 Août 2021
Catégories
En savoir plus sur Symbolic Math Toolbox dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
