Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

How to edit a Program in Matlab??

Status
Not open for further replies.
Can you send me your code?
coz i can't imagine what do u wanna make
 

DEar Devilwar,

Thanks for your kind help.
One program that i tried y'day by myself is to plot xdot=sinx, with xdot along y axis and sinx along x axis but i'm getting error which is perhaps bcoz of error in logic hence want ur help in the same.

clc;
clear all;
function xdot = func(t,sinx);
xdot = sinx;

I saved it as func.m
in command prompt i typed

>>tspan = [0,2];x0=0;
>>[t,sinx]=ode23('func',tspan,x0);
here i'm getting error
Error: File:func.m Line:4 Column:1
Function definitions are not permitted at the prompt or in scripts.
Error in ==> odearguments at 81
if(nargin(ode)==2)
Error in ==>ode23 at 172
[neq,tspan,ntspan.....

One more thing i need to ask you is if it is necessary to have the function name and m file name to be the same as that is what i have seen in Rudra Pratap's book to be kept as same.

Regards,
Rahul

Code:
function xdot = func(t,sinx);
 xdot = sinx;

changed to
Code:
function xdot = func(t,x);
xdot = sin(x);
 

hi blooz,

the function xdot = func(t,x) line giving error with a red line below function and x.

i really don't see any syntax error in it, plz see if there is any in it.


regards,
rc
 

could you post the Differential Equation ,

it will be easier to solve if you can state the equation
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top