Question

Exercise 11 (2 pts.): When the following Matlab program is run, it produces an error. WHERE in the Matlab program does the er
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Please give thumbs u, thanks

clear;clc
A=[-1,0,-2,3,4,6];
B=[1,1,0,0,1,2];
C=[5,-3,7,-9,6,-2];
D=A-B+C;
E=3*A- B*2 +C.^2;
F=B./C;

Solution:
Error : E=3*A- B*2 +C^2;because : Incorrect dimensions for raising a matrix to a power .e C^2, t should be C.^2

clear; clc
X=-3:3:8;
A=X-[1,1,1,1];
B=1:1:5;
C=A+3*B;
D=B.^2 + A.^2;

Solution :
Error : A=X-[1,1,1,1]; because dmention of X and [1,1,1,1] is not same, X has dimention of 5x1 and [1,1,1,1] has 4x1
Error : C=A+3*B; due to privios error this one is also incorrecct dimention

Add a comment
Know the answer?
Add Answer to:
Exercise 11 (2 pts.): When the following Matlab program is run, it produces an error. WHERE...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • For each of the below codes, determine if the following MATLAB codes produces an error. If...

    For each of the below codes, determine if the following MATLAB codes produces an error. If the code does NOT produce an error, predict the output. If the code DOES produce an error: (1) state what line the FIRST error is found and (2) what the error is clear;clc %ICE08B-1 A = [1,5,2,9,4,9]; B(1,5) = 0; counter = 1; for i = 1:length(A)     B(i) = A(i) * counter;     B(i) = B(i)-2;     counter = counter + 1; end

  • For each of the below codes, determine if the following MATLAB codes produces an error. •...

    For each of the below codes, determine if the following MATLAB codes produces an error. • If the code does NOT produce an error, predict the output. • If the code DOES produce an error: (1) state what line the FIRST error is found and what the error is ICE08B-1: clear;clc SICE08B-1 A = [1,5,2,9,4,9]; B(1,5) = 0; counter = 1; for i = 1:length(A) B(1) = A(i) * counter; B(1) = B(i)-2; counter = counter + 1; end ICE08B-2:...

  • Please show all handwritten steps Exercise 4 (2 pts): When run, the following MATLAB code produces...

    Please show all handwritten steps Exercise 4 (2 pts): When run, the following MATLAB code produces one of the four images shown below. Circle the image that is produced by the MATLAB code: (SHOW WORK!) clear:clc A (5, 5) 0 mycolormap= [10 0; 0: 011 colormap (mycolormap) for m 1:5 for n = 1:5 A (m, n) mod (m+n, 5) end end imagesc (A) axis square A) B) c) D)

  • NOTE: IN THIS MATLAB PROGRAMMING EXERCISE, WRITE THE PROGRAM FIRST BY HAND, ON PAPER. THEN KEY...

    NOTE: IN THIS MATLAB PROGRAMMING EXERCISE, WRITE THE PROGRAM FIRST BY HAND, ON PAPER. THEN KEY YOUR PROGRAM INTO MATLAB, AND RUN IT TO PRODUCE OUTPUT. "WORK" FOR THIS EXERCISE WILL CONSIST OF YOUR HANDWRITTEN PROGRAM AND A SCREENSHOT OF YOUR PROGRAM IN MATLAB AS WELL AS THE OUTPUT YOUR PROGRAM PRODUCES MATLAB PROGRAMMING EXERCISE 8 (From physical chemistry; 4 pts.) Using the Redlich-Kwong equation of state for a real gas, we can calculate the work produced by that gas...

  • I want to see the work written out because I do not understand how a for...

    I want to see the work written out because I do not understand how a for loop works without running it on MatLab Exercise 13 (2 pts.): Predict the output that appears in Matlab's command window when the following Matlab program is run (REMEMBER to SHOW SOME WORK!) clear;clc a = 3; c=2; d = zeros (1,5) -2; for m - 1:5 x = (m-1)"c; y = (-1)^n; z=x-y; d(m) = z + 1; end

  • Eclipse Java Oxygen Question 11 pts A compile-time error occurs when Group of answer choices c....

    Eclipse Java Oxygen Question 11 pts A compile-time error occurs when Group of answer choices c. there’s a syntax error in a Java statement a. the Java compiler can’t be located b. bytecodes can’t be interpreted properly c. there’s a syntax error in a Java statement Flag this Question Question 21 pts An error that lets the application run but produces the wrong results is known as a Group of answer choices d. syntax error c. logic error a. runtime...

  • The logical error in the following program is that ____________________ for n in range(5): number =...

    The logical error in the following program is that ____________________ for n in range(5): number = int(input('Enter a whole number: ')) total += number print ('The total is: ', total) variable total should be a string variable number should be float variable total is not initialized, should be assigned 0 before the loop there should be end='' after 'Enter a whole number' What will the following code do?               SIZE = 5          x = [2.1]*SIZE it multiplies the value 2.1...

  • Need help with this Matlab program %% Exercise 1 % NOTE: Please suppress output--i.e., use a...

    Need help with this Matlab program %% Exercise 1 % NOTE: Please suppress output--i.e., use a semicolon ';' at the end of any % commands for which the output is not necessary to answer the question. % Delete these notes before turning in. % Define input variable theta as discretized row vector (i.e., array). theta = ??; % Define radius. r = ??; % Define x and y in terms of theta and r. x = ??; y = ??;...

  • MPI and Performance Evaluation [8 pts] A parallel program has the following run times: Number of...

    MPI and Performance Evaluation [8 pts] A parallel program has the following run times: Number of Processes Run Time 120 seconds) 4 16 32 68 31 15 4 We know: Speedup - Tserial /Tparallel Efficiency Tserial / pTparallel Where T is the run time and p is the number of processes a. Report the speedup and efficiency below: [6 pts] Number of Processes Speedup 4 16 32 Efficie ncy b. Is the algorithm scalable? Why or why not? [2 pts]

  • THE CODE NEEDS TO BE ON MATLAB 2. Exercise (a) Let's write a script file that...

    THE CODE NEEDS TO BE ON MATLAB 2. Exercise (a) Let's write a script file that calculates exp(2) by a Maclaurin series using a while loop exp x )=-+-+-+-+ The while loop should add each of the series terms. The program error as defined below is smaller than 0.01. Error is the exact value (i.e. exp(2)), minus the approximate value (i.e., the current series sum) should exit the loop when the absolute absolute error-lexact-approx Use fprintf within the loop such...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT