Skip to main content

Software Example - MATLAB

 In this example I will be showing you how you can do 3-D plotting in MATLAB, lets start:


Three-dimensional plots typically display a surface defined by a function in two variables, z = f(x,y) .

To evaluate z, first create a set of (x,y) points over the domain of the function using meshgrid.

Write the following code :

[X,Y] = meshgrid(-2:.2:2);

Z = X .* exp(-X.^2 - Y.^2);

Then create a surface plot, using this code:

surf(X,Y,Z)

The code should look this:


Both the surf function and its companion mesh display surfaces in three dimensions. surf displays both the connecting lines and the faces of the surface in color. mesh produces wireframe surfaces that color only the lines connecting the defining points.



Press the "RUN" button highlighted in the top panel of the software to display the 3-D Plotted figure, and the final result should look like this:



You can display multiple plots in different subregions of the same window using the subplot function.

The first two inputs to subplot indicate the number of plots in each row and column. The third input specifies which plot is active. For example, create four plots in a 2-by-2 grid within a figure window.

Use the following code: 

t = 0:pi/10:2*pi;

[X,Y,Z] = cylinder(4*cos(t));

subplot(2,2,1); mesh(X); title('X');

subplot(2,2,2); mesh(Y); title('Y');

subplot(2,2,3); mesh(Z); title('Z');

subplot(2,2,4); mesh(X,Y,Z); title('X,Y,Z');

To see the following result:



P.S: Screenshots are taken by the author.






Comments

Popular posts from this blog

Neural Network (Initial Idea 2)

Neural Networks   Neural Networks, colloquially known as artificial neural networks (ANNs) and also simulated neural networks (SNNs), are a sub-fiend of machine learning which in it self is a sub-field of Artificial Intelligence, they are the brain of AI and are components of deep learning. The name and structure of NNs are similar to the human brain and were inspired by it, they imitate the biological neurons by signaling to each other (IBM, 2020). ANNs consist of an input layer of neurons, one or two hidden layers of neurons and a final layer of output neurons (Wang, 2003).   The diagram illustrated exemplifies a simple architecture of a neural network, the lines which connect the neurons are called weights and are associated with a number which represent the strength of connection between neurons.   There are many different types of neural networks and each are used for specific motives. Below are some of the most common ones used in the field: The perceptron “t...

Case Study - Literature Review - Tesla and Artificial Intelligence

Many different studies have been conducted in regards to the Tesla company and its very influential CEO Elon Musk and numerous of literature review have covered this company, and it is generally concluded in these studies that Tesla company is a successful company with a huge impact in the present time and it has brought innovative products that changed our world and that it has great potential for our future and that they are the best in the electric vehicle field, however there are a few sources which show skepticism towards the company, in this section of the case study we will go over different sources that discuss Tesla and evaluate them. According to SupplyChainDive (2018) it was not tesla that invented the electric vehicles it was Robert Anderson in 1832, all that tesla did was popularize and promote this type of vehicle and not one single major company was making electric cars until the the announcement of tesla roadster in 2008 Copyright free image and since then Tesla radica...

Case Study - Conclusion - Tesla and Artificial Intelligence

 In conclusion, Tesla is the highest rated car manufacturing company for autonomous cars in the present and it continues to develop internationally and this is owing to the fact that Tesla properly uses artificial intelligence to full potential to produce its vehicles and implement it in every way possible to produce innovative self driving electric vehicles which dominated the market. This case study clearly shows the connection between the main project theme of this blog and the success of the Tesla company and further illustrates the importance of AI. The research conducted is significant to help understand ways AI can be implemented and to encourage other companies and potential entrepreneurs to implement AI with vision to popularize the use of AI and revolutionize the planet. However, because of the limitations presented by the research and the case study, further research is suggested to provide a more accurate significance of artificial intelligence, I will be proceeding by ...