Can you rewrite this MATLAB code using a for loop instead of a
while loop?
%formatting
clc, clear,...
60.2K
Verified Solution
Link Copied!
Question
Mechanical Engineering
Can you rewrite this MATLAB code using a for loop instead of awhile loop?
%formatting clc, clear, format compact;
%define variables k=1; b=-2; x=-1; y=-2;
%while loop initialization for k <= 3 disp([num2str(k), ' ',num2str(b),' ',num2str(x),'',num2str(y),]); y = x^2 -3; if y< b b = y; end x = x+1; k = k+1; end
Answer & Explanation
Solved by verified expert
4.4 Ratings (615 Votes)
See Answer
Get Answers to Unlimited Questions
Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!
Membership Benefits:
Unlimited Question Access with detailed Answers
Zin AI - 3 Million Words
10 Dall-E 3 Images
20 Plot Generations
Conversation with Dialogue Memory
No Ads, Ever!
Access to Our Best AI Platform: Zin AI - Your personal assistant for all your inquiries!