Plotting Graphs with Matlab: Solutions to Issue 1,2 & 3

In summary, the conversation discussed using Matlab for graphing and performing complex mathematical calculations. It was mentioned that Matlab can handle inverse secant and plotting real and imaginary parts separately. It was also mentioned that it is possible to write a script and function in Matlab to display corresponding graphs with different variable values. The person also stated that they have used Matlab in the past but are now looking to use it for more serious purposes.
  • #1
pairofstrings
411
7
Hello everyone, thanks for reading my post.
Issue 1:
Example:
Suppose I want to draw a graph for sec θ=x + 1/4x
I want 'θ' on the y-axis and different values of 'x' on x-axis. Can I plot the graph using Matlab?

Issue 2: I want to know if it's possible to plot graph of complex mathematical functions after performing complex mathematical calculations(calculations involving Calculus, Algebra, Trigonometry, Probability), both done in the Matlab software. I want to do calculations and also graph plotting in Matlab. Is this possible in Matlab? I will be doing Digital and Analog Signal Processing and Analysis. Purpose is to analyze signals/graph and generate manipulated, random signals/graph. I only know that Matlab can do things like recognition/detection.
Please don't just tell me "Yes, you can draw graphs in Matlab".

Issue 3: I want to write some script and the function-in-question in Matlab such that when I give different values to the variables in the function it must display the corresponding graph. Can this be done, in Matlab?
 
Physics news on Phys.org
  • #2
So, you haven't used MATLAB much/at all have you?

1) Yes, Matlab handles inverse secant and this would be easy to do.

2) I haven't graphed any complex functions, but it handles calculation of complex numbers just fine. As far as basic plotting, when you simply use the plot command, Matlab will ONLY plot the imaginary part if that's all you ask it to plot. If there is both real and imaginary, only the real part will be plotted. I'm assuming this means you can simply plot the real and imaginary parts separately.

3) Sure. Since you have to define the variables in the first place, it kind of goes hand in hand with being easy to change those variables. You can simply go into the script file and change the value, write the script file in a way so that you call for an input for those values (Matlab then asks you to enter a value), or write a function file (probably the best way). If you write the function file, then you can simply call it in your script or command window using the input values that you want.
 
  • #3
I have used it few years ago, in a way which is not going to give me excellent command over this software. But now luckily, I have some serious business to do with this software. Thank you for the help. :smile:
 

1. What are the common issues encountered when plotting graphs with Matlab?

The most common issues encountered when plotting graphs with Matlab are incorrect data formatting, missing data points, and incorrect plot settings.

2. How can I fix issues with incorrect data formatting?

To fix issues with incorrect data formatting, make sure that all data is in the correct format (e.g. numerical values instead of strings) and that the data is organized in the correct structure (e.g. rows vs. columns). You can also use the 'format' function in Matlab to specify the data format for each variable.

3. What should I do if I encounter missing data points?

If you encounter missing data points, you can either remove them from the data set or use interpolation methods to estimate the missing values. In Matlab, you can use the 'interp1' function to interpolate missing data points.

4. How can I adjust plot settings in Matlab?

In Matlab, you can adjust plot settings such as the axes labels, title, legend, and color using the 'xlabel', 'ylabel', 'title', 'legend', and 'color' functions, respectively. You can also change the plot style (e.g. line, scatter, bar) using the 'plot' function.

5. Can I save my plotted graph as an image file in Matlab?

Yes, you can save your plotted graph as an image file in Matlab by using the 'saveas' function. This function allows you to specify the file format (e.g. png, jpg) and the file name for your saved image.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
7
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
10
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
11
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
834
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
751
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
3K
Back
Top