1. For x from 1 to 100, calculate y. Use fopen and fprintf to write x and y data into a file named “my_data.txt”. Then use fopen and fscanf to read the data. Show the data in two columns. Function to be used: y = e^(0.02x)

2 views (last 30 days)
1. For x from 1 to 100, calculate y. Use fopen and fprintf to write x and y data into a file named “my_data.txt”. Then use fopen and fscanf to read the data. Show the data in two columns. Function to be used: y = e^(0.02x)
  6 Comments
Stephen23
Stephen23 on 8 May 2020
Original question by Gerardo De Jesus Salazar retrieved from Google Cache:
1. For x from 1 to 100, calculate y. Use fopen and fprintf to write x and y data into a file named “my_data.txt”. Then use fopen and fscanf to read the data. Show the data in two columns.
  1. For x from 1 to 100, calculate y. Use fopen and fprintf to write x and y data into a file named “my_data.txt”. Then use fopen and fscanf to read the data. Show the data in two columns. Function to be used: y = e^(0.02x)

Sign in to comment.

Accepted Answer

Sindar
Sindar on 7 May 2020
Please don't post homework problems without showing your attempts and asking specific questions. I'm feeling generous, though, so:
  4 Comments
Sindar
Sindar on 8 May 2020
Terminology: that's a Code Analyzer message, not an error. These may help you improve your code, but they don't need to be resolved (and in some cases are just useless). See here for a guide: https://www.mathworks.com/help/matlab/matlab_prog/preallocating-arrays.html. You've got basically the example.
Note for questions: most of us don't like looking at attachments. If you've got code to share, put it in a code block (Alt-Enter)

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!