What is Matlab: Definition and 1000 Discussions

MATLAB (an abbreviation of "matrix laboratory") is a proprietary multi-paradigm programming language and numeric computing environment developed by MathWorks. MATLAB allows matrix manipulations, plotting of functions and data, implementation of algorithms, creation of user interfaces, and interfacing with programs written in other languages.
Although MATLAB is intended primarily for numeric computing, an optional toolbox uses the MuPAD symbolic engine allowing access to symbolic computing abilities. An additional package, Simulink, adds graphical multi-domain simulation and model-based design for dynamic and embedded systems.
As of 2020, MATLAB has more than 4 million users worldwide. MATLAB users come from various backgrounds of engineering, science, and economics.

View More On Wikipedia.org
  1. STEMucator

    What is causing the clumping in my piecewise function plot?

    Homework Statement Hey there. I'm trying to plot a piecewise function in MATLAB and I'm having some decent success, but there's some things I'm wondering. Here's the function: http://gyazo.com/d3493a0c13096878acf5a501af8a7f66 Homework Equations The Attempt at a Solution My...
  2. S

    Matlab: plotting one period of a discrete signal

    I have a 3 rad/s sine wave that I am sampling every 2 seconds. The slow sampling has created an alias of -0.14 rad/s. I have plotted this over the top of the original continuous time signal, please see attachment. My problem is that I only want to plot the first period of the discrete signal...
  3. A

    Matlab Simulink-Using PID controls?

    Matlab Simulink--Using PID controls? I need to use Simulink to determine an approximate numerical solution to the equation of motion for a robotic arm (image below). The equation of motion for the system is J (\theta)'' = \tau - mgl cos (\theta). (An ordinary, 2nd order nonlinear differential...
  4. J

    MATLAB Complex Fourier Series using Matlab

    Hello, I have a problem synthesising the complex Fourier series using Matlab. The time domain periodic function is: -1, -1.0 ≤ t < -0.5 1 , -0.5≤ t <0.5 -1, 0.5 ≤ t < 1 The single non zero coefficient is: Cn = \frac{2}{\pi n}, Co is 0 (average is 0). f(t)= \sum Cn...
  5. S

    MatLab fplot help. Something may be wrong with my fplot?

    Homework Statement The problem was "Plot the following equation with MatLab, for values of x from -3 to 6. Homework Equations y = x^4 - 4x^3 - 6x^2 + 15 The Attempt at a Solution I created a function. function r = graph(x) for i = 1:x r(i) = i^4 - 4*i^3 - 6*i^2 + 15; end...
  6. F

    Matlab continuous uniform distribution

    Homework Statement Generate 100 data points from a continuous uniform distribution with mean = 10 and variance = 4 Homework Equations u = (a+b)/2 var = (b-a)^2 / 12 r = a + (b-a).*rand(100,1); The Attempt at a Solution points = 100 m1 = 10 v1 = 4 syms a b [a...
  7. N

    Matlab: Numerically Integrate and Plot Response of Underdamped System

    Homework Statement Numerically integrate and plot the response of an underdamped system determined by m= 100 kg, k= 20,000 N/m, and c = 200 kg/s, subject to the initial conditions of x0 = 0.01 m and v0 = 0.1 m/s, and the applied force F(t)=150cos(5t). Then plot the exact response. Homework...
  8. C

    Matlab -understanding filter( )

    Homework Statement For my code for the communication system if I have a channel implies response {.3,.6,-.3} h=[.3 .6 -.3] How do I get ych=filter(h,l,s) to work? I get an error when I run it. I get an error, Error: The press ion on the left of the equals sign is not a valid target for an...
  9. M

    MatLab: About the basic functions about the program.

    Hi. I've been given an assignment, a starters assignment I should say, for Matlab. This is mostly about learning the basic functions of the program and it's my first ever experience with it. I hope I'm posting in the correct sub-forum. Homework Statement We're given a triangle ABC...
  10. E

    Is MATLAB's Randomization Function Affected by Appending Numbers to Student IDs?

    Homework Statement Enter the following two commands, and copy and paste the output as your answer > rand("state",student_number0917); > rand(1) where student_number0917 is your student number with "0917" at the end and with "-" removed. For example, if your student number is 123-456-7...
  11. N

    In matlab how do I write u(n) in order to get the autocorrelation?

    Homework Statement u(n) = .4s(n)+.7s(n) -.1s(n-2)+v(n) where v(n) is zero mean and has variance 0.003 and uncorrelated with s(n) I want the autocorrelation is E[u(n-k)u(n)] I can solve it easily by hand which is the follow so r(k) = 0.663 for k =0, 0.21 for k=1 , -0.04 for k=2 and the rest...
  12. A

    MATLAB MATLAB Filter command for BSFC map

    Hi all, I have made a BSFC plot in MATLAB with engine data tested on an eddie current dyno, The code I used for it is: >> NP=40; >> [RP TP]=meshgrid(linspace(min(RPM),max(RPM),NP),linspace(min(Torque),max(Torque),NP)); >> BSFC_IT=griddata(RPM,Torque,BSFC,RP,TP); >> NC=12; >>...
  13. D

    Displacement of cantilevered beam matlab

    Homework Statement Write a Matlab function to plot the displacement of a cantilevered beam under a point load. Annotate the figure’s axes and title the figure. In addition to creating the plot, the function should report (in the figure’s title!) the maximum deflection and angle between the...
  14. D

    Calculate and plot real and reactive power matlab

    Homework Statement Write a Matlab function to compute and plot real and reactive power consumed (or supplied) by a known impedance (the value of complex impedance should be used as the function’s input) as a function of either current or voltage (use a character: V or I as a second input) for...
  15. E

    Solving Recurrence Relations in Matlab: A Homework Challenge

    Homework Statement Evaluate the following series ∑u(n) for n=1 → \infty in which u(n) is not known explicitly but is given in terms of a recurrence relation. You should stop the summation when u(n) < 10^(-8) u(n+1) = (u(n-1))^2 + (u(n))2 with u(1) = 0.5, u(2) = 0.6 Note 1:The lecturer...
  16. A

    Find area under curve and energy of function (matlab)

    Homework Statement For the 1st one you wouldn't really need MATLAB I guess to find the area under the curve, it is 0 and so is its energy. For the 2nd one I got A=1.73 and so E=2.99.Homework Equations area under curve = evaluate integral from t=t1 to t=t2. in this case t=-2 to t=5 since they...
  17. H

    MATLAB How to Plot Single Points in 3D Space Using MatLab?

    This might be an unusual thread but is that i really can't figure out how to plot single points in 3D space using MatLab. I need to plot the points (1,0,0) , (0,1,0) and (0,0,1)
  18. H

    MATLAB MATLAB used in 1st year Engineering?

    It is common for freshman students in engineering to use MATLAB? My son will be a freshman (Bio Engineering) in August and I'm tempted to encourage him to learn Octave or Scilab during the summer. He's in a Java class right now, so has some programming basics already. If he really won't...
  19. B

    Comparing Analytic and Approximate Solutions Using Euler's Method in Matlab

    Homework Statement Hello, I am working on a problem involves my using the Euler Method to approximate the differential equation \displaystyle \frac{df}{dt} = af(t) - b[f(t)]^2, both when b=0 and when b is not zero; and I am to compare the analytic solution to the approximate solution when b=0...
  20. A

    Matlab help fplot() with 3-input argument function?

    matlab halp! fplot() with 3-input argument function?? Homework Statement heres da link: http://postimg.org/image/uqqr3q0k3/ don't really need to look at that though. Its just a function in another file, I have to call it but it takes 3 input variables, problem with fplot is it only uses a...
  21. N

    Use Matlab to plot x(t) for damped system

    Homework Statement Plot x(t) for a damped system of natural frequency w_n= 2 rad/s and initial conditions x_0= 1 mm and v_0 = o mm/s, for the following values of the damping ratio: z= 0.01, 0.2, 0.6, 0.1, 0.4 and 0.8 Homework Equations The Attempt at a Solution I began by defining...
  22. J

    MATLAB MatLab code for these Integrals.

    How can I write proper language for these integrals in MatLab ? Your helps really appreciated. John Mark
  23. G

    Electrical Engineering - State Space - Matlab

    Homework Statement \dot{} I'm given the following circuit http://imagizer.imageshack.us/v2/800x600q90/43/bwka.png Homework Equations The Attempt at a Solution I come up with the transfer function to be G(s) = \frac{s}{2+\frac{1}{s}}. The question asks me to Plot step...
  24. P

    How Can MATLAB Simulate Particle Motion in a 3D Vector Field?

    So, this is going to be pretty hard for me to explain, or try to detail out since I only think I know what I'm asking, but I could be asking it with bad wording, so please bear with me and ask questions if need-be. Currently I have a 3D vector field that's being plotted which corresponds to...
  25. K

    How to increment a MATLAB for loop by an arbitrary value?

    How to increment a MATLAB "for" loop by an arbitrary value? I am creating a Matlab program that calculates corresponding temperatures for Celsius, Kelvin, Fahrenheit, and Rankine scales. I want to write my code so that it can handle an arbitrary temperature increment (a user-inputted value)...
  26. Y

    MATLAB Plotting normal modes in Matlab from data in Patran

    Hi, Could You help me with problem mentioned in the topic? I copied translational data (3 column vectors) from modal analysis in Patran (from f06 file). Now I have problem in reproducing the results in Matlab. I am trying to draw normal modes in Matlab, but I haven't got much luck so far...
  27. S

    MATLAB Plotting atomic orbitals on matlab

    Hi guys I've been having some trouble plotting the p(x) and d(xy) atomic orbitals on Matlab. I have been given that p(x) = x*e^-(x^2 + y^2 + z^2)^0.5 and d(xy) = x*y*e^-(x^2 + y^2 x^2)^0.5 Now I want to plot these orbitals on MATLAB using mesh or the surf command and then plot the...
  28. M

    MATLAB Effective Ways to Self-Learn MATLAB: Recommendations and Tips from Experts

    Hey PF! Does anyone recommend an effective way to self-learn matlab? What has worked for you? What have you heard that works for others? I realize MATLAB can be used for a variety of purposes, and as such it is difficult to learn the entire package, but I just want to get my hands dirty...
  29. B

    MATLAB Matlab question: How to pick specific value from column vector

    Good afternoon, I have created a column vector with many values however I want to know a specific value found in that vector. Specifically I want to know the 99th value of my column vector. Is there a command I can enter into mat lab that will give me the value I seek without having to...
  30. B

    MATLAB Troubleshooting FFT code with MATLAB

    ok I wrote my own FFT class and I now have MatLab on my computer. I am comparing my code to mat-lab. so my test i used it this : for (int y = 0; y < 100; y++) { double temp8 = (2D * (Math.Sin(2D * Math.PI * 4D * (double)y / 100D)))...
  31. C

    MATLAB How to call built in MuPAD functions from MATLAB command window

    Is anyone here any good with MATLAB? I could do with some help. I want to use the ellipticF function as shown http://www.mathworks.co.uk/help/symbolic/mupad_ref/ellipticf.html. I just want to put in a number and it return another number (the answer). I want it to work like the ellipke...
  32. E

    MATLAB Graphing 3D Z-Transform in MATLAB

    Does anyone know how I might go about graphing the Z-Transform in 3D? It want it to look something like the picture below.
  33. S

    4-point Gauss Quadrature with MATLAB

    Homework Statement I need to evaluate a function using 4-point GQ. Homework Equations GQ theory The Attempt at a Solution I have got more of a programming issue in MATLAB. I am new to MATLAB. Actually this is for a numerical analysis course where we kind of learn MATLAB on the...
  34. D

    MATLAB Plotting Gaussian Curves with Matlab

    Matlab rook here, Suppose I'd want to plot the Gaussian for 10 different values for n:function gauss(c,n) = plot_gaussian.m x=-1*c:0.1:c; gauss(x,j)=sqrt(j./pi)*exp(-1*j.*x.^2); for j=1:n plot(x,y) end And then I'll type gauss(3,10) to plot 10 curves in the interval [-3,3] Also, if I'd...
  35. S

    Ideas for engineering/physics based MATLAB program.

    Homework Statement So, as part of a numerical methods module that I'm taking I have to write a report and MATLAB program which deals with some sort of engineering/physics based problem. The report essentially just outlines and discusses the problem. It's the initial idea which I'm looking for a...
  36. Q

    MATLAB Help reading an Excel file with Matlab

    Hi everyone, this is my first post on the physics forums. I am trying to use the readtable command in Matlab to make a table from an Excel file. Matlab is still new to me so I'm running into problems a lot. When I input T = readtable('myfile.txt'), I get an error that says "? Undefined function...
  37. E

    MATLAB Can Matlab Solve Improper Integrals?

    Hello everyone I need to ask a tough question I have an integral I should plot in 3d from minus infinite to plus infinite it is known that this integral is hard but can be solved numerically I need it in MATLAB is it possible? Thank you
  38. K

    How to plot out a triangular wave in matlab

    that's my programe : n=0; T=2; Ts=T/200; t=-T/2:Ts:T/2; for n=0:0.1:8; V= 0; V=V+8/pi^2*(-1)^n*sin(pi*(2*n+1)*t)/(2*n+1)^2; pause drawnow plot(t,V); end When T=2, write a Matlab program to visualize the Fourier series (with animation) and investigate the...
  39. denjay

    MATLAB Should I take Matlab for Physics ?

    Should I take "Matlab for Physics"? So this is one of those questions... Next semester my Physics department is offering a special course "Matlab for Physics". It's being taught by a well known and respected professor so I'm doubly sure the content covered will be relevant to research in...
  40. E

    Function pix and shg in matlab

    what is the function of 'pix' and 'shg' in MATLAB ?
  41. H

    Convergence Error in Matlab Code for Fluid Flow Simulation

    Homework Statement My apologies if the error is an obvious one and many thanks in advance for any help given: I am trying to create a Matlab code that simulates Lifting Line Theory in order to provide an estimate of the lift and drag of a 3D wing. My hope is to later use this as part of...
  42. 1

    MATLAB Plotting Beam Emittance with MATLAB Code

    Hi, I want to write a very simple code to plot the beam emittance knowing x,y,z and vx,vy,vz of each particle. I have generated with a tracking code a very simple beam (cone distribution with 1° divergence) and I want to compare the emittance of this beam with the one calculated by a...
  43. N

    MATLAB Matlab multiplication of polynomials with syms

    Is there anyway around this problem? syms m,n; x1 = [0, 1, 4, m]; x2 = [3, n, 9, 27]; conv(x1,x2) Undefined function 'conv2' for input arguments of type 'sym'
  44. M

    MATLAB Synchronous generator matlab simulation

    I want a closed loop MATLAB simulation for a case study in power grid control: I'm planning to regulate the terminal voltage of a synchronous generator on overloading, by measuring the terminal voltage instantaneously, giving it to a rectifier and feeding the DC signal to the exciter (instead of...
  45. E

    MATLAB Solve Matlab Code Problem: Nonlinear Fiber Optics

    I took this code from the agrawal book: nonlinear fiber optics and I wanted to see the results : %---specify input parameters clear all; distance= input('enter fiber length (in units of L_D)= '); beta2=input(' dispersion: 1 for normal, -1 for anomalous'); N=input('Nonlinear parameter N=')...
  46. E

    Difference rand and randn command matlab

    i am confused between when to use rand and randn . can someone explain to me please?
  47. E

    Why Is My MATLAB Simulation of Orbiting Masses Not Running?

    Homework Statement I have created random mass and try to make them go around each other . somehow i couldn't find where all the code goes wrong. how do i fix this The Attempt at a Solution I have coded this. but still the file can't be run. i don't know where to fix this . %...
  48. Superposed_Cat

    MATLAB Solving MATLAB Duplication Error with For Loop

    Hi, I'm totally new to MATLAB and tried this for loop for K = 1:10 disp(abs(tan(K))) end it displays 1.5574 2.1850 0.14255 1.1578 3.3805 0.29101 0.87145 6.7997 0.45232 0.64836 1.5574 2.1850 0.14255 1.1578 3.3805 0.29101 0.87145 6.7997 0.45232 0.64836 Why did it display...
  49. Q

    MATLAB [Matlab] Numerical Code for the NLS equation

    hello i just copied the Numerical Code for the NLS equation which is the following: %---specify input parameters clear all; distance=input('enter fiber length(in units of L_D)='); beta2=input(' dispersion: 1 for normal, -1 for anomalous'); N=input('Nonlinear parameter N=')...
  50. E

    Rotate Point in Matlab Plotting

    Homework Statement i need to fix a point and rotate another one Homework Equations The Attempt at a Solution i did this i've created this: x=rand(1,3) y=rand(1,3) scatter(x,y) how do i select and make one point fix and make the other point rotate around it?
Back
Top