Ask your own question, for FREE!
Mathematics 19 Online
OpenStudy (raffle_snaffle):

matlab

OpenStudy (raffle_snaffle):

@jim_thompson5910

OpenStudy (raffle_snaffle):

Need suggestions. I was thinking about using a while loop and asking the user to input x, y, z values.

jimthompson5910 (jim_thompson5910):

so basically do guess and check?

OpenStudy (raffle_snaffle):

Yes, but I was just reading the lab and I need to load the CSV files.

jimthompson5910 (jim_thompson5910):

guess and check is one way to do it, but it's very tedious and you may never actually get the answer no matter how hard you try to guess it

jimthompson5910 (jim_thompson5910):

using rref is a much better way

OpenStudy (raffle_snaffle):

well, I was going to use rref, but I wanted to ask the user to input values in for equation 1, equation 2, and equation 3.

OpenStudy (raffle_snaffle):

This is my idea....

jimthompson5910 (jim_thompson5910):

the values are drawn from the csv files

OpenStudy (raffle_snaffle):

oh okay... So the values in the CSV are my inputs?

jimthompson5910 (jim_thompson5910):

yes for the coefficients and right hand side

OpenStudy (raffle_snaffle):

Okay thanks. Let me think about that more and I will get back to you later.

OpenStudy (raffle_snaffle):

This is the assignment.

OpenStudy (raffle_snaffle):

My work, please check. clear, clc, close all; % clears all windows % loads CSV files into matlab matrixA = csvread('A.csv'); matrixB = csvread('B.csv'); % combining matrices A and B matrixSystem = horzcat(matrixA, matrixB); % solves the system of equations S = rref(matrixSystem); % extracting last column in S matrix solveX = S(1, 4); solveY = S(2, 4); solveZ = S(3, 4); % output displayed fprintf('Equation 1: 1x + -2y + 3z = 7 \n'); fprintf('Equation 2: 2x + 1y + 1z = 4 \n'); fprintf('Equation 3: -3x + 2y + -2z = 1 \n\n'); fprintf('The solutions are as follows \n\n'); fprintf('x = %0.4f \n', solveX); fprintf('y = %0.4f \n', solveY); fprintf('z = %0.4f \n\n', solveZ);

OpenStudy (nincompoop):

check

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!