Answered
Jump to next loop (alternative goto)
doc break

7 years ago | 1

Answered
Problem with plotting a semilog function
f=@(x) [3.*x(1) - cos(x(2)*x(3)) - 3/2; 4.*x(1)^2 - 625.*x(2)^2 + 2.*x(3) - 1; 20.*x(3)^3 + exp(-1.*(x(1)*x(2))) + 9...

7 years ago | 0

| accepted

Answered
finding the optimizing solution
Hi, use: q1 = A\v Since you calculated v by using A*q the result will be: q1 = q norm(v-A*q) = 0 norm(v-A*q1) = norm(v-A*q...

7 years ago | 1

| accepted

Answered
Vector output from a function
Hi, you set y=0. one line later you start a while loop, that is valid as long as y>0. This can not work. For this reason xdis...

7 years ago | 0

| accepted

Answered
How do I print a "%" when using fprintf?
percentError = 0.03696863; fprintf('Percent Error: %0.8f %%', percentError);

7 years ago | 15

| accepted

Answered
Perform this operation on a scalar/vector or matrix
g = (1./(1+exp(-z))); % ^ % |______ perform elementwise

7 years ago | 1

| accepted

Answered
I want to sum of M? I'm using this command but I'm unable to get the numerical value? only getting sum equation? How can I get the values.Is there any idea? Thanks in advance
syms n D=1.32e-9 t=0:5/20:5 L=.2 x=0:(L/20):L F=4*L^2/(D*(2*n+1)^2*pi^2)*(exp(D*(2*n+1)^2*pi^2*t/(4*L^2))-1); % last int ...

7 years ago | 0

| accepted

Answered
Problems with fsolve error
Hi, if you call your function with the initial values F(vr0) you get: >> F(vr0) ans = 1.0e+04 * Columns 1 thro...

7 years ago | 0

| accepted

Answered
index issue, plotting curve for engineering coursework
Hi, no need to define pi - it is a constant in Matlab already. Your issue is: pi(P) which is interpreted as the P'th value of...

7 years ago | 0

| accepted

Answered
How to normalize the spectra by 650 nm?
Hi, you might want to use the normalize function: result = normalize(A,'range') Best regards Stephan

7 years ago | 1

| accepted

Answered
Vectors/rational numbers
a(1)=5040; a(2)=17; b(1)=22; b(2)=342920; res = r_mul(a,b) function r = r_mul(a,b) M = a(2)*b(2); %finding common denomi...

7 years ago | 0

| accepted

Answered
I have two vectors A and B. A contains zeros and ones, whereas B contains the vectors at which A is zero or 1. I want to know the range of B where A is 1
result = range(B(A==1)) You edited the question - here's the edited answer: % your arrays A=[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

7 years ago | 0

| accepted

Answered
How to create Non-repetitive integers on the same row and non-repetitive rows
Hi, to create random integer values use randi. To create random integer values without repetitions use randperm. Best regar...

7 years ago | 0

Answered
Range of a matrix
Hi, the option 'all' was introduced in R2018b - in earlier releases you can not use this feature. Make sure to look in the ...

7 years ago | 1

| accepted

Answered
Symbolic solution of Transcendental equation
Hi, try with assumptions: syms g l k t; eq = cos(g*l) + k/t/g*sin(g*l) == 0; assume([g l k t],'real') assumeAlso([g l k t],...

7 years ago | 0

Answered
General question, temp, character
Hi, the first line creates filenames depending from N as a string and saves it in temp: temp = StressSolution1.txt te...

7 years ago | 1

| accepted

Answered
Unexpected behaviour when calling main function with 2 outputs
Call it with 2 output elements: [n, p] = SandboxFile() Sure about clc clear all ? This is unneccassary and ca...

7 years ago | 0

| accepted

Answered
how access structure of array element using loop
Hi, your loop start with i=1 & j=1. Compare the conditions of your while loop with this initial case. you dont change bid or ...

7 years ago | 0

| accepted

Answered
Separating a vector into two different vectors
your_vector = (1:100)'; A = reshape(your_vector,10,[]); B1 = reshape(A(:,1:2:end),[],1) B2 = reshape(A(:,2:2:end),[],...

7 years ago | 1

| accepted

Answered
How to change ghraph interval when using fplot
fplot(@(v) v.^2,[0 100])

7 years ago | 0

| accepted

Answered
Use a structure as input in a function
Hi, try: % Define cylinder 1 cylinder(1).radius = 2; cylinder(1).height = 1.5; % Define cylinder 2 cylinder(2).radius = ...

7 years ago | 0

Answered
how to convert string to date?
Date = '10:12:25 Tue 11-Dec-18' res = datetime(Date ,'InputFormat','HH:mm:ss eee dd-MMM-yy','Format','dd/MM/yyyy HH:mm a') D...

7 years ago | 3

| accepted

Answered
using 'fsolve'
Hi, why not solve it symbolic: syms f(x,y) f(x,y) = x.^(2-x.^(0.5))+y.^(2-y.^(0.5)); [xsol,ysol] = vpasolve(diff(f,x) + dif...

7 years ago | 1

| accepted

Answered
How to find the first entry of a sequence of values
Hi, try: result = A([1; find(diff(A(:,1))~=0)+1],:) gives the desired result: result = 5.0000 0 6.0000 ...

7 years ago | 1

| accepted

Answered
isqnonlin command: not enough input parameters error
Hi, try: % Sabit degerler k = 1.38e-23; % Boltzman sabiti q = 1.602e-19; % Elektronun yuku T = 25+273; % Si...

7 years ago | 0

| accepted

Answered
Use Particle Swarm Optimization with inequality linear constraints.
Hi, there is not such a syntax, since PSO does not support constraints. If you need constraints i suggest to use ga, which is a...

7 years ago | 0

| accepted

Answered
How to average finite components only of 4 data?
Hi, the mean function has the option nanflag. That makes life easy: % create example data containing NaN values data1 = randi...

7 years ago | 0

| accepted

Answered
Saving models from classification learner App
Hi, you could consider to export a compact model without the training data - this will also work for making predictions on new ...

7 years ago | 1

| accepted

Answered
Is it possible to simplify symbolic expressions with known relations
Hi, use assume - like Star Strider suggested and additionally use simplify to get the desired result; syms x1 x2 assume(x1*x2...

7 years ago | 1

Answered
Normalization of a vector
result = normalize(v,'range',[-1 1]) where v is your vector

7 years ago | 0

| accepted

Load more