Matlab Definition and 1000 Threads

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

    MATLAB How to plot 3d graphs from multiple .dat files in matlab?

    In my project I basically need to plot 3D color coded surface graphs using MATLAB taking input from multiple .dat files (i have 1000 .dat files). In each file I have parameters x and y, and when I take multiple files, each having a different value of z, I can finally plot a graph. so does anyone...
  2. Ascendant78

    MATLAB Why Does Multiplying the Identity Matrix by Random Values Affect All Elements?

    I need to figure out how to create a matrix that has zeros in everything except the diagonal, and I need the diagonal to be random numbers from 1 to 5. I tried a few different variations like this: R = eye(5)*7*randi(10,5) But I keep ending up with values in every row and column and I am at a...
  3. E

    MATLAB How to find all pairs, triplets, etc in MatLab?

    Hi, I´m a complete MatLab noob and just started using it. I have a set of 30 timeseries measurements (so for a period of 100 years I have 30 measurements for every year, but some years do not have all 30 measurements) and I am trying to find the average of all possible pairs, triplets, etc...
  4. 1

    MATLAB Extracting multiple data in a MATLAB matrix

    Hey everyone. I want to extract numerical data from files let's say g0001.txt to g0060.txt and store it in a matrix with each element is an array. like this: M=[g1() g2() g3() ...g60()] matrix order can be 1 x 60 , i.e. to say 1 row and 60 columns and each element is an array...
  5. C

    MATLAB Learn MATLAB Fast: Best Way to Code Physics Models

    im in a scientific computing class, where we are using MATLAB to model harmonic oscillators and pendulums using like the euler method for ode's. We pretty much got shoved off the deep end with the programming side. I use google to look up things to help me. But its not working that well. What...
  6. X

    MATLAB Matlab vs Mathematica for computing derivatives

    I'm trying to do a calculation which involves taking the derivative of a term that is millions of terms long. I'm using a supercomputer right now with Mathematica to do it but it's taking to long. Does Matlab have a faster algorithm for computing derivatives analytically?
  7. C

    MATLAB Matlab basic - how to get around floating point?

    i'm trying to learn MATLAB and as such i stumbled here while looking something up http://www.mathworks.com/help/matlab/matlab_prog/floating-point-numbers.html so the questions is how does someone avoid something like e = 1 - 3*(4/3 - 1) (this is example 1 in the webpage above) not...
  8. B

    MATLAB How Can You Store MATLAB Recursive Trapezoidal Rule Outputs in a Matrix?

    Hi, I'm trying to write a code for the recursive trapezoidal rule. The code must have the bounds of integration and tolerance. The code is meant to stop when the tolerance between the next and previous value is below 10^-4, given n number of times to sub split the intervals. My progress...
  9. K

    MATLAB Geographically Weighted Regression in MATLAB

    does anyone know sample codes with explanation on computing Geographically Weighted Regression using MATLAB?I am a newbie of MATLAB.
  10. gfd43tg

    MATLAB Learn How to Loop a Matrix in Matlab: Step-by-Step Guide

    Hello, this block of code was given on a previous exam M = [1 3 -2; 7 -5 1]; temp = 0; for k = M temp = temp + k(2) end temp And we are supposed to give the final output of temp. I have no idea how one loops over a matrix, not even elements or anything. What the heck does k = M...
  11. B

    MATLAB [MATLAB] Simple Undamped Forced Vibration Problem

    Hi Folks, I am trying to replicate a solution in Matlab for the following problem ##\displaystyle \ddot x + \frac{k}{m}x = \frac{F_o}{m} \sin w_ot## using 2 first order linear differential equations in Matlab as shown below tspan=[0 4]; y0=[.02;1]; %Initial Conditions for y(1)=x and...
  12. T

    MATLAB Is MATLAB's Implementation of Spherical Harmonics Incorrect?

    Hey guys, This is my first post here, so I will apologize in advance in case I'm posting this in the wrong section. I wrote a very simple function to calculate spherical harmonics in matla, and I used this function during 3 years. Yesterday I found that the function was actually wrong, and...
  13. B

    MATLAB [Matlab] Function Handle-user input

    Hi, My question is in relation to Matlab. I'm curious, is there anyway to employ user inputs for function handles? By this I mean that the user is prompted to enter they're chosen function and the next line of code employs that into a handle. My quick and rough attempt was...
  14. gfd43tg

    MATLAB [Matlab] Order of precedence in computations

    Hello, here is a list of the order of precedence for computations when programming, at least in MATLAB 1. Parentheses (starting with innermost pair) 2. NOT (~) (left to right) 3. Arithmetic operations (left to right) 4. Relational operations (left to right) 5. AND (&) 6. OR (|) 7...
  15. gfd43tg

    MATLAB Mastering Structure Arrays in Matlab: Confusion and Exam Preparation

    Hello, I am preparing for the exam for my Matlab class, and have run into some confusion with Structure arrays. I have a hard time keeping all the concepts straight in my head. I am working on an old exam problem, where this is the structure array, which I will use as an example to demonstrate...
  16. gfd43tg

    MATLAB Matlab Concatenation Help: Resolving B([1 2], [1 3])

    Hello, I am curious why the following concatenation is not working the way I thought it would. B = [0 5 1; 2 4 3] B = 0 5 1 2 4 3 B([1 2], [1 3]) ans = 0 1 2 3 I don't really understand what this command is extracting from the matrix and how it...
  17. gfd43tg

    MATLAB Understanding Matrix Division in Matlab: Solving Linear Systems

    Hello, I am confused about a concept, Suppose I am trying to solve a linear system ##Ax = b## I want to know why is it when I solve for x, the command is x = A\b. Why would it not be x = b\A. One could see that if you divide x on both sides, then b/x = A. Is this not true for the matrix?
  18. T

    MATLAB MATLAB : How to find the line of best fit through a binary image?

    I have found the 2D Fourier transform of a figure and then changed it to a binary image (attached). I want to find the line of best fit through the longest "axis"? of this figure. What would be the simplest way to accomplish this?
  19. M

    MATLAB Multiplications of functions in Matlab

    Hi. When I try to this multiplication: t=[0:0.02:1]; f=exp(-t)*sin(t) Error using * Inner matrix dimensions must agree. in Matlab I take the error above and I can not also plot its graph by plot(x,y). Can somebody help me?
  20. gfd43tg

    MATLAB Loop Analysis in MATLAB: What is the Code Doing?

    Hello, I am trying to decipher loop codes and I am having a lot of difficulty doing so Here is an example code A = 0; while A < 1 for k=1:5 A = A+(-1)^k; end A = A+k; end So I thought the while function does something an infinite amount of times. This is what...
  21. gfd43tg

    MATLAB Understanding the Differences Between & and && Operators in MATLAB

    Hello, I am having some difficulties understanding the difference between the two and when I would want to use one over the other.
  22. mesa

    MATLAB [Matlab] Can't find inputdlg.m file

    I want to look at it and see if there is another option to resize dialog boxes, does anyone know where it is hiding in MatLab R2013b?
  23. dkotschessaa

    MATLAB Matlab - Change parameters of equation while plot displayed

    First note that I am just learning Mat lab, and running a program created by someone else. I have a program which is displaying four differential equations on screen, all with various parameters assigned in the beginning. i.e. alpha=10; beta=0.04; gamma=0.020; etc. For...
  24. M

    MATLAB A matlab warning on solving equations

    Hi, >> d = 'x^2 + 9*x –7 = 0'; >> solve(d) Error using solve>processString (line 354) ' x^2 + 9*x –7 = 0 ' is not a valid expression or equation. Error in solve>getEqns (line 284) eqns = processString(eqns, v, vc); Error in solve (line 160) [eqns,vars,options] =...
  25. M

    MATLAB Matlab Help: EZplot for x^2 – 6x – 12

    d = x^2 –6*x – 12; >> ezplot(d) Error using inlineeval (line 15) Error in inline expression ==> x.^2 –6.*x – 12 Error: The input character is not valid in MATLAB statements or expressions. Error in inline/feval (line 34) INLINE_OUT_ = inlineeval(INLINE_INPUTS_...
  26. M

    MATLAB Creating a Matlab Contour Plot with Iterative Growth - Help Request

    hey pf! i am trying to plot a contour (topographic) graph the following ##f(x,y) = \frac{1}{x^2+y^2} e^{x-(x^2+y^2)^{.5}}## where ##f(x,y) = k## where ##k = .001## and doubles in size for about 8 iterations. my attempt is here: x=-3:0.25:3; y=-3:0.25:3; z=.25:.25:1; [X,Y]=meshgrid(x,y)...
  27. M

    MATLAB [Matlab] Gui help for adding code

    Hi, all there is an example for gui but I can not do. Could somebody help me. I generated a button in gui then I have to add some function on in. Codes are in the picture. Will I add them under callback function? Why can I not determine where I should I add them. To understand it what...
  28. R

    MATLAB [Matlab] Problem in modeling a DAE system using ode15s

    Dear all, I have a coupled system of ode's with an algebraic equation. The equations are as follows, function dy=lorentz(t,y) global Vfc; %fcdata.m % Data file for the hybrid system with parameters values %*************************************** % Physical parameters Rl = 0.024...
  29. ShayanJ

    MATLAB Calculating Bound States of a Particle in a Triangular Well Using MatLab"

    Hi I'm trying to figure out in what energies the bound states of a particle in a symmetric triangular well happen to be, using MatLab(Actually GNU Octave!) At first I non-dimensionalized the associated Schrodinger equation and got: \frac{d^2 \varphi}{dy^2}+[ \varepsilon-v(\pm 2y-1) ]\varphi=0...
  30. M

    MATLAB Exploring MATLAB Toolboxes: Benefits and Installation Guide

    What is a MATLAB toolbox? Can we rebuild them? Can not we use MATLAB effectively if we do not have toolboxes? Are there any pre-installed toolboxes when we install matlab? How can we see if they are installed or not by using or not using matlab. I have never used a toolbox so I do not know...
  31. K

    MATLAB [Matlab] Error running optimization.

    Error running optimization. Inputs must be a scalar and a square matri I am trying to use fminunc using optimtool. But i got the error Error running optimization. Inputs must be a scalar and a square matrix. this is the function i typed in the editor. function F = fun(x) F =...
  32. M

    MATLAB MATLAB Compatibility: Using MATLAB on PC and Mac - A User's Question

    hey pf! i had a question. my university uses MATLAB for computing on a PC. however, i am using a Macbook. do you think the two can sync with each other? i am waiting on purchasing MATLAB until i know for sure both an communicate with each other. thanks all!
  33. B

    MATLAB MATLAB Fourier Synthesis: Create Signal from Spectrum

    Hi I wanted to check how to do a Fourier synthesis to recreate a signal from a frequency spectrum. So I basically have the frequency spectrum so I have the power of the fundamental frequency and the harmonics. Is there a way I can do a synthesis to create a time signal?
  34. H

    MATLAB Composite Simpsons 1/3 matlab code

    hey guys, So I'm working on a MATLAB function that uses simpsons 1/3 rule to find an integral. This is what I have done so far, but I'm not 100% confident.. I seem to get double when I use greater segments. If anyone would be able to have a look at give me some tips that would be very much...
  35. E

    MATLAB Coupled 1st order differential equations in matlab

    Hello everyone I just want to ask if anyone could help me or at least tell me if it is possible to solve the couple equations using matlab I saw ode45 but that is for one equation only Thank uou
  36. E

    MATLAB Need MATLAB Implementation for OFDM Communication Systems in Continuous-Time?

    Hello all, Does it occur that anyone here working on OFDM communication systems? I need a MATLAB implementation of such systems in the continuous time. I will provide the math derivations if requested. Thanks
  37. C

    MATLAB Projectile motion with friction in MATLAB (ODE45)

    I'm working on a little project where I want to plot the motion of a projectile with air resistance. The air resistance can be assumed to be proportional to the velocity squared. F_{f}=-Bv^{2} F_{f,x}=F_{f}\frac{v_{x}}{v}, \ \ F_{f,y}=F_{f}\frac{v_{y}}{v} where B depends on the height...
  38. L

    MATLAB How would you write this equation in MATLAB? (challenging)

    Hello guys, I would like to put this equation into the MATLAB to calculate the global maximum of mutual information function. In order to do that, I notice that I need a gradient of the function which is described as in attached files. I do have the vector for P(x) and P(x|spike). Let's...
  39. B

    MATLAB Computing question 1st year Engineering-MATLAB

    Hi, the question is as follows. I wish to calculate all of the different possible combinations of two vectors in regards to Pythagoras theorem. Not just an element by element operation My code is as follows; opposite=(0:30) adjacent=(0:30) hypotenuse=sqrt(x1.^2+y1.^2) When I use...
  40. P

    MATLAB [Matlab] Replace pixels of an image with theta of Polar Coordinates

    Dear Math and Physics fans You have always been so helpful in the past and I was hoping that I could call on your expertise once again. I want to make a wedge filter in MATLAB so I can determine the orientation of the ellipse of a centered 2D fft. I tried to make an new image where...
  41. ShayanJ

    MATLAB Rutherford scattering using MatLab

    I'm writing a program for simulating the angle distribution of scattered particles from a gold nucleus but I doubt the results. I don't know...But it would be very good if someone check it and give some hints. I also want to ask should I vary both initial speed and impact parameter in one...
  42. S

    MATLAB Measuring the 'purity' of a sine wave using FFT (Matlab)

    I have a range of sine waves I have obtained in an experiment. I want to put a measure on the purity of these sine waves - how well the reproduce a theoretical sine wave. Is there anyway I can analyse the FFT of the sine waves in Matlab and put a measure on the purity of the sine wave...
  43. M

    MATLAB .Should I Upgrade to the Latest Version of Matlab?

    Hello, I have just been wondering that given each year we get two new versions of Matlab, for someone like who uses/used Matlab 2001 (or Matlab 7) I am wondering if there's a great reason to move to the recent versions (Matlab 2014a) even when I use only a selected number of toolboxes. Thanks
  44. V

    MATLAB Minimizing a function in one variable in Matlab

    This problem was originally a multi objective problem but using scalarization it can be transformed to the following: Min: -p'*x + u*x'*V*x subject to 1*x=1 -u is the risk aversion index that I wish to vary from .1 to 100 -V is a (4x4) variance covariance matrix -p is the (4x1) expected...
  45. A

    MATLAB Entering simulink 3D look-up table data from MATLAB

    I have created a contour plot in MATLAB using the following code: >> NP=40; >> [RP TP]=meshgrid(linspace(min(RPM),max(RPM),NP),linspace(min(BMEP),max(BMEP),NP)); >> BSFC_IT=griddata(RPM,BMEP,BSFC,RP,TP); >> NC=12; >> Fig1=figure; >> [CT...
  46. U

    MATLAB Solving equations involving specific elements of matrices in MATLAB?

    So let's say I have 2 matrices A and B. I need to solve 2 eqns involving specific elements of each matrix. e.g. A(1)+B(2)=4; A(1)-B(2)=2. Is there any way to do this? My efforts with Fsolve and solve have failed. Here's what I've done so far: function F=myfun(A,B)...
  47. ShayanJ

    MATLAB Troubleshooting Simple Harmonic Oscillator in MATLAB

    I'm trying to plot the evolution of a simple harmonic oscillator using MATLAB but I'm getting non-sense result and I have no idea what's wrong! Here's my code: clear clc x(1)=0; v(1)=10; h=.001; k=100; m=.1; t=[0:h:10]; n=length(t); for i=2:n F(i-1)=-k*x(i-1)...
  48. E

    MATLAB Can one repeat a matlab script from the beginning?

    For one of my classes, our project is to write a script that simulates the game of craps. I have no problem with the actual game, but one of the criteria is that after the player wins or loses, we are supposed to prompt them to quit or play again (this is where I'm stuck). Is there a command...
  49. E

    MATLAB Matlab : Function handle givin array to cell array of function handles

    Hi. I am currently in a situation where I have a function handle giving as putput an array of doubles. I would like to convert this to a cell array of function handles, each giving a component of the previous array. The original function handle is produced by a built-in MATLAB function, so...
  50. A

    MATLAB Filter command for contour plot MATLAB

    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(Torqu e),NP)); >> BSFC_IT=griddata(RPM,Torque,BSFC,RP,TP); >> NC=12; >>...
Back
Top