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 visualizzazioni (ultimi 30 giorni)
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 Commenti
Stephen23
Stephen23 il 8 Mag 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)

Accedi per commentare.

Risposta accettata

Sindar
Sindar il 7 Mag 2020
Please don't post homework problems without showing your attempts and asking specific questions. I'm feeling generous, though, so:
  4 Commenti
Sindar
Sindar il 8 Mag 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)

Accedi per commentare.

Più risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by