Matlab Definition and 1000 Threads

  1. 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...
  2. 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...
  3. 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'...
  4. 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.
  5. 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...
  6. 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...
  7. J

    MATLAB Solving System of Equations w/MATLAB Shooting Method

    Hi all, I'm looking to solve the following system of equations with boundary conditions using the shooting method in MATLAB: F''=F^2-G^2+F'H G''=2FG+G'H H'=-2F along with the conditions F(0)=0, G(0)=1, H(0)=0, F(infinity)=0, G(infinity)=0. I've found the solution using the...
  8. 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...
  9. 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,:))...
  10. 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.
  11. 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
  12. 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...
  13. 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)...
  14. 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...
  15. 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...
  16. 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 =...
  17. S

    Matlab: creating a table of equations using multiple variables

    Homework Statement I have an equation that looks like func=sin(pi*x*n)*sin(pi*y*m) I was wondering if there was any method (possibly involving for loops) where I could get a plottable function along xy for all the different combinations of n and m i.e. m= 1 n =1 so the function would be...
  18. S

    Matlab Question: How to assign a new name to an amended matrix

    I have to replace some matrix columns with some vectors. I am currently copying the original matrix and replacing the column of the matrix I have copied eg: matrix_1 = matrix_2 matrix_2(:,4) = vector_1 This works fine, but I was wondering if it was possible to maybe amend the original matrix...
  19. 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...
  20. 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.
  21. D

    MATLAB How to Implement Newton-Raphsons Method in Matlab?

    My objective is to create an applicator for the Matlab Newton-Raphsons method using only a function handle, the initial value and the number of iterations desired. I'm extremely new to Matlab and programming so bare with me for being programming deficient. My question is when making a loop, how...
  22. 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...
  23. R

    Matlab ode solve takes too big steps?

    Homework Statement I have a set of differential equations, which need to be solved by matlabs solvers. all of the states have to stay between 0 and 1, but they don't. I'm 100% sure my equations are right, but MATLAB is taking too big steps, causing the state to go negative or above 1. most...
  24. 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...
  25. 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...
  26. 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) =...
  27. 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.
  28. L

    MATLAB Producing arrays to plot (MATLAB)

    Hi everyone, my code is a little rusty and a work in progress but I was wondering how I would go about producing arrays for the calculations performed in the while loop for the analyses so they can be plotted. I have the following parameter input; G0 = 50; v = 0.25...
  29. X

    How to Simulate and Plot a Transfer Function in MATLAB?

    Homework Statement Consider the system defined by Y(s) = H(s)X(s) with H(s) = K \frac{s-a}{(s-b)(s-c)}. Build a function in MATLAB to simulate this system for given values of a,b,c,K and various input signals x(t) (in the time or in s-domain). Include a function to display plots of the time...
  30. M

    MATLAB How Can Lifting Line Theory Be Applied in MATLAB for Aircraft Wing Design?

    Hi guys, I am studying aerospace engineering doing my final year. I am doing my final year project which is called "Development of Aircraft Wing Design Tool using MATLAB". It is basically to create a basic tool which will help a designer to design wings. I am totally confused on how to go...
  31. L

    Efficient Newton's Method in MATLAB for Solving Catenary Constants

    I'm tasked currently with creating a MATLAB function to run Newton's method. From there I need to use this function to solve for the constants of a catenary which pass through (+-50, 100). I used wolfram alpha to find the proper constant as 107.432 so I would know if I was on the right track or...
  32. D

    MATLAB Using Matlab to plot a phase potrait for ODEs

    First create the function file and name it whatever you would like. I prefer phase-portrait. % Phase Plot Program % To use this function, do the following: % >> phase_portrait(x1, x2, y1, y2, tfinal, 'F', N); for example, % >> phase_portrait(-5, 5, -5, 5, 10, 'F', 5)function [] =...
  33. E

    How i can plot anti periodic sine wave in matlab ?

    i don't know how i can use MATLAB to plot anti periodic fun .. the origin site give this code for triangular fun: fs = 10000; t = -1:1/fs:1; x1 = tripuls(t,20e-3); plot(t,x1), xlabel('Time (sec)');ylabel('Amplitude'); title('Triangular Aperiodic Pulse') but when i use this for sine...
  34. C

    Plotting Multiple Equations on One Graph in MATLAB?

    Homework Statement Does anyone know how to do this? Let's say I had the equation: f(t) = |2t, 0≤ t < 2 |(t^2)-3, 2≤t how would you plot this over 0≤ t ≤4 in Matlab? Homework Equations - The Attempt at a Solution I've tried ezplot but i can't manage getting both...
  35. C

    Plotting Fourier Functions in Matlab - Help?

    Plotting Laplace Functions in Matlab - Help? SORRY I MEANT LAPLACE FUNCTIONS Homework Statement so we have a function f(t) = |2t, 0≤ t < 2 |(t^2)-3, 2≤t how would you plot this over 0≤ t ≤4 in Matlab? Homework Equations - The Attempt at a Solution I guess you could...
  36. R

    MATLAB Nation of Tool Users? ( ex. Matlab)

    Sometimes I get the impression that employers want a. Experience in a particular software tool AND b. Specialization and this trumps everything else other than work experience. It wasn't unsual for people with no formal educational background in Computer Science to land programming jobs...
  37. L

    Lighter matlab descrete convolution software

    A while back I tended a course in transform methods. During the course we were handed a MAtlab program that could be used to simulate convotution called Discrete Convolution Demo. It's kind of big or you might say bloated and I'd like some lightweight version or something. If someone know some...
  38. G

    Question about square brackets and parentheses in MATLAB.

    I'm trying to figure out what these do in certain implementations. I can't seem to find the answer in the documentation. http://www.mathworks.com/matlabcentral/fileexchange/30580-binary-amplitude-shift-keying[1] for ii = 1:1:length(bit_stream) ASK_signal = [ASK_signal...
  39. P

    MATLAB Download MATLAB for Free - Before Uni Starts

    How can I download MATLAB for free? Uni starts soon and I want to get the program before that. Can you help me please? Thanks :)
  40. T

    MATLAB How can I isolate a segment of ECG data in MATLAB?

    I have inputed the following, I was given a signal and told to plot it in a time domain. The signal ECG is a data file and imported. N = 15000; fs = 250; t = linspace(0, 60, N); %signal = ecg data = ecg subplot (2,1,1); plot (t,ecg); title ('Time-Domain ECG') xlabel ('Time (s)') ylabel...
  41. H

    MATLAB Matlab: Butterworth Filter Bode Plot

    I'm stuck on a really simple problem because I haven't done MATLAB in a while. I have transfer functions for nth order lowpass Butterworth Filters: H(jw) = 1/(s + w_c)^n I want to plot the 1st to 5th order filters. How do I input H(jw) into matlab? The tf(num, den) is not efficient in that...
  42. J

    How Do I Correctly Plot an Electric Field Around a Base Station Using MATLAB?

    Homework Statement I need to plot an electric field in some range around base station, for example in range of 200m. EIRP=57,5dBm G=1 for the first example N=4 Homework Equations E=[2*sqrt(30*N*P*G)]/r P=10exp[(EIRP-30)/10] EIRP=57,5dBm G=1 for the first example N=4 The...
  43. S

    MATLAB MATLAB num2str: Preserving Valid Digits

    Dear Users, the topic MATLAB num2str is closed, therefore I am posting this as a reply to that thread. The suggestion by marcusl won't work for numbers of various format, but same number of valid digits. Example: The numbers 0.0056 0.0060 0.043 0.050 0.32 0.40 are valid to their...
  44. P

    Convolving a signal with its impulse response in MATLAB

    Homework Statement We're supposed to convolve the signal x[k] = u[k] - u[k-8] with its impulse response h[k] = sin(pi*k/4)*( u[k] - u[k-8] ) with the help of MATLAB. Homework Equations - The Attempt at a Solution The thing is that we don't know how to do this in MATLAB...
  45. N

    MATLAB Importing Data in MATLAB: Plotting Time vs. Third Column

    Hi. Suppose I load data from a .csv file: Blah @Blah 2Blah Blah f Blah fa Blah Blahasd Blahasda vasf Blah as Blah asdas Blah Date Time Ch1: 07/25/2012 42:46.0 96.385 07/25/2012 42:46.0 -177.608 07/25/2012 42:46.0 155.481 07/25/2012 42:46.0 64.15 an attempt would be to...
  46. C

    MATLAB Creating a MATLAB Function File Without Mod/Rem

    I need to create a MATLAB function file that will accept a modulo values (from 3 to 9; that is Z3 to Z9) and will output the least possible value describe by the modulo conditions I don't know how to start it because I am not allowed to use the mod() and rem(). Please give me an idea how to do...
  47. M

    MATLAB Matlab code natural numbers subset

    I have array of natural numbers from 1 to n. They are divided into m groups, where m*(m-1)=n. I need all m-1 elements from first group, last m-2 elements from second group, last m-3 elements from third group...zero elements from last group. For example 5*4=20: 1,2,3,4; 5,6,7,8...
  48. M

    MATLAB Spliting a line segment into desired length segments (Matlab)

    Hi Guys, I don't know if I make sense but please try to help me. I am working in Matlab. I have multiple line segments of different lengths with end point coordinates. I want to split each major segment into multiple minor segments in a way that all segments will have same length...
  49. I

    Please help my for loop goes on forever (Matlab) :/

    Homework Statement Question: A ball is launched from a height of 12m. It should land in a pool that has a length of 22m and is 9m away from the wall. Find the minimum and maximum initial velocities for the ball to land in the pool. The ramp is angled at 1 radian such that vy = 0.54v and vx =...
  50. D

    MATLAB Matlab Difference Equation Loop?

    Trying to make a three line loop that would differentiate x2√4x+1 to the nth term starting from the original function (n=0) to the 5th derivative (n=5) and then substitute 2 into the derivatives. Here's what I got f = @(x) x2√4x+1 For n=[0:5] - As the nth term goes from 0 to 5...
Back
Top