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. PainterGuy

    MATLAB Replacing the "quad" function with "integral" doesn't work in Matlab

    Hi, I was trying to numerically integrate the following inverse Fourier transform integral,, using the code below. The plot is also shown below. The plot looks good which means the result is good as well. By the way, I was getting a warning which I quote below the code. % file name...
  2. M

    MATLAB Fast Fourier Transform in MATLAB

    Hi PF! I'm following a tutorial in MATLAB, shown here t = 0:.001:.25; x = sin(2*pi*50*t) + sin(2*pi*120*t); y = x + 2*randn(size(t)); Y = fft(y,251); Pyy = Y.*conj(Y)/251; f = 1000/251*(0:127); plot(f,Pyy(1:128)) title('Power spectral density') xlabel('Frequency (Hz)') I read the...
  3. A

    MATLAB Plotting standard deviation in Matlab

    I have a data set 1st coloumn containing ##x## values 2nd coloumn containing ##y## values and 3rd coloumn containing standard deviation of ##y## associated with each ##x## value...I want to plot these 3 values together in a MATLAB plot...can anyone please help me in this regard??
  4. person123

    MATLAB MATLAB API For Wave Flume Data Analysis

    (As a quick note, 'wave flume' should be taken rather generally. I basically just mean the sort of experiments involved in the flow of water which may use instruments such as pressure gauges, load cells, wave gauges, and ADVs. I know that they're not always done in a flume per say -- the...
  5. P

    What specs should I look for in a laptop

    After completing my sophomore year at college as a Physics major and I realized that the laptop I currently have is not able to keep up with the demand I put it under for school. The laptop I currently have has a <2 hour battery life and has been known to crap out (didn't know how else to...
  6. person123

    MATLAB MATLAB Code For Analyzing Experimental Data

    Hi! I'm working on MATLAB code to analyze dat for a specific project, but I'm curious if it could made useful for more general purposes. Here's a bit of background on the project: I'm an REU student and I was assigned to analyze data for a recently conducted experiment. The experiment took...
  7. JJ_Badoo

    I Calculate the exit force of a bullet leaving the barrel

    So, Basic premise is I have 1 input and one output, Energy friom the gunpower burning is input, and the output is the force which pushes the bullet after it is reduced by the friction. m = 12.96 g s = 0.6985 m (barrel lenght) E = 6734 J k = 0.5 (friction coeffcient) I am sorry for lack of...
  8. A

    MATLAB Divergence of a vector field in MATLAB

    If within a volume v ,there exists 10 velocity fields at different points then can anyone please suggest how to compute ##\int_v(\nabla•v)## within the volume?? using matlab For exm if the velocity vector field be ##v=x\hat x+y\hat y+z\hat z## and for x=1 to 10,y=1 to 10 and z= 1 to 10 the 10...
  9. F

    Use a MATLAB Workspace to get the unknown values in an AC circuit

    The plot of part b is attached below. I got a warning on part a , I don't know where is my mistake . Please check my work . Part A clc; clear all; %parta f=800; t=0:10e-6:0.005; xc=10^(-6); xl=40e-3; for i=1:(0.005)/(10e-6) w=2*f*pi; zeq=xl*j*w+50; is(i)=2*(1600*t(i)*pi)...
  10. K

    MATLAB Spring mass impact system in Matlab - How to correct it?

    I am new to Simulink and I wanted to start practicing using a spring mass damper system. My first tutorial was this: Later, I wanted to model a spring system where a mass moving at a known velocity hits the spring. The governing equation and a similar modeling method given in the previous...
  11. F

    Find the real power consumed using MATLAB Simulink

    My work is attached below. I want to confirm my answer. Any help would be greatly appreciated !
  12. M

    Non trivial solution to Schrödinger equation for 1-D infinite well

    Hello, I am trying to find the solution of Schrödinger equation on matlab. However, when I apply boundary conditions, MATLAB only gives me the solution with both coefficients 0. I want to find the solution : Asin(n*pi*x/L) You can see my code below. Could you please tell me where is my mistake...
  13. Eagle9

    MATLAB Book for Matlab to Solve Differential Equations

    Guys I am looking for a textbook about Matlab where In a simple language it will be described how to use this program for solving differential equations. I am more or less aware about calculus but if I have to solve such equations in future – only with this program. So which book could you offer...
  14. R

    I Generating Irrational Ratios in Wave Simulations

    I am trying to write an algorithm that generates two random numbers in a given interval such that their ratio is an irrational number. I understand that all numbers stored on a computer are rational, so it is not possible to have a truly irrational number in a simulation. So, instead I am...
  15. R

    I Re-scaling of exponentially distributed numbers

    For simplicity, let ##N=1##. The following histograms show my results. The generated random numbers are initially exponentially distributed. But after re-scaling they become almost uniformly distributed. What is the cause of that, and is there a solution? P.S. Here is my code in Matlab...
  16. chopnhack

    Creating a vectorized statement in MatLab to output a 5x5 Hilbert matrix

    My first attempt was: V=zeros(5,5) a=1; i=1:5; j=1:5; V(i:j)=a./(i+j-1) I figured to create a 5x5 with zeros and then to return and replace those values with updated values derived from the Hilbert equation as we move through i and j. This failed with an error of : Unable to perform assignment...
  17. cookiemnstr510510

    MATLAB Indexing error in MATLAB coding project

    Hello, I am working on a MATLAB project for my intro to MATLAB course. My project evaluates certain parameters of a spring mass system and graphs the result along with a little mock animation. inputs the user is allowed to change: Initial Position at time =0 Initial Velocity at time=0 Mass of...
  18. D

    Need help with Matlab Function of Differential Equations

    WHAT HAPPENS IS That I need to model the example of A Protein G example, using a function f in Matlab, but when I execute the script, the graphics I get do not correspond to those of the example. The problem is that I can not understand what the model seeks to represent, besides that I do not...
  19. cookiemnstr510510

    MATLAB MATLAB GUI derivative calculator

    Hello! Happy Sunday, I am trying to create a MATLAB GUI that can take an input ( i am starting out with just one variable) and take its derivative and display the result. I have attached pictures of what my GUI looks like, and also the code I wrote so far. Let me also describe my method: I have...
  20. cookiemnstr510510

    MATLAB MATLAB- Creating Symbolic Equation Question

    Hello All! I am finding some inconsistencies with my textbook and MATLAB. I am in the section of symbolic mathematics. I follow the textbook word for word and I am getting some errors. When I am trying to create an entire equation and give it a name like: ideal_gas_law=sym('P*V=n*R*Temp') I get...
  21. Phys pilot

    MATLAB Plot a non homogeneous DPE -- Sum two plots in Matlab?

    Hello, I want to plot this PDE which is non homogeneous: ut=kuxx+cut=kuxx+c u(x,0)=c0(1−cosπx)u(x,0)=c0(1−cosπx) u(0,t)=0u(1,t)=2c0u(0,t)=0u(1,t)=2c0 I have a code that can solve this problem and plot it with those boundary and initial conditions but not with the non homogeneous term...
  22. cookiemnstr510510

    MATLAB logical functions and selection structures

    Hello All, I have a question regarding a MATLAB homework problem. I am learning about logical functions and selection structures. Here is the question: The height of a rocket (in meters) can be represented by the following equation: height=(2.13*t^2)-(0.0013*t^4)+((0.000034*t^(4.751)) create a...
  23. D

    MATLAB Partial Differential Equation - solve with Matlab

    Help please, I need to solve this differential equation x\frac{\partial^2 U}{\partial x^2}+y\frac{\partial^2 U}{\partial y^2}=aU in Matlab (where "a" is a constant parameter, it can be taken by any), I wanted to use the Partial Differential Equation Toolbox, but I ran into a problem, the...
  24. hagopbul

    MATLAB Asking about a command in matlab

    Hello all: I want to ask about the command "javac" in MATLAB ? Any one here knows a useful link on this command other than mathworks ? Any one have some personal experience about this command ? Best H
  25. L

    MATLAB How Can I Retain Image Quality While Showing Axes in MATLAB?

    There is an original image test1.jpg. The problem is to show axes in the image and retain image quality. I am running the following code: img = imread('test1.jpg'); % define variables imgsize1 = size(img,1); % size on screen imgsize2 = size(img,2); xreal = 1; % meter yreal = 1; %...
  26. L

    MATLAB How to transform a plot to use a logarithmic scale?

    I wrote the following code in MATLAB: t = [0:0.001:0.1]; noise = randn(1,size(t,2)); a = 15*10^9; b = 15*10^(-3); c = 7*10^8; y = a*exp(-t/b)+c+noise*100000000; fun = @(p,t)p(1)*exp(-t/p(2))+p(3); p0 = [15.5*10^9, 14*10^(-3), 6*10^8]; p = lsqcurvefit(fun, p0, t, y); t_fit = [0:0.0001:0.1]; y_fit...
  27. hagopbul

    Java Why is this Java code not working?

    Hello all: I am reading a comutacomputa physics book and trying a code from it in MATLAB it is not working and due to my lack of knowledge in this field I can't see where is the mistake hope you can take a look import java.lang .*; public class Motion { static final int n = 100000, j =...
  28. C

    MATLAB_Quantum Well_Finite Difference Method

    Homework Statement Hi, I am new to MATLAB and have an assignment where I have to construct a Hamiltonian matrix, apply boundary conditions, then find corresponding eigenvalues and eigenvectors for the electron in a box problem. I am stumped where to start. From our class we learned that you...
  29. V

    Finding the projection on matlab

    Homework Statement Let u = (3, -8, 5, 5) and v = (-9, -4, -7, 2). Find ||u − projvu||. Homework EquationsThe Attempt at a Solution >> u=[3 -8 5 5] u = 3 -8 5 5 >> v=[-9 -4 -7 2] v = -9 -4 -7 2 >> proj_u_v = dot(u,v)/norm(v)^2*v proj_u_v = 1.2000...
  30. S

    Large datasets - how to handle / alternatives

    Hello, I am trying to do the following: I have two inputs that are very large files - I extract the first column of each so I have two vectors of ~2-5mil by 1. This is timing information. The goal is to extract the indices of each vector where the time in one vector is within a certain...
  31. L

    MATLAB To what extent is the fit to experimental data good?

    I have experimental spectrum in which y-axis is intensity values, and x-axis is frequency values. Int - array of experimental intensities (y-axis). w - array of frequencies (x-axis). I know the view of theoretical function that must describe the obtained spectrum. I explicitly set the function...
  32. V

    Matlab Plotting Points and a Cubic Polynomial that passes through them

    Homework Statement We were given a tutorial to complete which I did complete. Now the question is: By modifying the appropriate lines in your script file, find the values of a, b, c, and d so that the cubic polynomial  y = ax3 + bx2 + cx + d  passes through the (x, y) pairs (-1, 3), (0, 8)...
  33. Abimbola1987

    MATLAB How can attenuation be removed using SCIPY or MATLAB?

    Dear Sirs, I have a signal which has an attenuation of 20dB per decade, how do I remove this attenuation using SCIPY? Alternatively how to do it in MATLAB if there are no SCIPY users here? I'm a SCIPY/MATLAB novice fyg. Thank you for your kind assistance Abim
  34. F

    MATLAB Limiting Map Boundaries in Matlab: A Guide for Scientists

    Hello everyone. I have generated a world map by plotting coastlat and coastlon. I have done it because I want to plot some data that I have over said map. The problem is that my data goes only from 70N to 40 S and from 45E to 125W, thanks to that, I have a figure which looks like in the adjoint...
  35. majormuss

    MATLAB How do I get Matlab to show the first 10 terms of a series?

    I have attached a picture of what I want Matlab to do. I basically want Matlab to show the list of independent variable 'n' and then another column showing the terms when n=0...10. Some of the outputs are in variable form and others in numerical form. My attempt so far is stated below. I have no...
  36. R

    MATLAB MatLab: Understanding the Size Command

    I have a little bit confusion that how size command work.can body explain please?. For Example A=[1 2 3;4 5 6;7 8 9]; size(A) =3 *3 but size(A,1)=3 and size(A,2)=3 and size(A,3)=1 why is size(A,3)=1?
  37. K

    MATLAB MATLAB - solving equation with Bessel function

    Hello, i am trying to solve this equation for x besselj(0,0.5*x)*bessely(0,4.5*x)-besselj(0,4.5*x)*bessely(0,0.5*x) ==0; I tried vpasolve, but it gave me answer x=0 only. fzero function didnt work, too. What function can solve this equation? Thanks
  38. M

    MATLAB Issue in EMG signal using matlab with arduino

    Hello I'm working on project for "design & implementation of EMG data acquisition" for now I completed the design and connected the output of the system to arduino uno to read the emg signal in real time with MATLAB 2017b using arduino support package. the problem is that the signal looks as...
  39. Baynie

    MATLAB Code: Stationary Schrodinger EQ, E Spec, Eigenvalues

    Hello everyone, For weeks I have been struggling with this quantum mechanics homework involving writing a code to determine the energy spectrum and eigenvalues for the stationary Schrodinger equation for the harmonic oscillator. I can't find any resources anywhere. If anyone could help me get...
  40. K

    MATLAB Matlab plotting and defining range

    how do you define x to be from minus pi to plus pi in matlab? i tried: x = -pi : piBut when i said plot (x,y) Matlab says: "Error using plot Data must be numeric, datetime, duration or an array convertible to double" (i already defined y interms of x, that function is ok) so i culd not...
  41. Atlas3

    MATLAB Need help defining an anonymous function in Matlab

    How can a step function be defined as an anonymous function in Matlab? for example for x ==3 return 1, for all other x return x. Thanks
  42. Atlas3

    MATLAB Matlab function plotting. A continuous step function

    i could use a bit of tutelage with Matlab. I have a rather simple equation I would like to plot. I want to create a rational series of primes divided by their corresponding W value from the equation I have. P are primes 2,3,5,7,11,13... I am still working on this. Thanks
  43. T

    NSGA II and objective function in matlab

    Homework Statement I would like to solve a multiobjective optimization problem with NSGA II using matlab. The code can be found here https://www.mathworks.com/matlabcentral/fileexchange/10429-nsga-ii-a-multi-objective-optimization-algorithm I'm looking for a help to implement my objective...
  44. D

    How to use the window functions on a signal in MATLAB?

    Homework Statement I am suppose to write a program that compares the FFT (Fast Fourier Transform Diagrams) of a sampled signal without the use of a window function and with it. The window function should be as long as the signal and the signal should have N points, N chosen as to not cause...
  45. M

    Exporting a matrix to Microsoft Access: Error using database/

    Hello! Below is the code for the following task: matrix "Q" with a dimension of 3*2 was obtained using a matrix of cells "A"; then the matrix "Q" is exported to Microsoft Access with the same dimension (3 rows, 2 columns). (!) The difficulty is that only the first row of the matrix is written...
  46. ytht100

    MATLAB LMI in Matlab scaling to improve condition number?

    A=[ 8147 6324 9575 9572 9058 0975 9649 4854 1270 2785 1576 8003 9134 5469 9706 1419]; D=diag([T^(-3)*L^2 T^(-3)*L^2 T^(-1)*L T^0*L^0]); I have matrix A whose first two columns are of the units T^3/L^2, third columns unit is T/L, and the last...
  47. T

    MATLAB High pass filtering FFT2 matlab

    I am having a slight issue with my code and honestly cannot understand what I am doing wrong. I am currently trying to using a high pass filter in the frequency domain to form the following image. So my approach so far after numerous of attempts which I won't list as I believe I am on the...
  48. L

    MATLAB Can I know the reconstruction of phase shift interferometry in Matlab

    I want to know the reconstruction of phase shift interferometry by angular spectrum method in matlab
  49. N

    Gas pressure regulator model in Simscape

    Hello, I want to develop a pressure regulator model in simscape. The model will be the springloaded direct acting system and the aim is to target outlet pressure, temperature and flow rate by giving input parameters as pressure, temperature, spring stiffness, length and preload, lever(it is...
  50. R

    Plotting Free Body Diagram for Scalar Triple Product in MATLAB

    Homework Statement [/B] The scalar triple product computes the magnitude of the moment of a force vector about a specified line. It is M = ( r×F ) ⋅n , where is the position vector from the line to the point of application of the force and is a unit vector in the direction of the line. Prompt...
Back
Top