Answered
Interpolate data to present with limited size of data
x=rand(5,7) figure contourf(x,'LineColor','none') shading interp axis equal off

2 years ago | 1

| accepted

Answered
Getting A blank Graph
See below for a correct use of indexing with a for loop x = 0:0.01:1; for i = 1:length(x) y1(i) = (0.5*x(i)^5)-(0.6*x(i)^4)...

2 years ago | 0

Answered
trying to plot 3 variables in 3d
surf can handle only matrices, so this is what you want to do theta= linspace(.01, .55); %for thetamax = 32 degrees M=linspace...

2 years ago | 0

| accepted

Answered
While loop with all elements meeting the conditions
t = -100:200; F = t; indices = 1:100; while all(F(indices)<0) indices = indices + 1; end

2 years ago | 1

| accepted

Answered
Wrong sum 50 + 0.01
I don't think this is an issue at all, but it rather has to do with the max accuracy MatLab uses to store numbers. Such accurac...

2 years ago | 0

| accepted

Answered
solve multiple equation in one variable
I think the problem is that you have 5 equations and 4 variables, because p1 does not appear anywhere in the system. Therefore ...

2 years ago | 0

| accepted

Answered
How can i get a logical vector for all rows when compare each row of a column matrix with a another row column matrix
You can simply do A = randi(10,5) B = randi(10,5) l = A == B

2 years ago | 0

| accepted

Answered
How to delete previous values within a certain difference?
You can do this A = [1,2,3,4,20,21,22,35,36,37,38,50,51,52,53,54,57,70]; A = A(diff(A)>10)

2 years ago | 0

| accepted

Answered
How do I set some variables of a function to a constant and plot the others?
This is a possibility E = -3:.001:3; plot(E,Theta(E,1)) function out = Theta(E,Delta) out = zeros(size(E)); out(abs(E)<=D...

2 years ago | 1

| accepted

Answered
How to delete adjacent values
A = [1 5 6 7 8 9 10 11 12 20 21 22 23]; A([false,diff(A) == 1]) = []

2 years ago | 0

| accepted

Answered
IF statement not generating results?
data=load('artificial_slope_2.txt') %loading data % defining input values based of input txt file nx = data(:,4); ny = data(...

2 years ago | 0

Answered
a problem in rectangular function.
You are using plot incorrectly, see below. a=1; syms t f=piecewise(a / 0.2e1 < abs(t), 0, abs(t) == a / 0.2e1, 0.1e1 / 0.2e1,...

2 years ago | 1

| accepted

Answered
forward, backward, central finite differences with step sizes.
I took the liberty to give you an example with a different function, because the one in your question has a constant slope and d...

2 years ago | 0

Answered
Why does the code return an additional answer value that I have not asked for?
That is because you call the function without assigning it to a variable. Therefore Matlab assigns it to a variable called ans,...

2 years ago | 0

Answered
I'm not getting the correct result for the u, i want it in degree but the ans is not right, the plot is not smooth.
You did not give enough information to know what the end result should be, but if your interest is only to plot in degrees, then...

2 years ago | 0

Answered
How to pass a function handle as an argument in ode45?
Just use a semicolon, ode45 requires the output to be a column array. R = 0.5; l = 1; g = 9.81; omega = 0.25; F = @(t,y...

2 years ago | 0

| accepted

Answered
How can I keep the yaxis label inside rather than outside
Other possibility, a bit cumbersome I'd say plot(1:10,1:10) xlabel('xlabel') ylabel('ylabel') a = gca; a.YTickLabels = {''}...

2 years ago | 0

Answered
How to run a loop with isNaN
disp('Solving a quadratic polynonial (ax^2+bx+c), where a b and c are real numbers to 3 decimal places') a = input ('What is yo...

2 years ago | 1

| accepted

Answered
get p*(q*m) matrix from m*n matrix and p*q indexing matrix
Something like this? n = 3; C = rand(8,n) index=[... 1 5 1 2 3 4 2 6 2 3 4 1 3 7 6 7 8 5 4 8 5 6 7 8 ...

2 years ago | 0

| accepted

Answered
How can I keep the yaxis label inside rather than outside
You could play around with the "Position" field of the text structure of the label. See below plot(1:10,1:10) xlabel('xlabel'...

2 years ago | 0

Answered
I want to find 4 consecutive number which is present in array.
idx = [1 2 4 5 7 9 11 12 13 14 16]; pl = regionprops(any(idx == (1:max(idx))',2),'PixelList'); out = pl(cellfun(@(x)size(x,1)...

2 years ago | 0

| accepted

Answered
Implementing numerical method for PDE
clear,clc tspan = [0 1]; N = 100; x = linspace(0,1,N); dx = 1/(N-1); Uexact = @(t,x) exp(1i*(x-t)); ...

2 years ago | 1

| accepted

Answered
Compact way to plot data with relative colors and legend
a = {'marathon', 1, 4; 'bank holiday', 3, 6; 'bank holiday', 2, 1; 'concert', 0, 4; 'regatta', 1, 9; ...

2 years ago | 1

| accepted

Answered
Finding the sum to n of 1/2^n
You haven't indexed the loop variable for n = 1:20 b(n) = 1./(2.^n); end Sn = sum(b); disp(Sn) You can also do it with...

2 years ago | 0

Answered
display string in table
row1 = {'a' 'b' 'c' 'd'}; row2 = {'m' 'n' 'o' 'p'}; varnames = {'Col1' 'Col2' 'Col3' 'Col4'}; rownames = {'Row1' 'Row2'}; T...

2 years ago | 0

| accepted

Answered
How to write a discontinuous signal equation in matlab?
t = 0:0.001:0.3; x1 = 0.2*sin(2*pi*150*t); x1(t<=0.05 | t>=0.1) = 0; x2 = 0.4*sin(2*pi*50*t); x2(t<=0.15 | t>=0.25) = 0; x3...

2 years ago | 0

| accepted

Answered
code for solving given equations. Eq1 = x == 10-(1.5835*(y^1.7643)); Eq2 = x == (2^y-2)/(0.3143*(2)^y+0.3329*(1.5)^y+0.3528*(1)^y);
It seems like MatLab can't find a symbolic solution and returns instead a numerical one syms x y Eq1 = x == 10-(1.5835*(y^1.76...

2 years ago | 1

| accepted

Answered
MatLab codes for the used by forensics to determine the exact time of death.
if you already have an expression for T, why would you solve the ODE? anyways, the correct syntax is clear,clc k = 0.5 F = @...

2 years ago | 1

| accepted

Answered
How can I save values to an array using a for loop
I'd try this folderName = [dir([read_dr '\some_folder'])]; %This works fileNames = {}; for g = 1:length(folderName) file...

2 years ago | 0

| accepted

Answered
Solving Trigonometric Function Equations with Time varying Parameters by MATLAB
You were almost there t = (0:0.001:5)'; x = fsolve(@(x)myfun(x,t),zeros(size(t))); plot(t,x) xlabel('t') ylabel('x') funct...

2 years ago | 0

| accepted

Load more