Matlab Definition and 1000 Threads

  1. mesa

    Having difficult time trying to plot a simple trajecory

    Hello all, I am trying to plot a simple trajectory in MATlab. Here is the code I wrote, v0 = 100; theta = pi/4; t=0:0.1:20; horizontal(t)=t.*v0.*cos(theta) vertical(t)=t.*v0.*sin(theta)-4.905.*t.^2 %teacher gone missing, again, ARRRGGHHH! title('Ballistic Trajectory of a Projectile')...
  2. f95toli

    Software for creating graphs for presentations

    I was wondering if anyone has a suggestion for software that can be used to create good looking graphs for e.g Powerpoint presentations? | have access to a range of packages (Excel, Origin, Matlab) but none of them can create really "slick" locking graphs (but they are fine for figures in...
  3. E

    MATLAB Matlab Code for Time-Frequency Transformation

    Hello everyone. Sorry if the question is silly, but in really need to know something. We know that The Fourier transform of time is frequency and the inverse of frequency is time. In Matlab can anyone tell me how to write it ? Because in the book Non linear fiber optics by Agrawal we found that...
  4. M

    MATLAB How to Make Matlab Output Zero Coefficients in f=2x^2+1?

    Take f = 2x^2 + 1. When I run coeffs(f) in Matlab it outputs [2,1]. However I want it to output all the zero coefficients as well, for example [2 0 1] here. How do I do that?
  5. A

    MATLAB How to control power source base on load condition in Matlab/simulink

    hi i'm using Matlab/simulink to create a microgrid model which simulate dynamic control of power based on the loads. the loads are changing based on the realtime. I use several voltage sources to power the loads. I would like to be able to turn on/off the generator based on the loads. for...
  6. B

    MATLAB Help with MATLAB code; discrepancy between graph max and Matlab's max

    Hi, For some reason, when I run this MATLAB code, I'm getting what looks like about 10,000 for Rf for the largest Vo on the graph, but MATLAB is giving me Rf at (Vo)max as 100,001 Any ideas? clc; clear; close all; syms Rf Rf = 0:0.1:100000; VRt25 = 18.*(10000)./(10000 + Rf)...
  7. M

    MATLAB How Can I Automatically Load .mat Files in MATLAB?

    Hi, I have some *.mat files and I need to read them automatically, they are like: PT2020-RSK1.778-ZONE49.8962.mat PT2020-RSK2.776-ZONE47.5451.mat PT2020-RSK3.776-ZONE46.041.mat PT2020-RSK4.7695-ZONE56.5417.mat PT2020-RSK5.7667-ZONE48.1113.mat Are there any ways to load them...
  8. A

    MATLAB Help with MATLAB Error: "Subscript Indices Must Be Real Positive Integers

    http://i.snag.gy/FBeLq.jpg I've figured out the first part, (a), it's the second part (b) that's confusing- I've tried re-arranging the plot() function and also tinkering with y1 and y2 rather than y(t), as I get the error: "Subscript indices must either be real positive integers or logicals."...
  9. S

    MATLAB Benefits of DFT over FFT in MATLAB

    From what I have read, FFT seems to simply be faster than DFT, thus making DFT redundant. However, if computational speed is not an issue, are there any advantages of using DFT over FFT (such as increased precision, for example)?
  10. W

    MATLAB Vector concatenation without using a for loop (MATLAB)

    I have a variable number of vectors to concatenate in my Matlab model. Is there a way to do this without a for loop? The number will depend upon input parameters. Suggestions.
  11. E

    MATLAB MATLAB 3D Plotting: Tutorial & Help

    Hi Friends, The code below is for 2D ploting in Matlab, I want to change it in 3D, please if anyone know how to do this.let me know thanks in advancefigure(1); popcosts=[pop.Cost]; repcosts=[rep.Cost]; plot(popcosts(1,:),popcosts(2,:),'b.'); hold on; plot(repcosts(1,:),repcosts(2,:),'r*'); hold...
  12. 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...
  13. 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...
  14. 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...
  15. 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...
  16. 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...
  17. 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?
  18. 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...
  19. 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...
  20. 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.
  21. 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...
  22. 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...
  23. 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...
  24. 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...
  25. 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...
  26. 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...
  27. 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...
  28. 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?
  29. 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?
  30. 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?
  31. 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...
  32. 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.
  33. 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?
  34. 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...
  35. 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] =...
  36. 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_...
  37. 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)...
  38. 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...
  39. 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...
  40. 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...
  41. M

    MATLAB What are the benefits of using MATLAB toolboxes and how do you install them?

    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...
  42. 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 =...
  43. 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!
  44. 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?
  45. 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...
  46. 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
  47. 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
  48. 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...
  49. 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...
  50. 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...
Back
Top