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

  • Context: MATLAB 
  • Thread starter Thread starter pairofstrings
  • Start date Start date
  • Tags Tags
    Graphs Matlab Plotting
Click For Summary
SUMMARY

This discussion addresses three key issues related to plotting graphs using MATLAB. First, users can plot the graph of sec θ = x + 1/4x with 'θ' on the y-axis and 'x' on the x-axis using MATLAB's plotting capabilities. Second, MATLAB effectively handles complex mathematical functions, allowing users to perform calculations involving calculus, algebra, trigonometry, and probability, and plot both real and imaginary parts separately. Lastly, users can create scripts and function files in MATLAB to dynamically input variable values and display corresponding graphs, enhancing the software's usability for signal processing tasks.

PREREQUISITES
  • Familiarity with MATLAB 2023 plotting functions
  • Understanding of complex numbers and their representation in MATLAB
  • Basic knowledge of signal processing concepts
  • Experience with writing scripts and functions in MATLAB
NEXT STEPS
  • Explore MATLAB's plot command for advanced graphing techniques
  • Learn how to manipulate complex numbers in MATLAB
  • Research MATLAB functions for signal generation and manipulation
  • Study MATLAB's input functions for dynamic variable handling in scripts
USEFUL FOR

This discussion is beneficial for MATLAB users, signal processing engineers, and anyone involved in mathematical modeling and graphing within the MATLAB environment.

pairofstrings
Messages
411
Reaction score
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
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.
 
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:
 

Similar threads

  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 11 ·
Replies
11
Views
3K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 7 ·
Replies
7
Views
2K
  • · Replies 1 ·
Replies
1
Views
4K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 1 ·
Replies
1
Views
5K
  • · Replies 1 ·
Replies
1
Views
3K