Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

someone PLEASE PLEASE HELP with code for writing matrices, Below in picture I have attached the code for writing matrices, but I can't read the

someone PLEASE PLEASE HELP with code for writing matrices, Below in picture I have attached the code for writing matrices, but I can't read the matrices, I have seen the answers for it on chegg, but I DON't WANT YOU TO USE DELIMITER FUNCTION, USE FSCANF FUNCTION PLEASE HELP.
image text in transcribed
image text in transcribed
reading and writing matrices Write a script to create two vectors: *=1,2,3.... 100 The vector y will be the squares of the values in x Next the script called writerm will write the vectors to a file called data.txt. Hint you'll need to put the vectors into a matrix first, then write the matrix X y 1 1 2 4 3 9 100 10000 The columns should each be 10 characters wide with no space in between Next write a new script, readerm. This script will read the data into a matrix 1 1 2 4 3 9 100 10000 X linspace(1, 100); % define a row vector for x y = x.^2; % define a row vector for y A = [x;y]; % convert them into matrix fileID = fopen(data.txt, w')); % open a file name data.txt and write into it fprintf(fileID, "X1s %s ", 'x', 'y'); % name each column headings fprintf(fileID, %1.0f %1.0f ',A); % write the matrix into it fclose(fileID); % save and close the file

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

SQL Instant Reference

Authors: Gruber, Martin Gruber

2nd Edition

0782125395, 9780782125399

More Books

Students also viewed these Databases questions