Skip to main content

Posts

Showing posts with the label clf

Draw graph for exp, sin, cos, tan using Matlab

Program Write a program to draw the graphs for exponential function(exp) , and trigonometric functions - sine function(sin) , cosine function(cos) , tangent function(tan) using graph. Use the plot function in Matlab. Solution  There are two ways to solve this problem. While there are many ways in programming to solve a problem but I am stating only two because they are major. They are  1) Plotting all the above functions in different windows - Plot function . 2) Using subplot and projecting the graphs in a single window - subplot function . While for the sake of simplicity I will divide this post into two sections where there will be program 1 and explanation 1 corresponding to program 1 and program 2 - explanation 2 corresponding to program 2.  Even if you are beginner then first refer to the first program and then go refer the program 2 so that you will get to know the difference between what plot and subplot is. Also there is a detailed explanation fo...

Volume of a solid sphere and graph for different radius using Matlab

Program Calculate the volume of a solid sphere based on the user input given and also plot a graph for different values of radius with an interval of 0.5 and range of [r-5,r+5]. The relation for the volume of the sphere is given by: Volume of a sphere Where r is the radius of the sphere You can learn more about sphere from here:  1) Sphere - mathsisfun.com 2) Sphere- Wolfram Solution First of all let us understand the question before go into solving the problem using Matlab . 1) The question says that we will have to calculate the volume of a sphere by taking the input of the value of the radius from the user. 2) The question also asks us to draw the graph for a given set of range with a given set of interval . So the question asks us to take radius on x axis and volume on y axis . Next the difference between two points on the x axis should be 0.5 as said by the interval and finally we will have to draw the graph in the range [r-5,r+5]. Lets understand th...