Matlab code Definition and 129 Threads
-
MATLAB Problem with Runge-Kutta script file
Hello : trying to run mutiple script files on matlab (matlab basic online) but it is giving an error message the files are about runge - kutta method and applying them on a ODEs the 1 script file Lornz : function dy = Lornz(t,y,sigma,beta,rho) % y is the 3 dimentional state vector % y(1)...- hagopbul
- Thread
- Matlab Matlab code Runge kutta
- Replies: 4
- Forum: MATLAB, Maple, Mathematica, LaTeX
-
D
How can MCNP code be used to calculate photoneutron doses in radiotherapy?
I worked monte carlo simulation for dose calculations in field radiotherapy (external and brachytherapy) using EGSnrc and MCNP codes.- Drayham
- Thread
- Matlab code Mcnp
- Replies: 1
- Forum: New Member Introductions
-
D
Resultant pedal force (FRESULTANT) Force tangential to the crank arm
%% part 1 clear all; close all; clc; torq_crPK = zeros(10,1); ang_tqPK = zeros(10,1); ang_powPK = zeros(10,1); torq_crDS = zeros(10,1); torq_crUS = zeros(10,1); WD = zeros(10,1); WDpos = zeros(10,1); WDneg = zeros(10,1);%% INPUT VARIABLES for i=1:10 % cyclist number % read in the...- david03
- Thread
- Arm Crank Force Matlab code Matlab programming Pedal Resultant Resultant force
- Replies: 1
- Forum: Introductory Physics Homework Help
-
P
MATLAB Using 2 MATLAB files to simulate 3 plots
First of all, I'm an absolute beginner in MATLAB. Secondly, I have 2 MATLAB files, one entitled as a "main file" and the other one as a helping .m file, which is called by the main file. I need to run the main file in order to obtain 3 plots. What is the exact procedure that I should follow in...- PhysicsTruth
- Thread
- files Matlab Matlab code Plots
- Replies: 1
- Forum: MATLAB, Maple, Mathematica, LaTeX
-
MATLAB Graphene band structure Matlab code
I have this code for 3D band structure of graphene but i can't understand why while graphene first brillouin zone is hexagonal but here a rectangle form of first brillouin zone is used?E0 = 0; % coloumb integral V = -2.7; % hopping integral [eV] acc = 1.41; % c-c bond length [Angstrom] lattice =...- Mohammad-gl
- Thread
- Band Band structure Code Graphene Matlab Matlab code Structure
- Replies: 1
- Forum: MATLAB, Maple, Mathematica, LaTeX
-
F
Write MATLAB code to find Y bus for any bus system
Here's my work: clc; clear all; % Ybus by step by step method for an any bus system % | From | To | R | X | gsh | B | T|ysh % | Bus | Bus | pu | pu | pu | pu | ph-sh linedata = [1 2 0 -5 0...- Fatima Hasan
- Thread
- Bus Code Matlab Matlab code System
- Replies: 1
- Forum: Engineering and Comp Sci Homework Help
-
J
MATLAB Writing a matlab program to solve the Kepler Problem (Universal Vars)
Introduction: I am writing a Matlab program that solves the Kepler problem for any Elliptical, Hyperbolic, or Circular orbit. Given an initial position vector, velocity vector, find the position vector and velocity vector after some given time. I am not doing this for any class, I have been...- Julez55
- Thread
- Kepler Matlab Matlab code Program Writing
- Replies: 1
- Forum: MATLAB, Maple, Mathematica, LaTeX
-
F
Solve a nonlinear equation using fixed-point iteration in MATLAB
My attempt is attached below. When I tried to solve it , nothing comes up. However, there are no errors !- Fatima Hasan
- Thread
- Fixed point iteration Matlab Matlab code Nonlinear
- Replies: 3
- Forum: Engineering and Comp Sci Homework Help
-
N
How to judge the singularity of a matrix in numerical method?
Summary: different methods give different results. They are not consistent. Summary: different methods give different results. They are not consistent. I use two different methods to detect whether a matrix is singular. The result of calculating the determinant of a 9-order square matrix is...- nenyan
- Thread
- Judge Matlab code Matrix Matrix algebra Method Numerical Numerical algorithms Numerical method Singularity
- Replies: 8
- Forum: MATLAB, Maple, Mathematica, LaTeX
-
How Do You Find the Diameter of a Wire Using Voltage and Length?
Mentor node: Added code tags From=menu('select:','c', 'g', 'a', 's:'); This is part of my code and I'm not coming up with anything close l=input('input wire length') %current copper=12.5572...- Leanne
- Thread
- Diameter Matlab Matlab code Wire
- Replies: 26
- Forum: Introductory Physics Homework Help
-
H
MATLAB My Crank-Nicolson code for my diffusion equation isn't working
I'm trying to solve the diffusion equation in spherical co-ordinates with spherical symmetry. I have included the PDE in question and the scheme I'm using and although it works, it diverges which I don't understand as Crank-Nicholson should be unconditionally stable for the diffusion. The code...- hunt_mat
- Thread
- Code Diffusion Diffusion equation Matlab code Spherical
- Replies: 41
- Forum: MATLAB, Maple, Mathematica, LaTeX
-
MATLAB MATLAB Code For Analyzing Experimental Data
Hi! I'm working on MATLAB code to analyze dat for a specific project, but I'm curious if it could made useful for more general purposes. Here's a bit of background on the project: I'm an REU student and I was assigned to analyze data for a recently conducted experiment. The experiment took...- person123
- Thread
- Code Data Experimental Experimental data Matlab Matlab code
- Replies: 12
- Forum: MATLAB, Maple, Mathematica, LaTeX
-
Java Why is this Java code not working?
Hello all: I am reading a comutacomputa physics book and trying a code from it in MATLAB it is not working and due to my lack of knowledge in this field I can't see where is the mistake hope you can take a look import java.lang .*; public class Motion { static final int n = 100000, j =...- hagopbul
- Thread
- Code Java Matlab Matlab code
- Replies: 7
- Forum: Programming and Computer Science
-
D
1D Angular Motion with different velocity stages
Homework Statement I am solving a kinematic problem, where I have a link that is attached to a rotational joint. I need to find the position of the joint for t=0..8, and I need to do it for every 0.01s. The problem comes from the fact that I have three stages for the velocity, during t = 0..0.1...- Darkbound
- Thread
- 1d Angular Angular motion Constant acceleration Matlab code Motion One dimensional motion Velocity
- Replies: 3
- Forum: Introductory Physics Homework Help
-
MATLAB Code: Stationary Schrodinger EQ, E Spec, Eigenvalues
Hello everyone, For weeks I have been struggling with this quantum mechanics homework involving writing a code to determine the energy spectrum and eigenvalues for the stationary Schrodinger equation for the harmonic oscillator. I can't find any resources anywhere. If anyone could help me get...- Baynie
- Thread
- Code Eigenvalues Harmonic oscillator Matlab Matlab code Schrödinger Schrodinger equation
- Replies: 1
- Forum: Advanced Physics Homework Help
-
D
How to use the window functions on a signal in MATLAB?
Homework Statement I am suppose to write a program that compares the FFT (Fast Fourier Transform Diagrams) of a sampled signal without the use of a window function and with it. The window function should be as long as the signal and the signal should have N points, N chosen as to not cause...- diredragon
- Thread
- Fft Fourier transform Functions Matlab Matlab code Signal Signal processing Window
- Replies: 2
- Forum: Engineering and Comp Sci Homework Help
-
R
Plotting Free Body Diagram for Scalar Triple Product in MATLAB
Homework Statement [/B] The scalar triple product computes the magnitude of the moment of a force vector about a specified line. It is M = ( r×F ) ⋅n , where is the position vector from the line to the point of application of the force and is a unit vector in the direction of the line. Prompt...- raviyank
- Thread
- Matlab Matlab code Product
- Replies: 2
- Forum: Engineering and Comp Sci Homework Help
-
Finding the bandwidth of a parallel RLC circuit (+MATLAB)
Homework Statement The attempt at a solution Constructing the total impedance of the circuit as follows, $$\frac{1}{Z_T}=\frac{1}{Z_R}+\frac{1}{Z_C}+\frac{1}{Z_L}$$ where $Z_R=R$, $Z_C=-j\frac{1}{\omega C}$ and $Z_L=j\omega L$. $$\frac{1}{Z_T}=\frac{1}{R}+j\omega C+\frac{1}{j\omega L}$$...- ItsTheSebbe
- Thread
- Bandwidth Circuit Matlab Matlab code Parallel Rlc Rlc circuit
- Replies: 1
- Forum: Engineering and Comp Sci Homework Help
-
R
MATLAB Finite element skeleton code for matlab
Hello, Does anyone know if a finite element skeleton source code exists. Finite element can be used for structural memebers, gas dynamics, etc. But the over all stepping software is the same and then just input the core equations. My application is for pseudo one dimensional compressible...- rppearso
- Thread
- Cfd Code Element Fea Finite finite element Matlab Matlab code
- Replies: 3
- Forum: MATLAB, Maple, Mathematica, LaTeX
-
T
MATLAB Convert R Code to MATLAB for Detrended Cross Correlation Analysis
Homework Statement I would like to convert this R code into matlab. This code perform a calculation of beta coefficient based on Detrended cross correlation analysis. Homework Equations require(tseries) require(fracdiff) require(matrixStats)DCCA_beta_avg<-function(y,x,smin,smax,step){...- Tilfani
- Thread
- Code Convert Matlab Matlab code
- Replies: 9
- Forum: MATLAB, Maple, Mathematica, LaTeX
-
A
Calculating Transfer Function of a Curve: A Beginner's Guide
How can i calculate transfer function of curve? for example from time response of a curve. or transfer function of ferquency response .- Alba19
- Thread
- Curve Function Matlab code Transfer function
- Replies: 3
- Forum: Electrical Engineering
-
D
Problem with plotting a function in MATLAB
Homework Statement Write code for solving the integral ##\int_{0}^{x}e^{-t^2}dx## using simpsons method and then plot the function from ##x = 0## to ##x = 5## with ##0.1## increment. Homework Equations 3. The Attempt at a Solution [/B] I was told that the best way to plot the function is to...- diredragon
- Thread
- Function Integals Matlab Matlab code Plot Plotting
- Replies: 10
- Forum: Engineering and Comp Sci Homework Help
-
MATLAB How can I run Python by getting values from Matlab
I have a python script for which the input data are coming from Matlab. I have tried to use pymatlab, but it is failing. Can anyone suggest any other method?- Nikhil N
- Thread
- Matlab Matlab code Python
- Replies: 3
- Forum: MATLAB, Maple, Mathematica, LaTeX
-
MatLab Code for Baseball Not Working
Homework Statement I am trying to create this plot in MatLab I'm starting out doing the simplest one, no drag, no wind. simple kinematics, right? but I can not get my code to run. Homework Equations Kinematic Equations The Attempt at a Solution close all clear all clc %%defining variables...- grandpa2390
- Thread
- Baseball Code Matlab Matlab code
- Replies: 27
- Forum: Introductory Physics Homework Help
-
Why Won't My Matlab Code Work?
Homework Statement I need to write a program in Matlab that accomplishes this graph: I keep getting an error on Line31 Column 161 about unexpected parenthesis. They look balanced to me. If I take one away from either side, I get an error that I am short a parenthesis. I also need to change...- grandpa2390
- Thread
- Code Matlab Matlab code Work
- Replies: 12
- Forum: Introductory Physics Homework Help
-
P
MATLAB Help with MATLAB music code | Signals & Systems
For my signals and system class were creating music. I am given a structure with three variables, frequency/notes, duration, and pulse. ex: frequency(in note numbers which i then convert to frequencies)[44 45 47 50...]. duration[2 1 1 3 4...] with pulse duration being .25s and pulse[1 3 4 5 8...- physics4353
- Thread
- Code Matlab Matlab code
- Replies: 4
- Forum: MATLAB, Maple, Mathematica, LaTeX
-
C
MATLAB function within function handle output
Homework Statement MATLAB The funciton "rockdynamicstage" outputs a matrix 4 by x, where x is somthing around 300( varies). The funciton "rockdynamicstage" is within the funciton handle "sim" with an input of gama0. (PayMass,Masstages,Massfrac,Thstage,IspStage,ChangeTstage) ar parameters that...- Carter
- Thread
- Function Matlab Matlab code Matlab programming Output
- Replies: 13
- Forum: Engineering and Comp Sci Homework Help
-
MATLAB MATLab: Not enough inputs for nlinfit
Hello! I'm trying to plot a best fit for some generated EQ data and I'm having issues with nlinfit. My code is as follows and when I try to run it, I get an error referring to the anonymous function ("test"), nlinfit (from Matlab), and not having enough input arguments. %Test function t =...- TaylorLL
- Thread
- Matlab Matlab code
- Replies: 9
- Forum: MATLAB, Maple, Mathematica, LaTeX
-
D
MATLAB Matlab code for a Gillespie type reaction (model) with wolves and elk.
Copy and paste if you want to use any of this code. Its a simple iteration of converting biomass of elk into new wolves. % example for ODE and Gillespie % one reversible reaction b1 = .033; bo = .00047; a1 = .0022; ao = .00055; Aini = 5168; Bini = 34; %% Basic ODE simulation dt = 0.01...- DrWahoo
- Thread
- Code Matlab Matlab code Model Reaction Type
- Replies: 3
- Forum: MATLAB, Maple, Mathematica, LaTeX
-
MATLAB Fixing a Matlab Code: Help Needed for Fourier Transform Calculation"
Hi Could you please help me to fix the code below? I know that the code is completely wrong but I have tried to write it down so that you can get an idea what I'm trying to do. Thank you. %%file name fourier.m clear all; close all; clc; f = 0; %% 0 Hz to 100 Hz, with 0.1 step...- PainterGuy
- Thread
- Code Matlab Matlab code
- Replies: 29
- Forum: MATLAB, Maple, Mathematica, LaTeX
-
I
MATLAB Small matlab code not working. Why ?
Code is the following : %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% xiter=[0.7 20 10]; mubeton=[0.100 0.80 0.70 0.60 0.50 0.25]; muair=[0.05 0.042 0.04 0.032 0.021 0.011]; zl=[5 30 70 100]; fnorm1 = @(d,a0,dmax) (a0*(1-exp(-(0.5*log(d./dmax)).^2))+exp(-(0.5*log(d./dmax)).^2)); fnorm2 = @(d,dmax,DRL)...- imsolost
- Thread
- Code Matlab Matlab code
- Replies: 6
- Forum: MATLAB, Maple, Mathematica, LaTeX
-
A
How Do You Calculate the Electric Field of an AC Source in MATLAB?
Hello everybody I got really confused. I want to calculate the Electric-Field of an alternating current source( Sine(wt)). I do not know what is its equation. I need to run it in Matlab to get a result. Can you please give me some hints? I need to write the equation to calculate the E-field in...- Artyman
- Thread
- Ac Alternating current Electric Electric field Field Matlab code Source
- Replies: 8
- Forum: Electrical Engineering
-
N
MATLAB Why 2 vectors are not the same in matlab?
I have 2 vectors: a = 1.0e-04*[0.110000000000000 0.140000000000000 0.140000000000000 0.140000000000000]; b = [0.000011000000000 0.000014000000000 0.000014000000000 0.000014000000000]; by look at by eyes, it seems similar; but when I use this command: a == b then I got...- Nate Duong
- Thread
- Matlab Matlab code Vectors
- Replies: 5
- Forum: MATLAB, Maple, Mathematica, LaTeX
-
D
I don't get a reasonable output for my code?
I'm trying to plot the probability of error for the following equation using Matlab software, i want to use the command "trapz" for the numerical integration, the problem is that i get a fine shape for the plot, but the values in the y-axis are wrong, the whole curve should be between 0 and 1.2...- deema_master
- Thread
- Code Matlab code Numerical integration Output
- Replies: 5
- Forum: MATLAB, Maple, Mathematica, LaTeX
-
S
I Working out the equation for coordinates on a graph
I have a series of data points for X and Y points on a graph. The data is quite random and I am trying to work out a trend line so I can then form an equation for the line. How would I go about working out the equation for the data below. (0, 580) (6.7, 495) (13.4, 445) (18.7, 365) (22.8, 350)...- Saints-94
- Thread
- Coordinates Graph Matlab Matlab code
- Replies: 7
- Forum: General Math
-
N
MATLAB Learn How to Plot Figures in MATLAB: Step-by-Step Guide and Helpful Tips
Dear group, I am new with MATLAB and trying to plot these figure out as the file request. I tried but could not get the same plot as the file has. I hope anyone can help. Here is the code which i am working on. Thank you. fc = 553e6; w = 0:2*pi*fc*1e-2:100*2*pi*fc; pau = 0.33; tau =...- Nate Duong
- Thread
- Math and physics Matlab code Plot
- Replies: 3
- Forum: MATLAB, Maple, Mathematica, LaTeX
-
P
Matlab code problem with differential equations
Homework Statement For a following differential equation d^2y/dx^2-4y=(e^x)/x Find the solution using numerical methods Homework Equations d^2y/dx^2-4y=(e^x)/x The Attempt at a Solution %num dx=0.01; x=1:dx:3; l=zeros(1,length(x)); m=zeros(1,length(x)); l(1)=1; m(1)=0.25; for...- pugtm
- Thread
- Code Differential Differential equations Matlab Matlab code
- Replies: 3
- Forum: Engineering and Comp Sci Homework Help
-
MATLAB How to make 2D plot of points with different colors?
I want to make a 2D plot of points with different x, y coordinates and have colors depending on a separate variable. I have make column vectors for x and y coordinates and another column containing 1 or -1. I would like to represent the points with 1 as red and -1 as blue points. I have codes as...- kelvin490
- Thread
- 2d Color Matlab Matlab code Plot Point Points
- Replies: 2
- Forum: MATLAB, Maple, Mathematica, LaTeX
-
Solving a System of 2 ODES with Interval conditions
Homework Statement I am trying to solve a system of 2 ordinary differential equations using matlab. However, I am not able to get numerical solutions from the code despite having keyed in all possible solutions. Homework Equations The equations I am given are: dx/dt=A(x/t)+By...- Ketav
- Thread
- Conditions Error Interval Matlab code Odes System System of ode
- Replies: 1
- Forum: Engineering and Comp Sci Homework Help
-
S
MATLAB Python to Matlab Conversion for fscanf & DWT
Hello, 1. Homework Statement I find diffuculties to transform fscanf and to apply the discrete wavelet transform order 2 from matla to python. Homework Equations This is the MATLAB code: D_P=fopen('distance_profil.txt','r'); i=0; while(feof(D_P)==0)% test for end of file i=i+1...- Simon_Azerty
- Thread
- Code Matlab Matlab code Matlab programming Python
- Replies: 1
- Forum: MATLAB, Maple, Mathematica, LaTeX
-
MATLAB Matlab -- how can i use a FOR loop if I have 2 variables changing
Hey,for following code the 3rd loops i need to have 2 variables m and q .Could anyone help? for t=1:maxiterations toterror=0; for j=1:numfeature totslope=0; for i=1:m&&q=1:numfeature z=0; for jj=1:numfeature...- jiaying
- Thread
- Loop Matlab Matlab code Variables
- Replies: 7
- Forum: MATLAB, Maple, Mathematica, LaTeX
-
A
I Plotting the orbits of the planets
Hello everybody! Long-time lurker and second-time posting. I'm working on a project for my math class, and I'm trying to plot the orbits of the planets using vectors. I've chosen to use MATLAB because I am decently familiar with it. I've used the formulas described in this post here to get my...- Astro Student
- Thread
- Matlab code Orbital mechanics Orbits Planets Plotting Programming Vectors
- Replies: 2
- Forum: Astronomy and Astrophysics
-
B
Disappearing energy from a series connection of coupled oscillators
I have been having trouble getting the calculation of energy for a chain of coupled oscillators to come out correctly. The program was run in Matlab and is intended to calculate the energy of a system of connected Hooke's law oscillators. Right now there is only stiffness and no dampening...- bcolson
- Thread
- Connection Coupled Energy Matlab code Oscillators Series Springs
- Replies: 2
- Forum: Engineering and Comp Sci Homework Help
-
MATLAB How to get the last variable of a for loop in MATLAB
Aloha guys, I am just having trouble getting MatLab to output only the last variable of my "for loop." If anyone can help all I am looking for is an example of notation. p.s. I have done this before just not in a while and will continue to look through my old scripts and functions. just not in...- KonaGorrila
- Thread
- For loops Loop Matlab Matlab code Variable
- Replies: 2
- Forum: MATLAB, Maple, Mathematica, LaTeX
-
I
I How to turn model of Schrödinger's Equation 2D?
Hi, I am a student in the Netherlands, currently 17 years old and at the end of my 'middelbare school', meaning that next year I'll be a bachelor student at a university. I am doing an extended essay/research thing that is custom you do in your last year, with a friend of mine. We picked the...- IsaiahvH
- Thread
- 2d Matlab Matlab code Model Schrödinger Schrodinger equation Schrodinger's equation
- Replies: 6
- Forum: Quantum Physics
-
B
Problems with Matlab code for simulating spring motion
The issue I am having is setting up the actual program for the problem. I am having trouble interpreting the code and, because of that, having issues getting it to work properly. The whole thing was written with Matlab and the goal was to write a function that could simulate the motion of a...- bcolson
- Thread
- Code Matlab Matlab code Motion Spring
- Replies: 1
- Forum: Engineering and Comp Sci Homework Help
-
J
MATLAB Solving Orbital Motion Equations with RK4 Using MATLAB
I'm trying to plot the solutions of the second order differential equation d^2R/dt^2 = GM/R^2 + Lz^2/R^3. I'm reducing this to a system of first order ODEs and then using RK4 to solve this system. My code is given by function RK4system() Tsim = 10...- Jordan_Tusc
- Thread
- Astrodynamics Matlab Matlab code Numerical analysis Orbits Plotting Runge kutta Trajectories
- Replies: 4
- Forum: MATLAB, Maple, Mathematica, LaTeX
-
I
MATLAB Transforming part of matlab code to Fortran90
Here are my Fortran codes: program test implicitnone integer*4 nxProjPad, cf, numViews, cc, index, indRad, iv, i, INDEX1, d, n real*4 v4, v5, RSS, S1, F1, gMDL real*4, dimension(:), allocatable :: array, sum, cumsum, transpose, log, SS1, SSs nxProjPad=185 numViews=180...- i_a_n
- Thread
- Array Code Fortran90 Functions Matlab Matlab code Variable
- Replies: 8
- Forum: MATLAB, Maple, Mathematica, LaTeX
-
MATLAB How to Convert Matlab Gaussian Cone Code to C++?
anyone help me to convert this sample code of Gaussian Cone shape of random number code in Matlab into C++ function GaussianCone clear all; clc; mx=10000; my=mx; mz=mx; z=[1:1:mz]'; sigma=0.01; R=0.5; mu=0; sigmax=sigma+R*z; sigmay=sigma+R*z; x=zeros(mx,1)...- MAKK
- Thread
- C++ programming Code Matlab Matlab code Matlab programming Programming c++
- Replies: 3
- Forum: MATLAB, Maple, Mathematica, LaTeX
-
A
MATLAB Crank-Nicholson in 2D with MATLAB
I have the code which solves the Sel'kov reaction-diffusion in MATLAB with a Crank-Nicholson scheme. I would love to modify or write a 2D Crank-Nicolson scheme which solves the equations: ##u_t = D_u(u_{xx}+u_{yy})-u+a*v+u^2*v## ##v_y = D_v(v_{xx}+v_{yy}) +b-av-u^2v## Where ##D_u, D_v## are...- Aldo Leal
- Thread
- 2d Matlab Matlab code Matlab programming Pde system
- Replies: 1
- Forum: MATLAB, Maple, Mathematica, LaTeX