How do i plot a I-V graph given the following step size of V.
the following equation:
%Given:
Rs=0.5;
V=0:1.5:35;
I=exp(V+RsI)+(V+RsI);
If you just need the graph, you don't need to solve the equation, you can use ezplot to plot implicit equations.
If you need to solve it specifically over that range you can use fzero inside a for loop, BUT, I think you don't have your equation right, because it doesn't seem to be defined over that range
Related
enter image description here
I've checked my code, which I think is ok, but can't get the right plot as in the book
here's my code:
clc,clear,close all
syms y(x) dy d2y
dy=diff(y,1)
d2y=diff(y,2)
y=dsolve((1-x)*diff(y,2)==sqrt(1+diff(y,1)^2)/5,y(0)==0,dy(0)==0)
fplot(y,[0,2],'r')
the output of y = dsolve is a vector with 2 equations as its elements. Also in the range of fplot these functions are complex. Since I don't know which results you are looking for, you can try and check these alternatives for your plot and have a look at the output:
fplot(real(y(1)),[0,2],'r')
fplot(abs(y(1)),[0,2],'r')
fplot(imag(y(1)),[0,2],'r')
I am having some discrete points, by using which I can plot spline curve(Syncfusion chart) in flutter. But now I have to find the point on that curve i.e. by giving values of x, I need value of y. I am stucked here and don't have any algorithm to apply for that. How did they make graph using discrete point ? There should be some algorithm which can be applied here and get those point.
Please help me out
Thanks in advance!!
I am here with a great solution to this problem, So The idea goes like if we have n points for equilibrium data, then we will assume a polynomial of order n-1(For eg. no. of points on equilibrium curve to be 3 then the polynomial should be quadratic of form y= Ax²+Bx+C). Now as we have 3 variables(A, B, C), then to solve this equation we need 3 equations in terms of A, B and C. These equations are obtained by putting the equilibrium data points, in this case 3 points so we will get 3 equations. These three equations can be solved by using Cramer's rule. After solving the equation we will get the equation of the curve.
The equation thus obtained will be more accurate and as cramer's rule can be obtained to any number of equations, then we can easily obtain polynomial equation of any order.This method is quite big and will be time taking to apply.
This will give you the curve for a given number of points
Say for example I have data which forms the parabolic curve y=x^2, and I want to read off the x value for a given y value. How do I go about doing this in MATLAB?
If it were a straight line, I could just use the equation of the line of best fit to calculate easily, however I can't do this with a curved line. If I can't find a solution, I'll solve for roots
Thanks in advance.
If all data are arrays (not analytical expressions), I usually do that finding minimal absolute error
x=some_array;
[~,ind]=min(abs(x.^2-y0))
Here y0 is a given y value
If your data are represented by a function, you can use fsolve:
function y = myfun(x)
y=x^2-y0
[x,fval] = fsolve(#myfun,x0,options)
For symbolic computations, one can use solve
syms x
solve(x^2 - y0)
Assuming your two curves are just two vectors of data, I would suggest you use Fast and Robust Curve Intersections from the File Exchange. See also these two similar questions: how to find intersection points when lines are created from an array and Finding where plots may cross with octave / matlab.
I am trying to plot roots of a function that is composed of multiple bessel functions being added and multiplied in Matlab. The equation is Jm(omega)*Ik(omega)+Im(omega)*Jk(omega) where Jm is the bessel function of the first kind of order m (besselj). Im is the modified bessel function of the first kind of order m (besseli). For each mode m=o,1,2,...and n=1,2,3... The frequency omega(mn) is the corresponding root of the listed equation. m=0,1,2 n-1,2,3,4. I need to solve the equation for the 12 roots. I am new to Matlab and this is a little out of my league. So far I have this code but I wasn't sure if I needed the variable omega in the script or not. I have also looked at other people's questions on the suject but didn't see any quite like this. The plots I have seen look nothing like mine which tells me I am probably wrong. Thanks for any help.
m=(0:2); k=(1:3); n=(1:4);
Jm=besselj(m,n');
Ik=besseli(k,n');
Jk=besselj(k,n');
Im=besseli(m,n');
g=Jm.*Ik+Im.*Jk
plot(g)
Plotting
besselj and besseli take what you call omega as their second parameter, so to plot your function you should try something like
m=0; k=1; omega=0:0.02:10;
Jm=besselj(m,omega);
Ik=besseli(k,omega);
Jk=besselj(k,omega);
Im=besseli(m,omega);
g=Jm.*Ik+Im.*Jk;
plot(omega,g);
hold all;
plot(omega,0,'k');
axis([min(omega) max(omega) -100 100]);
This shows you that for m=1, k=1 the first zeros are around 3.2, 6.3 and 9.4:
Finding the roots numerically
You could implement Halley's method for your function g, similar to how the roots of besselj are determined in the MatlabCentral file linked by Cheery.
I would like to solve one equation in Matlab with two unknown variables using the Newton raphson method.
The equation is
I(:,:,K) = IL(:,:,K)-Io(:,:,K)*(exp((V+I*Rs)/a(:,:,K))-1)-((V+I*Rs(:,:,K))/Rsh(:,:,K));
Can this be done in matlab and if so please guide me since I have not managed to find anything related to this equation form!
Thanks
No. In general, one equation in two unknowns has an infinite number of solutions. (Think of a contour plot. You are essentially looking for the level set, the locus of all points that yields zero for the dependent variable. It will be a curvilinear path in those variables.)
So you can't "solve" it. I would suggest a good solution to visualize the locus is indeed the function contour. ezplot will do it even better.