Matlab code Definition and 142 Threads

  1. Z

    MATLAB Need help to solve of Matlab code

    When a resistor (R), capacitor (C) and battery (V) are connected in series, a charge Q builds up on the capacitor according to the formula Q(t) = CV(1 − e−t/RC) if there is no charge on the capacitor at time t =0. The problem is to monitor the charge on the capacitor every 0.1 seconds in...
  2. K

    Matlab code for solving complex numbers

    Hi All, I have been trying to solve a complex number equation for character impedance with MATLAB but it continues to tell me that "indexing must appear last on index addressing". I am new to MATLAB so I think that my code is wrong. What I am using is complex sqrt (R+jwL)(G+jwC)...
  3. M

    MATLAB Making MATLAB Code Efficient: A 2xN Vector

    Hi everyone, I'm trying to make my MATLAB code run as efficiently as possible. II have a 2xN vector designated like so: acc1(1,:) = A*rc(1,:); acc1(2,:) = B*rc(2,:); where A and B are scalars,. Is it possible to combine these two into a single line of code? Cheers
  4. C

    MATLAB Transfer fourier series into matlab code.

    Hey guys, i need to transfer Fourier series equation into MATLAB code. Anyone can help me in transfering?
  5. B

    Matlab Code Help - Gaussian Function

    -------------------------------------------------------------------------------- Hello, I am new to this forum so please kindly let me know if my question needs to be posted in another area. I am trying to write a MATLAB code to show a chirped Gaussian function and I am having some...
  6. B

    Matlab code help - Gaussian Function

    Hello, I am new to this forum so please kindly let me know if my question needs to be posted in another area. I am trying to write a MATLAB code to show a chirped Gaussian function and I am having some trouble with it. I am trying to obtain a chirped Gaussian pulse by modulating a chirped...
  7. N

    MATLAB code to Geometric Random Variable

    Homework Statement Generate Geometric RV with Porbabilty of succcess 0.1 using only rand() Homework Equations rand() geometric rv P=(1-p)^(k-1) * p where p=0.1, k is number of trial in which we get 1st success The Attempt at a Solution rand(n)
  8. N

    MATLAB code to Generate Uniform Random Variable

    Homework Statement Generate 1,00,000 triplets(sets of three) of Uniform random variables on [0,1]. Y be max of each triple and Z be min of each triple. Derive the densities for these RV from theory and compare histograms of Y and Z with densities found in theory. Homework Equations...
  9. N

    MATLAB code to Generate Raleigh Random Variable

    What is the Matlab code for generating 100,000 Raleigh Random Variable with sigma^2=2 using rand command only. Generate histogram and normalize it by dividing 1,00,000 times the bin width
  10. L

    Matlab Code Help for x[n]=x(n2Ts)

    Homework Statement x(t)=4sin(0.5t).3u(t) x[n]=x(n2Ts) The 1st equation, x(t)=4sin(0.5t).2u(t) Code : >> A=2; >> wo=0.5; >> t=5:0.25:50; >> x=A*sin(wo*t).3*(t>=0); >> plot(t,x), grid on >> xlabel('t (s)'); ylabel('Amplitude(unit)') But the second one,x[n]=x(n2Ts), I don't know...
  11. A

    MATLAB Help Needed: MATLAB Code for Semiconductor Laser Rate Equation

    Can anyone help me by giving MATLAB code to simulate semiconductor laser rate equation by finite difference methord. i wrote a code but that was not working. so i need it badly. please help me.
  12. M

    Is My MATLAB Code for Heat Transfer Correct?

    Hi so i have a heat transfer project to determine the material (aka the thermal conductivity) and length of a 2d wall. It has to have between -1 and 1 net rate of heat loss from the southern side and above 145 rate of heat transfer from the eastern side. The wall is 20 cm high na the boundry...
  13. MathematicalPhysicist

    MATLAB Why Is My MATLAB Code Not Working?

    Hi I tried to run this code, but to aveil (both in MATLAB and in mathematica). In the attachment there's a printscreen of the code and the errors, can someone help me with this? Thanks.
  14. A

    ADSL MATLAB Code: DMT Simulation with RS Encoder

    Homework Statement Well I was just practicing MATLAB by going through different MATLAB codes available online:smile:.I found this DMT simulation.Here is the link http://cnx.org/content/m11721/latest/ Now I decided to add another block in this implementation - The RS encoder(coz...
  15. M

    Matlab code but i'm having problems puting in a loop

    Hi. i have seen similar questions on here but can't quite get them to apply to my problem i have wrote some MATLAB code but I'm having problems puting in a loop heres my code ----------------------------------------------------------------------------------------- clear clc for...
  16. C

    MATLAB Prob with MATLAB code (Planetary motion)

    Hi, I am writing a code for planetary motion using ODE with runge-kutta. Currently it has only two body, however, I could not get the initial values to fit in properly, the bodies will not move in circular orbital motion. They are moving towards each other. at the v=[10 0;-10 0]...
  17. J

    MATLAB MATLAB code (calculating displacement)

    Hey guys, I need help. Say i take a picture of a dot in a frame followed by another picture whereby the dot has moved to another spot in the frame. How do I calculate the distance between these 2 dots? At the end, i would have 2 jpeg images of the dot at 2 different locations. What I'm trying...
  18. R

    MATLAB Transforming a matlab code

    Hi fellows! I need a bit of help with transforming a MATLAB code that simulate magnetic field of two concentric solenoid TO a plot that simulate the magnetic fields of high voltage transmission lines (specificly two and four lines), how can it be modified? here is the code: % GKLmagnet2.m...
  19. M

    MATLAB We need a matlab code for a normalized gradient eq. help

    We need a MATLAB code for a normalized gradient eq. help! :) Hello, we need help in converting this normalized gradient equation into a MATLAB code. Please see the image. Thanks! :) http://img706.imageshack.us/img706/7998/thesisformula.jpg
  20. S

    MATLAB Trying to speed up some MATLAB code

    Hi guys, I've got some MATLAB code that calculates the forward kinematics for a robotic arm. This calculation relies on the successive multiplication of a series of 4x4 matrices, and currently I have this coded (more or less) as: ... T(:,:, 1) = T0; for i = 2:njoints T(:,:, i+1) =...
  21. A

    MATLAB Help! MATLAB Code for Rutherford Scattering Won't Run

    What's wrong with this MATLAB code for Rutherford scattering, it won't run for me! :( Hi, I can't do matlab...and have to plot the trajectory of alpha particles in rutherford scattering. I've made an attempt, but i know I've gone wrong somewhere. Could someone tell me how to fix it? I'd be...
  22. C

    MATLAB How Can I Resolve Loop Stuck Issues in MATLAB's Shooting Method?

    Hi, I am trying to use the shooting method to determine the angle of a projectile. However for some values of distance and initial velocity my value for angles get stuck between two values. I want to put a piece of code into my shooting method which can either detect that my while loop has...
  23. C

    MATLAB Matlab Code Help: Read Sparse Matrix, Calculate Eigenvalues

    Hello. Can anyone help me in producing a Matlab code that will read a sparse matrix and then calculate the eigenvalues of it, show the sparsity pattern of it etc. I have the the sparse matrix data in compressed sparse row (CSR), compressed sparse column (CSC) formats and also in Co-ordinate...
  24. T

    MATLAB Matlab code for plotting magnetic scalar potential of a sextupole

    First let me introduce myself. I'm and electronics engineer with 10 years of experience in the instrumentation of particle beams. I left the field for 10 years and have been fortunate to be granted a second lease of life on particle accelerators. Slowly over time the job has come to involve more...
  25. A

    MATLAB Matlab code for extracting random subwindows/subimages

    hi, I am doing project related to object recognition using decision trees and random subwindows.For which i nee d MATLAB code for extracting random subwindows/subimages(size is 16x16) from the image files and after that i need to get the gray values of the subimages.
  26. C

    Does Anyone Have MATLAB Code for Multistage SIC in CDMA?

    Hiiii I am doing research on multiuser CDMA; I have simulated MUD's in both AWGN and Rayleigh fading channel. I need help in Multistage Successive interference Cancellation. Kindly if anyone have the m code for this, please share. For others, I can get you papers from most of the...
  27. L

    MATLAB How can I attach MATLAB code in LaTeX without it looking like a report?

    Hello! Im writing a technical report with "article" as documentclass in Latex. I want to attach my MATLAB code in the appendix. If I copy and paste the text it won't look like the MATLAB code but it will look like a report.. What command should I use so the text just looks like it is ...
  28. E

    MATLAB Efficient MATLAB Code for Recursive Functions: Expert Tips and Tricks

    Hello, I have the following equation, and I want to program it using MATLAB. But it is a recursive function, and it seems that I can not handle it well. So please if anyone can help, I will be thankful.
  29. P

    MATLAB Matlab code guide me ZZZZZZZZZZ

    Hi i Would like to solve the the following eqn using Matlab Since I am new to Matlab, I would request u to help me in this regard (∂^2 T)/〖∂r〗^2 + 1/r (∂T )/∂r+(∂^2 T)/〖∂z〗^2 = 1/α (∂T )/∂t+τ/α (∂^2 T)/〖∂t〗^2 - { (1+δ(t) )-(1+δ(t-tp) }*IoKa/k 〖exp( - 2r/σ^2 〗_^2)exp(-zka) where δ(t) =76ns...
  30. P

    MATLAB Solve Thermal Equation Using Matlab: Guide for Beginners

    Hi i Would like to solve the the following eqn using Matlab Since I am new to Matlab, I would request u to help me in this regard (∂^2 T)/〖∂r〗^2 + 1/r (∂T )/∂r+(∂^2 T)/〖∂z〗^2 = 1/α (∂T )/∂t+τ/α (∂^2 T)/〖∂t〗^2 - { (1+δ(t) )-(1+δ(t-tp) }*IoKa/k 〖exp( - 2r/σ^2 〗_^2)exp(-zka) where δ(t) =76ns...
  31. P

    MATLAB Solve Thermal Equation using Matlab Code - Help Needed | Hello PDE

    Hi i Would like to solve the the following eqn using Matlab Since I am new to Matlab, I would request u to help me in this regard (∂^2 T)/〖∂r〗^2 + 1/r (∂T )/∂r+(∂^2 T)/〖∂z〗^2 = 1/α (∂T )/∂t+τ/α (∂^2 T)/〖∂t〗^2 - { (1+δ(t) )-(1+δ(t-tp) }*IoKa/k 〖exp( - 2r/σ^2 〗_^2)exp(-zka) where δ(t) =76ns...
  32. D

    How to Adjust MATLAB Code to Correctly Draw a Diamond with Even Sizes?

    i need to build a code which asks the user for the size of the desired diamond and then draws it, i can get this to workl perfectly by using the fprintf command and building the diamond out of 4 parts,: see code- clc clear h=input('enter height of diamond :'); y=1; while y<=h/2 for...
  33. T

    MATLAB Efficient Summation in MATLAB for Biphasic Model: Varying n from 0-3 to 0-100

    i need to write this into MATLAB http://www.engin.umich.edu/class/bme456/ch10fitbiphasic/biphasfit19.gif which i have done here: uj = (-sig/Ha)*(xj-(((2*h)/(pi^2))*((((-1)^n)/((n+1/2)^(1/2)))*sin((n+1/2)*((pi*xj)/h))*exp(((-Ha*ko)/(h^2))*((n+1/2)^2)*(pi^2)*t)))); how do i vary n...
  34. C

    MATLAB Matlab Code for Matrix Multiplication

    Hihi, Let's say I have the linear equations ,A 2x +3y +4z 5x+6y-7z 5x-4y+3z then I can always write as a matrix multiplication A= B*x matrix B = 2 3 4 5 6 -7 5 -4 3 times matrix x x y z Then., how can I tell MATLAB to express in the matrix multiplication form so...
  35. D

    MATLAB Need help with some matlab code - engineering project

    This is some Matlab code that my group has been working on. None of us really code all that much, and have only had one year of Comp Sci. It doesn't help that this is all our our first times using Matlab, either. :/ The problem is calculating a value for a and aPrime. We're trying to use...
  36. M

    MATLAB Matlab code to calculate minimum distance

    hey guys, i want to wirte a function which takes as its arguments two lists of co-ordinates (the first is a list of customers and the second for possible switch locations), and determines the index of the best switch location to minimise the amount of cable required. I have done the...
  37. U

    MATLAB Matlab code looking good? EE_Signals

    Homework Statement Graph of x(t) = 9e^-2t for t>=0 and y(t) = 4e^(-9*pi*t). Is my MATLAB code correct? I did it by hand and I'm getting a different answer, so I don't know which one is the correct one... if my hand one is correctly done or if the MATLAB one is correct. I'm learning MATLAB on...
  38. U

    MATLAB Matlab Code for Convolution is this right?

    Homework Statement A DT system has the unit response h[n] = (0.2(1.3)^n)u[n]. You then input x[n] = sin(n*pi/2)u[n]. Find the convolution. Homework Equations None. The Attempt at a Solution >> n = 0:30; >> h = 0.2*(1.3).^n; >> x = sin(n*pi/2); >> s = conv(h,x); I left out u[n] because we...
  39. S

    MATLAB Matlab code for transient 2 D thermal problem

    hi i want MATLAB coding for transient 2D Thermal problem pls help
  40. ranger

    MATLAB Whats wrong with this matlab code?

    I have a very simply MATLAB code. When I try go run it, I get no graph and switching over to the MATLAB command line, I see: ans = char Here is the code: t = linspace(0,60); v = 3.22; for q_0 = [0:1:2007]; q = q_0*exp(v*t); plot(t,q) hold on end It looks just...
  41. J

    MATLAB Get MATLAB Help - Free Assistance from Experts

    MATLAB code help please... Hi, My name is Jennifer.Iam new to Matlab programming.Iam working on reducing the noise content in audio communication.Iam using Hamning codes for the same.I have a sample code with me,which iam uploading in a zip file.Iam unable to understand how it works.Can...
  42. M

    MATLAB Optimization: Wots wrong with my MATLAB CODE

    Optimization: I am going insane here :cry: :cry: I've really run out of ideas... please help me.! %golden.m function [f,a]=golden(func,p,tol) func='dfunc'; p=[0 1] g=0.38; a=p(1); b=p(2); r=b-a tol=0.01; iter=0 while r>tol x=[a+g*r b-g*r] y=feval(func,x) if...
Back
Top