Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Function for cp.m on matlab that follows the instructions in Now its your turn Now it's your turn. Write a function (cp.m) that takes as

image text in transcribedFunction for cp.m on matlab that follows the instructions in Now its your turn
Now it's your turn. Write a function (cp.m) that takes as input the name of a text file and the name of an output file and copies the contents of the input file to the output file. That is, cp copies text fil can print to a file (see below). From MATLAB's help: Write a short table of the exponential function to a text file called exp.txt. es. Hint: fprint A = [x; exp(x)); fileID fopen(' exp . txt','w'); fprintf(fileID, %6s %12sin','x', 'exp(x)' ); fprintf(fileID,'%6.2f %12.8f ',A); fclose(fileID); Utry.printto-filem 1+1 2- exp (x)]; A = [x; % Note that A contains two rows . fopen ( ' exp.txt','w.); \ fileID fprint f (tileID,'$6s 6 12s ','x','exp (x)'); fclose (fileID); exp.bt X+ exp (x) 2 0.00 1.00000000 3 0.10 1.10517092 4 0.20 1.22140276 5 0.30 1.34985881 6 0.40 1.49182470 7 0.50 1.64872127 8 0.60 1.82211880 9 0.70 2.01375271 10 0.80 2.22554093 20 %or you can use a loop 11-ileID topen ('exp.txtw 12-printf (fileID, '6s $12pin,xexp(x) 13-or-1:length (x) 14- 15end 1-fclose (fileID) 17 tprintf(fileID,'6.2f 12.8f ',A(1-3) , A (2,,) ), 11 0.90 2.45960311 12 1.00 2.71828183 1 3

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

Intelligent Databases Technologies And Applications

Authors: Zongmin Ma

1st Edition

1599041219, 978-1599041216

More Books

Students also viewed these Databases questions

Question

1. What do you want to accomplish in this meeting?

Answered: 1 week ago

Question

1. Who will you assemble on the team?

Answered: 1 week ago