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

    MATLAB Troubleshooting a MATLAB Error: Inner Matrix Dimensions Must Agree

    Hello! (Wave) I have written the following code in matlab: function v=uexact(x,t) v=sin(2*pi*x)*exp(-4*pi^2*t); end function [ex]=test3 h = 1/50; T=1/2500; x=0:h:1; t=0:T:1; ex=uexact(x,t); end I...
  2. Tone L

    MATLAB Solving MATLAB Loop with X & Latitudes

    I have a list of latitudes: lats = 41.0100000000000 43.7800000000000 44.4200000000000 41.2500000000000 42.8000000000000 42.7500000000000 42.4900000000000 42.4900000000000 42.7800000000000...
  3. kelvin490

    MATLAB MATLAB enlarge 3D plot without enlarging colorbar

    Is it possible to enlarge a 3D patch without altering the size of the colorbar? My original picture is like this one: https://www.dropbox.com/s/xashny3w1fwcb2f/small.jpg?dl=0 I just want to enlarge the block in the middle of the figure keeping the colorbar unchanged. I used zoom(1.9) before...
  4. kelvin490

    MATLAB MATLAB how to automatically read a number of files

    I would like to plot a number of 3D graphs from different data files. For example I am using fid = fopen('SS 1.dat','r'); to read the first file and then plot a graph. How to set the program to change the name to 'SS 2.dat' automatically? Also for the tenth file the name becomes 'SS 10.dat'...
  5. kelvin490

    MATLAB MATLAB movie2avi cannot made video

    I am trying to test the function movie2avi using simple codes in R2014a as follows: clear; close all; figure; Z = peaks; surf(Z); axis tight manual; ax = gca; ax.NextPlot = 'replaceChildren'; loops = 40; F(loops) = struct('cdata',[],'colormap',[]); for j = 1:loops X =...
  6. C

    MATLAB Is 2GB ram enough to work on C language and matlab

    Hello everyone I am going to buy a computer soon. And because I don't have much money, computer s ram can be 4 GB at most and which will cause me some trouble. My question is that will 2gb ram be enough to work on MATLAB and learning to code.
  7. M

    I want to find the vector components of an MRI pixel -- How?

    I have a Dicom Image that is interpreted as an array. Each cell is a pixel. Each pixel has a value. I want to find the vector components (x,y,z) of a pixel. Specifically, I want to find magnetic field vectors for each pixel. The image is for H1 atoms. Freq = 297, B0 = 3. How would you do this...
  8. T

    Simple 4 bus Newton-Raphson matlab not converging

    Homework Statement All the necessary data is in the code, I'm just trying to converge NR, I decided to use the equation S = V^2 / Z since I had the admittance matrix and powers (needed voltages) I think my simple algorithm has a slight issue I can't find. Homework Equations Thank you! The...
  9. A

    MATLAB How to plot text file in MATLAB

    I had to use a network analyzer measuring the standing wave pattern along a transmission line taking data points at half mm increments. The software I used got me the values in a text file and the way it is formatted, I can't figure out how to make the left side the X axis and right side the Y...
  10. L

    MATLAB Calculating Triple Correlation in MATLAB for Three Signals

    Hello, How can I calculate a triple correlation between 3 signals A,B,C (each has 2 million samples)? I know xcorr do it for 2 signals by FFT each signal, multiplication and iFFT back. Since xcorr cannot do it for three signals, I try to do it "manually" by the above algorithm. So, the "regular"...
  11. R

    Convert ECI to ECEF: A Step-By-Step Guide

    I have done a search online to understand how to convert ECI to ECEF. I wanted to learn what the conversion is so I could just create a MATLAB script to make it happen. My problem is that most of the information I find assumes you already have some knowledge about ECI and ECEF. If I had more...
  12. kelvin490

    MATLAB Enlarging & Repositioning Figures in MATLAB

    I want to create figure that is enlarged, I use: fig = figure(1);%These two lines maximize the figure dialogue set(fig,'Units','normalized','Position',[0,0,1,1]); Then I use zoom(1.9); to enlarge the figure The dialogue is enlarged. But I want to reposition it just like use the "pan" button...
  13. T

    MATLAB Resolving MATLAB Plotting Issue with Velocity & Position

    I am trying to plot the magnitude of velocity and position against time but keep running into issues. The error I am getting here is: Subscript indices must either be real positive integers or logicals. Error in project2 (line 46) position(t) = w(1:3);Here is the relevant portion of my...
  14. H

    MATLAB How can I position text on multiple Matlab plots with different scales?

    I want to have three plot 1,2,3 in Matlab with the symbols (a), (b) and (c) on plots 1, 2 and 3 respectively.I can do it by text('(a)'), text('(b)'), text('(c)') on the plot 1,2 and 3 respectively but I want to have the three symbols on the same position on the three plots for example...
  15. lep11

    Matlab data-analysis problems (systematic error, distributions)

    Homework Statement I have a few data-analysis problems due to Thursday, 1. Assume that a sandbag is dropped at different heights and the observations are (z i;ti) pairs. Physical model for a free fall is z=½gt2. Assume that the height measurement z has an additive random error v. The...
  16. T

    Runge-Kutta method - Orbital mechanics

    Homework Statement Given: Initial orbital elements of a satellite a=6652.555663km; e=0.075; i=28.5 degrees; Ω=40 degrees; w=30 degrees; n=0 degrees;Tasks(using MATLAB): 1. Convert orbital elements to position and velocity vectors 2. Use these vectors to initialize the Runge-Kutta...
  17. R

    MATLAB Fit with implicit nonlinear function - Matlab

    Hi guys! I am trying to fit a function whose x data depends nonlinearly on the parameter of the fit and I am having hard time doing that! I will explain better: from my experiment I was able to measure my ydata e my x0 array and I know that my xdata are: x=x0+a/(1+4x^2), with a being a...
  18. I

    MATLAB Matlab Switch w/ string function

    hey hey :) So this is the code i came up with %% part 2 x=[1 2 3 4 5]; % 1 is freshman % 2 is softmore % 3 is junior % 4 is senior % >4 is super senior for i=1:5 s=input('number: '); switch s case 1 yearNumber='freshman'; case 2...
  19. N

    MATLAB Plotting Complex Wavefunction - Matlab

    Hi, I am wondering how to plot a complex function of the form: Ψ(t) = Ansin(n⋅pi⋅x/L)e-iEnt/h + Bnsin(m⋅pi⋅x/L)e-iEmt/h + ... + where m and n are known eigenvalues of the infinite square well with corresponding energy En, for any particular x? So, this will be a function of solely t. Any help...
  20. CuppaMuons

    What should I choose as the error on x? (Curve Fitting Matlab)

    Homework Statement So I've done an experiment by scanning over a range of angle and measuring the intensity of X-Rays. There are peaks where I have X-Ray diffraction occurring and in order to do analysis I need to identify the values of angle and an error (as in the plus/minus) on this value...
  21. M

    IsPalindrome: Matlab Function to Check Word

    I am trying to write a function called ispalindrome, with Matlab, It is supposed to check if a word is a palindrom or not. It will then return a value True (1)or False(0) for each word. I have tried to run this, but something seems to be wrong... function isPalindrome (word) word =...
  22. T

    Finding roots using Newton's method in MATLAB

    Homework Statement I am supposed to find the roots of the equation: 10esinx = x2 - 5x +4 in MATLAB using Newton's method with a tolerance of 10-8. There should be three roots. Homework Equations p=po - f(po)/f'(po) |p - po| < TOL The Attempt at a Solution Here is what I have for the code...
  23. H

    MATLAB Coding up a simple geometric algebra in MATLAB

    Hi, I have been wanting to do this for a while but not too sure how to go about it. I have the following geometric algebra \lbrace\mathbf{e}_{i}\rbrace_{i=0}^{3} which satisfy the following relations: \mathbf{e}_{i}\mathbf{e}_{j}=-\mathbf{e}_{j}\mathbf{e}_{i} and...
  24. R

    MATLAB MATLAB License Error | Troubleshoot & Resolve Now

    I am getting a license error and not able to open MATLAB after trying the troubleshoot.
  25. E

    Fourier Transform and Convolution

    Considering two functions of ##t##, ##f\left(t\right) = e^{3t}## and ##g\left(t\right) = e^{7t}##, which are to be convolved analytically will result to ##f\left(t\right) \ast g\left(t\right) = \frac{1}{4}\left(e^{7t} - e^{3t}\right)##. According to a Convolution Theorem, the convolution of two...
  26. M

    Creating a Monthly Calendar with fprintf in Matlab

    Homework Statement How can I make a calendar with fprintf? It is making me crazy. The parameters year and month are supposed to give me the whole calendar, with month day and dates.[/B]Homework EquationsThe Attempt at a Solution I just get the first line of the month[/B]
  27. J

    Matlab, plotting a directional field

    Homework Statement Plot the direction field of y' = −t(y 2 − .5y − .5) for t=[0,5] and y=[-2,2]. Plot a line every 0.25 units in t and y. The length of each line should be 0.1. Hint: Use line(). Look at the picture to determine the starting and ending coordinates of each line. Homework...
  28. SteliosVas

    Second Order Non linear ode matlab

    Homework Statement Okay the problem is of a free swinging pendulum with dampening which is modeled using the following equation: Damping coefficient: c=1 s−1 Mass: m=1 kg Gravity: g=9.81 ms−1 Link length: l=0.5 m We know θ(0)=90° and θ′(0)=0, solve this equation from t = 0 to t = 10...
  29. L

    MATLAB Convolution: Finding the Convolution of Two Functions with Step Inputs

    Homework Statement Use MATLAB to find the convolution between a) ##f(t) = u(t) -u(t -3)## and ##g(t) = u(t) -u(t -1)## Homework Equations The Attempt at a Solution t = -10: 0.1: 10; f = heavisde(t) -heaviside(t -3); g = heaviside(t) -heaviside(t -1); t = -20: 0.1: 20; c = conv(f, g); plot(t...
  30. I

    MATLAB MATLAB: Merging Matrices - Create 0s Matrix & Replace with Values

    Create a matrix with 4 rows and 8 columns with every element equal to 0. Create a second, smaller matrix with 2 rows and 4 columns where each row is [1 2 3 4]. Replace the 0s in the upper left-hand corner of the bigger matrix with the values from the smaller matrix. (If you do this correctly...
  31. I

    MATLAB MATLAB: Square & Cube of 1,2,3

    We want to know the square and the cube of each of the following numbers: 1, 2 and 3. You can have MATLAB obtain these results as follows. Create a vector [1 2 3] . Create a vector [2 3]. Use these two vectors as inputs to the meshgrid function (with the 3-element vector as the first argument)...
  32. I

    MATLAB Simple vector functions in matlab

    I have an assignment for MATLAB where I am required to create two vectors x and y and then to find the sum in three ways. first, create an extra variable z and find the sum second, use the dot function third, multiply x with the transpose of y here's my code x=linspace(0,1,5)...
  33. ElijahRockers

    MATLAB DSP: Best curve fitting approach via MATLAB?

    I am doing an experiment that generates data in three 1-hour-blocks. Each block has a different number and timing for acquisitions. (The first hour is more frequent and numerous, while the last hour is only 6 acquisitions) The reason for breaking it up into 3 hours is to give the subjects a...
  34. B

    MATLAB How to give a step input in Matlab?

    Hello, I have a state space equation at hand.. This attached with this... Now the term (theta double dot) is a positive step for 0,136 milli seconds and negative step for next 0,136 millisecond and 0 at all other times. So that when I simulate I will get a graph as below: This is the nature...
  35. FrancescoMi

    MATLAB Solving One Equation on Matlab: Finding Parameter p

    Hi, I have to solve one equation on Matlab. The equation is: (p-c)*psi'-psi=0 I have to find p. Where psi is: and psi' is the derivative of psi. I've written this code: rho = 0.04; %In the image is lambda c = 25; eta = 0.02; mu = 40; sigma = 0.57; alpha = -rho/eta; syms p t F =...
  36. N

    MATLAB Matlab Compiling Running (MCR)

    Dear Group, I am trying to run Matlab Compiling Running (MCR) using Python, DOS, Putty ...like matlab.exe Anyone who worked with it before, please give me some recommendation, Thank you very much Group. Nate Duong.
  37. gfd43tg

    MATLAB MATLAB & LaTeX Syntax Solutions

    Hello, I am trying to publish a file on matlab, and for some reason it won't accept my code, even though it works on this forum. Does MATLAB use some other syntax for matrices? $$ \vec {x} = \begin {bmatrix} T-T_{s} \\ C_{A} - C_{As} \\ C_{P} - C_{Ps} \end {bmatrix}$$
  38. SteliosVas

    Solving Rand Function MATLAB Homework

    Homework Statement The number of iterations it takes for the product of two random numbers to produce a number less than 1e-5. Homework EquationsThe Attempt at a Solutionwhile z < 1e-05 count1 = count + 1; x = rand(1,1); %rand 1x1 matrix z = floor(a + (b-a+1) * rand(b,1)); if z <...
  39. M

    MATLAB How can I add vector input to this MatLab function?

    Hi pf I have a question that I have not been able to find. The below function accepts outside scalar inputs but not vectors. The code is below. Also, ## a, b, delta,FA,Hi,vHnew,iv## are all scalars defined outside the function. The vector I would like to add as an input is ##x##, which I've...
  40. FrancescoMi

    MATLAB Error in MATLAB Code: Fixing 'Function 'diff' is Not Supported

    Hi, I have a problem with my MATLAB code. The error is: "Function 'diff' is not supported for class 'function_handle'." I have installed the toolbox Symbolic Math Toolbox after the installation of Matlab, but I think that it works, so my code is this: t=2; alpha=2; p_0=20; c=10; eta=0.2...
  41. SteliosVas

    Signum Function Matlab Homework Solution

    Homework Statement Okay basically we have two vectors x and y, and we are required to use the signum function to get the negative and positive ones and preform a operation on them. That is square the positive ones and square root of the absolute value of the negative ones. x= [ 1:1:10] y= [...
  42. B

    MATLAB Create Math Graph using Matlab?

    How do I create a graph of y = x^2 + x + 1 in Matlab? Where I could create the above math graph in Matlab (please see below image)?
  43. Remixex

    Am i being taught programming right?

    I'm an 2nd year student aiming for the major "Geophysics", my course, "Numerical Programming for Geophysicists" is teaching me how to use Octave, not Matlab, and they force me to use the terminal, not the GUI, on top of that we use Linux, i am also learning Shell and Python. Regarding the...
  44. Z

    MATLAB Best Free Android Matlab/Octave Code Editor for Quick Calculations and Plots

    I'm wondering if anyone has found a (preferably free/open source) text editor for Android that highlights matlab/octave code syntax? I recently got a tablet and thought it would be pretty nice to be able to use it to quickly put together some calculations/plots during discussions and so. I've...
  45. B

    MATLAB Want gray scale image of a matrix in matlab

    I am creating a gray-scale image of a 2000*2000 matrix using mat2gray and imshow command.But highest number of matrix entries that imshow can implement is 500*500 approximately.After that it shows------ "Warning: Image is too big to fit on screen; displaying at 8% > In...
  46. B

    Aerospace Eng. Student Struggling with Blended Wing Body Design

    Hello everyone! I'm a aerospace engineering student. I'm working in my own program for blended wing body aircraft parameterized design. I'm triyed to use Tornado program but it doesn't even allow me to setup the geometry, after introducing the chord the program goes in a bucle and when I stop...
  47. A

    MATLAB How to calculate stress on a beam using MATLAB?

    Hey all, I want to calculate the stress and strain on a beam using MATLAB and I would also like to make a stress-strain curve as well. The problem is as follows: I have a hollow rectangular aluminum beam that is fixed at both ends. I have the material properties and the dimensions of the beam...
  48. Z

    MATLAB FFT for one 1*N Green function in MATLAB

    I have a 1×N Green function in energy domain. I want to use the FFT (fast Fourier transform) for this Green function in MATLAB. But this function is non-periodic. Could you help me about this? How can I change the energy interval to convert Green function as a periodic function?
  49. Tone L

    MATLAB Learning MATLAB - A Guide to Tutorials and Books

    Hi, I saw some threads about MATLAB books already but the seemed a little outdated ~2008. I was curious to know if there was any good books to read as a tutorial of matlab. Potentially a pdf online would be cool as well. One thing too is I won't be taking the course at school until September...
Back
Top