Matlab Definition and 1000 Threads

  1. A

    MATLAB Combining Plots with Different Y-Axis Ranges in Matlab?

    Good Day Everybody, Please assist me on these problems 1. I wish to put six plots on the same plot using matlab. The details of each plot are stated below PLOT 1 x axis range 0:1 y axis range 0:1 PLOT 2 x axis range 0:1 y axis range 0:1 PLOT 3 x axis range 0:1 y axis range...
  2. marellasunny

    MATLAB Spruce budworm diff.eq,parameter variation using matlab functions

    I have come across a MATLAB code for solving the spruce budworm differential equation.But,I would like to solve the same differential equation for a range of parameters(r=0:5,q=0:10).I am having problems trying to define the array of matrices for each loop.Please look at the code below:% This...
  3. H

    MATLAB Problems with the latest version of Matlab

    Has anyone found that their MATLAB programs are now giving nonsensical results in te latest version of matlab? I wrote a program which worked very well in the 2011 version of MATLAB but now in the 2012 version of MATLAB it still sort of runs but nor yields nonsensical results. I can show...
  4. thekey

    MATLAB Please I need a Help with matlab code (Controlling the LEGO NXT Using MatLab)

    Hi Controlling the LEGO NXT Using MatLab What are my mistakes in this code ??! COM_CloseNXT all clc clear handle = COM_OpenNXT(); COM_SetDefaultNXT(handle); COM_CloseNXT(handle); NXT_GetBatteryLevel(handle); COM_CloseNXT(handle); COM_CloseNXT all clc clear...
  5. M

    MATLAB Calculate Relative intensity noise using laser Rate equations matlab

    Hello Everybody, I'm trying to plot the frequency spectrum of RIN using Matlab. I've the following code function p=rateblock tau_s = 3e-9; N0 = 1e24; A =1e-12; P0 = 1/(A*tau_s); TSPAN = 0:1e-2:10.23;; Y0 =[0 0]; [T,Y] = ODE45(@rate_equation,TSPAN,Y0); subplot(2,1,1)...
  6. J

    MATLAB Graph Piecewise Functions in MATLAB?

    Hey guys. I need to graph a piecewise function in MATLAB and I don't know how to do it. On top of that, it is also in radians: f(θ) = (80/∏2) θ, -∏/2 ≤ θ ≤ ∏/2 (80/∏) - (80/∏2) θ, ∏/2 ≤ θ ≤ 3∏/2 How do I graph it in MATLAB? And other than that, is there a way in MATLAB that I can take...
  7. S

    Quick question (hopefully) on Matlab transfer functions

    Homework Statement I'm reading through the help files and came across this example: s = tf('s'); H = s/(s^2 + 2*s +10); I understand that when using a rational expression it must be specified, s= tf('s'); I also understand that the rational expression is entered through H=s/(s^2 +...
  8. A

    MATLAB How to properly use accumarray in MATLAB with sorted indices and weights?

    accumarray documentation Is anyone proficient in the use of accumarray? I supply two vectors of same length, indices L,weights W, L positive integers as required. I sort the indices to ascending.Then, the result of accumarray is not equal to unique(L).How could this be? Code for illustration: i...
  9. S

    How to Modify MATLAB Code for a Beam with Horizontal Distributed Load?

    Homework Statement The problem picture is attached(file 1),its a beam subjected to horizonatal ditributed load 2. Relevant examples the MATLAB solution for rectangular shape with vertical load on the upper right corner is like follow, i try to modify it according to the new picture...
  10. K

    How Can MATLAB Help in Plotting the Electric Field of a Charged Wire?

    Homework Statement A straight wire of electric charge truncate to length L has a linear charge density of ρ= 8 C/m. Using a computational approach calculate the electric field due to the truncated line at any arbitrary point in space. Consider L = 1 m, assume line lies along y-axis with...
  11. E

    Matlab - Weird answer with all zeroes

    I programmed a function that outputted this weird answer that looks like: ans = 1.0e+147 * Columns 1 through 16 0.0000 0.0000 -0.0000 0.0000 -0.0000 0.0000 -0.0000 0.0000 -0.0000 0.0000 -0.0000 0.0000 -0.0000 0.0000 -0.0000 0.0000 Columns...
  12. I

    Matlab Programming(Need help with the last couple of details)

    Homework Statement Okay, so I need some help with this Matlab program. I never learned Matlab, so I'm trying to do it as best as I can. The question is: Calculate the 2nd and 3rd degree Taylor polynomials for the function f(x)=ln(1+x) about the point a=0 Plot these polynomials and the...
  13. Q

    MATLAB Fit data with a curve in MATLAB

    Hi friends. I want to fit my x datas and y datas with a function in the most exact way.my data is: x=[0.3 0.5 0.7 0.9 1 1.3 1.4 1.5 2 3 5 7 9 10 30 50 70 90 100]; y=[13.4347 8.3372 6.3107 5.27 4.93 4.28 4.14 4.0199 3.6349 3.3178 3.1282 3.0691 3.0432 3.0354 3.0043 3.0016 3.0008 3.0005...
  14. M

    MATLAB Calculating similarity between users using matlab

    Hi all, I am having database of 963 users . Records of two users are uid gender occupation age 1 F student 23 2 M teacher 30 Now i need to calculate the similarity of each user with every other as sim(ui,uj)=0.8*sim(age) +...
  15. J

    MATLAB Troubleshooting MATLAB Simulink Circuits for Sinusoidal Wave

    Hey guys. I am trying to simulate some circuits in MATLAB's Simulink, and I always get some weird graph which is not sinusoidal at all. I wanted to know if anyone could tell me which block am I missing if I want to get a good sinusoidal wave. Here are the pictures of the circuit and the...
  16. Q

    MATLAB Problem in triplequad in matlab

    Hi friends I want to get 3variable integral from a function which is in terms of x,y,z,m,a but I know that a=0.01 and m=3 and want to integrate over x ,y,z >> triplequad((4 .*((-2.* a + m).^2 .*(4 .*a + m) +4 .*a.^2 .*(2.*(2.*a - m).* cos(z) + cos(y) .*(4.* a - 2.* m + 4 .*a.* cos(z) - m...
  17. A

    MATLAB [Matlab] Plotting two functions of the same variable against each other

    I need to make two plots of volume as a function of time vs pressure as a function of time. When plotted the graph will have an enclosed area. I am having trouble on how to have MATLAB plot these two functions against each other. My experience with MATLAB is having a function defined in a...
  18. E

    Why am I only getting one output when I run my Matlab function with 2+ outputs?

    I'm having trouble getting two outputs. Here's a simple example: function [a b] = test2() a = 2; b = 5; When I run the code, I only get the output of a = 2: >>test2 ans = 2 How can I get b outted as well?
  19. M

    MATLAB Plotting a potential function in MATLAB

    Hi all, I would like to be able to plot this function in MATLAB \mathcal{V} (\phi_{1}, \phi_{2}) = m^2(\phi_{1}^2 + \phi_{2}^2) + \lambda( \phi_{1}^2 + \phi_{2}^2)^2Where \phi_{1,2} , m^2 , \lambda \in \mathbb{R} and \lambda > 0 I am aware that the cases m^2 > 0 and m^2 < 0 yield two...
  20. N

    MATLAB Matlab recursion (error in book?)

    This is what my book gives for recursion of fibonacci sequence (matlab coding). function res = fib(n) if n == 1; res = 0; elseif n == 2 res = 1; else res = fib(n-1) + fib(n-2); end Am I mistaken or this doesn't work for fib(3)? Keep in mind I am still learning about...
  21. B

    [MATLAB] Making code faster/more efficient

    A is a sparse matrix. B is a vector. I have the following code: for j=1:N B=A*B; end; This part of the code is inside a function which gets called about 160000 times. I ran the Profiler and this part is the bottleneck. How can I make it more efficient?
  22. P

    MATLAB .Getting Started with MATLAB for Astrophysics Projects

    Hello, This is my first semester as a graduate student in astrophysics. I have a project and I should use MATLAB. Unfortunately, I don’t know how to use the software. Can someone please recommend any tutorials, books, links, ebooks, … Thanks a lot
  23. Q

    MATLAB Matlab help User defined function

    I made a user-defined function for Height. function Ht=Height(t,V,Theta); Ht=V*t*sin(Theta)-4.9*t.^2; end V is initial velocity, and i kept on getting input "V" is undefined. Can someone help me please!
  24. Q

    Matlab help User defined function

    I tried to make a user-defined function. function Ht=Height(t,V,Theta); Ht=V*t*sin(Theta)-4.9*t.^2; but then i kept on getting Input argument "V" is undefined... can someone help me please
  25. marellasunny

    MATLAB Output of ode45 for System of Differential Equations

    My book explains the command x(:,1) as "x,all rows,first column". Q.How does the output of ode45 for a system of differential equations look like? But,when I solve a system of 2 first order differential equations(w.r.t time),I take x as a "column vector". [x1 x2] So,if I wanted to plot x(1)...
  26. Q

    MATLAB Solving a MATLAB Problem with 3 Variable Integration

    dear friends i want to do set of operation in MATLAB but i have a problem: first of all, i want to take 3variable integration from f which is function of x,y,z,m,a but i want to integrate only over x,y,z after that for a special "a" forexample a=0.01 i want to solve the equation.i mean...
  27. W

    MATLAB Estimating the variance of eigenvalues of sample covariance matrices in Matlab

    I am trying to investigate the statistical variance of the eigenvalues of sample covariance matrices using Matlab. To clarify, each sample covariance matrix, \hat{\mathbb{R}}_{nn}, is constructed from a finite number, N, of vector snapshots, each sized (L_{vec} \times 1) (afflicted with random...
  28. matqkks

    MATLAB Matlab or computer algebra systems

    How does Matlab or computer algebra systems find derivatives of functions? Is it correct that they use matrix transformation?
  29. J

    MATLAB Calculating and Plotting the n-Point DFT of a Signal in MATLAB

    Hello I am trying to calculate the n-point DFT of a signal using fft where n=512 and plot it in matlab. The signal is a separate file that I have read into matlab. I am able read and plot the first 512 values of the signal but when I try to get the dft of the signal and plot it the outcome does...
  30. K

    MATLAB Matlab class array / other array

    Okay so what does this line of code mean: snleg = strtrim(cellstr(num2str(alf_deg.'))); I did some research and it is ultimately removing whitespace (comma's, spaces etc) from a file scanned in, but I don't understand the argument of the function. I don't understand what cellstr is or...
  31. E

    Error in defined expression for Fresnel equation in matlab ( please )?

    error in defined expression for Fresnel equation in MATLAB (urgent please )?? hi i have code for plotting Fresnel equation but there's something i didn't understand it and gives error >>((( plotopt - plotting option (type 'R' for plotting reflectivity, % 'A' for absorptivity or 'RA'...
  32. E

    MATLAB Summation x^2 0-3 w/o Built-in Matlab Fns: For Loop

    How can I do the summation of x^2 from 0 to 3 without the use of any built-in functions? I know a for loop is involved, but I can't get it to work.
  33. R

    MATLAB What is the error in running Newton's Method in Matlab for a specific function?

    I've been using this for a Newton Approximation in Matlab function x = Newton(f, fp, x, nmax, e) % f is an inline function which we apply Newton's method on % fp is an inline function that is the derivative of function f % x is the initial guess of the root % nmax is the total number...
  34. R

    MATLAB Implementing Bisection Method in Matlab: Troubleshooting Error Message

    Here is the code I have, but I keep getting the error message: Undefined function 'f' for input arguments of type 'double'. I don't know what I have that is causing this. Does anybody see what's wrong with my code? MaxIt = 1000; epsilon = 10^-5; a=1; b=2; c = (b+a)/2; NumIt = 0...
  35. S

    MATLAB How can I solve matrix problems in MATLAB using symbolic variables?

    i have 2 simple MATLAB questions first when i have two matrices the first one is empty and the second one conatins numbers i can Say A=B SO THE VALUE OF B BECOMES INSIDE A BUT MY QUESTION I JUST DEFINE SYMS EI and multiply it by B bUT When itry to put Put B in A IT DOENST WORK COULD...
  36. J

    MATLAB Help with MATLAB BVP4C: Solving Non-Newtonian Equations

    Hi all, (Don't mean to spam, meant to put this in General Math not General Engineering!) I'm running the following code in MATLAB: function M = nonNewtonian(~) M = bvpinit(linspace(0,10,301),@VKinit); sol = bvp4c(@VK,@VKbc,M); figure; hold all; plot(sol.x,sol.y(2,:))...
  37. E

    How to Correctly Plot Polynomial Functions in MATLAB?

    How do I plot something like (x-4)(x-5)(x-6)? I've tried: x = -6:0.01:6; y = (x-4)*(x-5)*(x-6); plot(x,y) It's giving me the error: Error using * Inner matrix dimensions must agree.
  38. R

    MATLAB Matlab: value non-zero but it should

    Hello everybody! I'm quite new with Matlab and I'm starting trying some stuff.. well I was trying to input det(a) where a=[1,2,3;4,5,6;7,8,9] and this should be zero. And I mean 0.0000 but the result is 6.6613e-16 why?O.o
  39. Z

    MATLAB Create function from a vector in matlab

    Hi everyone, Lets say i have created a column vector c = [ N x 1 ] and my time vector has the same dimensions. I want to create a function f(t) in which f(fstep) = c(cstep) where cstep is integer and fstep maybe not. ( for example f(0)=c(0), f(0.1)=c(1), ... f(10)=c(100)) As a result i...
  40. E

    MATLAB Where is my mistake in this MATLAB code?

    Hi, I am trying to plot the AN product sec II.C in the attached paper as: clear all clc s=0.5; w=0; d=5; f=0:20; NdB1=(17-30.*log10(f)); N1=10.^(NdB1./10); NdB2=40+20*(s-0.5)+26.*log10(f)-60.*log10(f+0.03); N2=10.^(NdB2./10); NdB3=50+7.5*w^0.5+20.*log10(f)-40.*log10(f+0.4)...
  41. L

    MATLAB Can the Asus EeePC X101CH handle Matlab?

    Hi, I'm thinking about getting this laptop, it's small and cheap. I hope it's good enough for doing student-level calculations in Matlab, perhaps some simple programming, surfing, writing documents in Word etc. Anyone tried Matlab on one of these? I currently have a laptop but I'm so used to...
  42. A

    MATLAB Matlab for loops involving matrix

    Given the following system of equations 3x1 + ax2 = 1 ax1 + 4x2 = 0 where -pi ≤ a ≤ pi. We would like to find out the range of values of x1 and x2 that are observed as a is varied. Do this as follows: 1. Create a for loop that uses the variable a as the indexing value, varied from over...
  43. J

    MATLAB Python equivalent of MATLAB textscan?

    Is there one? Or do I really have to write something like this: from numpy import * with open('file.txt','r') as f: #read only data, ignore headers lines = f.readlines()[31:] # convert strings to floats and put into arrays for i in xrange(len(lines)): s =...
  44. I

    Matlab Approximate the Integral Assignment

    Homework Statement Hey Everyone! So I have an assignment that says to approximate the integral f(x)=e^(3x), -1<x<3. Answer the following questions Run the code with N=10, N=100, and N=1000. For each approximation, when does the result agree with the exact value of the integral to 4 digits? How...
  45. J

    MATLAB How to simulate Op-Amp in MATLAB

    Good day. Could anyone tell me how to simulate an equivalent Operational Amplifier in Simulink? I read somewhere that I had to do it with 2 adders and a gain block, but I don't know how. Thanks.
  46. C

    MATLAB Differential equation for matlab

    THE PROBLEM : y(t) = e^(-t)*sin(t^2); with t0 = 0 and T = 3.14159. Find y_0, and use it to deduce the corresponding expression for f(t, y) (Your f should have both a t and a y in it. Simplify it to find the y!). This is for a MATLAB project. I've solved this differential equation (which we...
  47. R

    MatLab Integration Approximations for Given Function

    Homework Statement I need to answer the attached question, but we haven't done anything similar in class and the book isn't proving to be helpful for me. I'm not sure if I have to use matlab, we were given this code but I can't even understand what it is calculating. % f(x), the function...
  48. K

    Matlab: factorials without for loops or colon

    The Problem: Write a function that finds the factorial of a positive integer without using for or while loops, the factorial function, or the : range operator. Honestly, I don't really know how to start with this one. If I were able to use a for loop it would be easy, and I don't see how I...
  49. T

    MATLAB [Matlab] Plotting a function inside a m-file?

    A3.m: %x = 0:pi/100:2*pi; %y = sin(2*x); %z = 2*cos(2*x); %plot(x,y,'k',x,z,'--b') %title('Plot of f(x)=sin(x) and it''s derivative') %xlabel('X-axis') %ylabel('Y-axis') %legend('sin(2x)','2cos(2x)') x = -2:0.01:2 y = f2(x) plot(x,y) f2.m: function F = f2(x) F(1) =...
  50. A

    MATLAB Gauss-Seidel iterval method using Matlab

    Hello. I am new in matlab. And I wonder how to solve equations using gauss-seidel iteration method. Theoreticaly I understand how this method is working, but can't get how write script in matlab. It can be great if somebody can give a explanation for this problem.
Back
Top