Answered
How to write a function of two variables, but only use one?
EDITED The only way I can think of : syms X2L T Funcion =exp(OMEGA./(R.*T).*(1+3*B-4*B.*X2L).*X2L.^2+HVAP1/R.*(1/TVAP1-1./T))...

7 years ago | 1

Answered
Determining particular solution of 3x3 matrix using variation of parameters
Remove sym()

7 years ago | 1

| accepted

Answered
How do I change these commands to plot different differential equations?
EDITED mu=[300 200]; eta = [400 100]'; F=@(t,y) [(1-y(2)/mu(2))*y(1); -(1-y(1)/mu(1))*y(2)] [t,y]=ode45(F,[0 25],eta) ...

7 years ago | 0

Answered
How to solve two nonlinear equations multiple times for the two unknown using fsolve when the known parameters are changing multiple times
parameterize your function , run a loop to give the paramters as inputs one by one

7 years ago | 0

Answered
Why linprog give answer not satify the constrains?
[x, f] = linprog(f,A,b,Aeq,beq,lb,ub,options); ^-^------not square brackets

7 years ago | 0

Answered
Average of first few elements of an array
mean(A(500:1200))

7 years ago | 0

| accepted

Answered
Subs Result Still Has Symbolic Variable In It
change [ ] to { }

7 years ago | 0

Answered
Matlab function error 'Not enough input arguments.'
You didn't call the function instead you just ran the function which requires input X X=rand(1,10); [minimum, maximum] = extre...

7 years ago | 0

| accepted

Answered
How to store a string data into an array
trainLabels = cell(315,1); trainLabels(:)={'bass'}

7 years ago | 0

Answered
How to simulate using ode23 with multidimentional second order differential equations
replying to your comment: clc; clear figure time = (0:.001:22.5)'; M = [1 2; 3 4]; K = [5 6; 7 8]; x0 = [1;0;0;0]; %[posit...

7 years ago | 0

| accepted

Answered
I want to simulate a simple pendulum so that the object is connected to the rope, but i can not simulate the rope . Please guide me.Thank you.
https://in.mathworks.com/help/symbolic/examples/simulate-physics-pendulum-swing.html

7 years ago | 0

Answered
Finding particular solution to 3x3 matrix using undetermined coefficients
Read about fsolve(): Roots=vpa(fsolve(@solls,[0;0;0])) %function call function eqn=solls(x) %function definit...

7 years ago | 1

| accepted

Answered
accessing the first column of each cell ?
Only first part is answered: c=cell(1,2000); for i = 1:2000 % -> numel(cellmatrix) c{i}=cellmatrix{i}(:,1); % change 1 to ...

7 years ago | 0

Answered
Integrating 2nd order differential equation with ode45
xde(2) = -(b./m).*x(2) - (k./m)*x(1); ^----------should be 2 not 3!

7 years ago | 1

| accepted

Answered
How do I generate a 2000 x 2000 matrix of random numbers evenly distributed on (-3,3)?
a = -3; b = 3; result = (b-a).*rand(2000)+a;

7 years ago | 3

| accepted

Answered
How can i allocate results in matrix with for loop?
y=zeros(6,10); %change this ctr=1; %before loop y(ctr,:)=.... change this part ctr=ctr+1; % add this before last end (after...

7 years ago | 1

Answered
Can someone please tell why I have an error?
Instead of line (this is what sir Walter mentioned in the above) : ya=f(x) %change your lines to these lines yb=f(x)

7 years ago | 0

| accepted

Answered
Help plotting all points for each iteration on one graph.
Plotting them as subplots is a better idea because obvously the scales are different. y = [0.5;0.99;1.01;1.3]; n = 1:100; c={...

7 years ago | 1

| accepted

Answered
How to write this pseudocode in matlab?
Disclaimer : Just an approximate code x=1; phase=0; while phase<n if phase==0 while x<n if a(...

7 years ago | 0

Answered
How can I save three dimensional matrix into a .dat or .txt file?
https://www.mathworks.com/matlabcentral/answers/46120-save-a-three-dimensional-matrix#answer_56399

7 years ago | 0

Answered
Can someone please help?
Lines 2 , 3 and 4 should be at the end of part a

7 years ago | 1

| accepted

Answered
How can I plot matrix [5x6] data from certan row to onother row.
plot(YourMatrix(2:end,:)) % other than this I have no idea what you want

7 years ago | 0

Answered
How to insert values from a for loop into an array?
Remember matlab index starts from one not from zero! Without Loop (faster) : a = 500 b = 1000 i=0:0.05:2; elements = a * i ...

7 years ago | 4

| accepted

Answered
How to use all the other indices except of the ones given in an array?
Make those indices logical: A = (1:100).'; B = (1:0.5:50.5).'; Linear_indices= [10 11 30 35 40 90 91 92 93 99].'; idx=ismemb...

7 years ago | 1

Answered
i am designing a 500m pipeline, but i'm facing a problem with my code, it can't seem to plot a graph. i know it's a bit long but this is the only way to post the question. i have a lot of columns due to the range of velocities used.
clear,clc,clf format long Q=0.03; rouh=847; g=9.81; Gamma=(rouh.*g); Zs=0; Ze=0; L=500; Ks=(6*10.^-5); viscosity=(1.1*...

7 years ago | 0

| accepted

Answered
Calculating values from a sequence with a for loop
With Loop: num = 100000; n = 1:100000; A = zeros(100000,1); for nLoop = 1:num A(nLoop,1) = (2.2.*n(nLoop)-1).^2; end ...

7 years ago | 1

| accepted

Answered
I am trying to program a value that runs from 10^-9 to 10^1. I have tried the following code and I have changed the e function to x10^() but my code will not run. It always gets stuck on this line. When I use e the error is invalid use of operator.
I am not sure if your aware of this but 1e1 is equivalent to 10^(1) not x10(1) and your right number next to e should be an inte...

7 years ago | 0

| accepted

Answered
Use sym to define a sum function, but i have a problem with indexing
syms r k=1:n; f = c(k)./(1+r).^(k-1); S_sum=vpa(symsum(f),2);

7 years ago | 0

Answered
syntax to used unmatched values in matlab?
idx=ismember(c,a); % idx is logical index c(~idx)*4 %multiply with whatever number you wish

7 years ago | 0

| accepted

Answered
HOW I COULD DRAW THIS FUNCTION
Use cumsum() to define the behaviour of the alternating series: x=linspace(0,50,10000); n=1:10000; y=(2/pi).*cumsum((((-1).^n...

7 years ago | 1

Load more