Respondida
sum() missing for certain values
Don't use sum(Vector==x) use tol = 0.0001 ; % set your acceptable tolerance sum(abs(Vector-x)<tol) ;

más de 3 años hace | 0

| aceptada

Respondida
plotting data from multiple sheets by ID and day
fname = 'https://in.mathworks.com/matlabcentral/answers/uploaded_files/1300500/RLC_AD.xlsx' ; sheets = sheetnames(fname) ; ...

más de 3 años hace | 0

| aceptada

Respondida
Preallocating an array or a vector in matlab before a for loop
Thanks is accepting and/or voting the answer. :)

más de 3 años hace | 0

Respondida
Preallocating an array or a vector in matlab before a for loop
N = 24 ; sigma_infty = zeros(6,N); eps_infty = zeros(6,N); for k = 1:N % sigma_infty(:,k) = [10*k 0 0 0 0 0]'; ...

más de 3 años hace | 1

| aceptada

Respondida
im modelling for two mass drive train , i could not able to know why an index exceed error
function dy= two_mass2(ta,te,k,d,jt,jg,y) x=y(1); y=y(2); dxdt=y(3); dydt=y(4); d2xdt2=((1./jt)*(ta-d*(dxdt-d*dydt)-k*(x-y)...

más de 3 años hace | 0

Respondida
How to compare each element of two arrays fullfilling a set condition more efficiently / quickly?
A = randi([0,5],10,1); B = randi([0,5],10,1); err = 0.5; [a,b] = meshgrid(A,B) ; idx = a<(1+err)*b & a>(1-err)*b ; r...

más de 3 años hace | 0

| aceptada

Respondida
Build arrays under the for loop
R = cell(10,1) ; for i=1:10 R{i}= nonzeros(D(i,:)); end You can access by R{1},R{2},...R{10}. R is a cell array. You ...

más de 3 años hace | 0

Respondida
How to exclude/extract empty rows/columns in a table?
T = readtable('https://in.mathworks.com/matlabcentral/answers/uploaded_files/1288860/test_file.txt'); % Remove empty rows idx...

más de 3 años hace | 1

Respondida
Error using tf The values of the "Numerator" and "Denominator" properties must be row vectors or cell arrays of row vectors,
Your numerator and denominator are sym class. You need to convert them to double using double. sys = tf(double(numerator) , dou...

más de 3 años hace | 0

| aceptada

Respondida
How do I input names properly in a script?
height=input('enter your height in feet:'); weight=input('enter your weight in pounds:'); name=input('enter your first name:',...

más de 3 años hace | 0

Respondida
how to convert a.mat file in to png?
Read about volumeViewer load('dataset_liver_bmodes_steatosis_assessment_IJCARS.mat') I = data(1).images ; volumeViewer(I)

más de 3 años hace | 0

Respondida
How to convert symbolic output to numeric value in Symbolic Math Toolbox?
Read about double, vpasolve.

más de 3 años hace | 0

Respondida
Animate a line in polar coordinates
In your case r is comlex number which is not allowed. You need to get r as shown below. theta = 0:0.001:2*pi; R = 1 ; x = R...

más de 3 años hace | 0

Respondida
How to discretize the color in contour bar at smallest possible range?
% Make data for demo [X,Y,Z] = peaks ; vals = [0.000 0.005; 0.005 0.009 ; 0.01 0.05 ; 0.05 0.1; ...

más de 3 años hace | 0

Respondida
How to plot the graph for a given signal over a range of frequency
w = [0 pi/8 pi/4 pi/2 pi] ; n = 1 ; x = cos(w*n) ; plot(w,x)

más de 3 años hace | 0

Respondida
How to convert cell char array in Table With Column
You can use regexp to extract the data. load('Data.mat') [m,n] = size(Datawebsite) ; predictedClass = cell(m,1) ; maximum...

más de 3 años hace | 0

| aceptada

Respondida
Using masking and native string functions to find the longest word in a string.
str = 'Today is a good day' ; s = strsplit(str) ; L = cellfun(@length,s) ; [val,idx] = max(L) ; longest_string = s{idx} ; f...

más de 3 años hace | 0

Respondida
Maximum perpendicular distance between lines
You have to use the foot of the perpendicular formula. clc; clear all ; x = [120 150 180 210 240 270 300 330 ...

más de 3 años hace | 0

Respondida
Indexing in complex cell arrays
% Make dummy data for demo a = cell(10,1) ; for i = 1:10 m = randsample(5:10,1) ; b = cell(m,1) ; for j = 1:m...

más de 3 años hace | 0

Respondida
Generate a Random Point inside a box/plane
A = [0 0] ; % (p,q) B = [1 1] ; % (x,y) a = 50; b = 100; r = (b-a).*rand(1000,1) + a; x = (B(1)-A(1))*rand(100,1)+A(1) ; ...

más de 3 años hace | 0

Respondida
How to plot This graph in matlab?
I have shown one plot for you reference. You may extend the same to others. x=1.0:0.1:3.0; y=-2.03*10^-3*x.^2+5.76*10^-3*x+1*...

más de 3 años hace | 0

Respondida
Expected a scalar value. This expression has size [:? x 1].
Try this: % Sample Code tol = 10^-3 ; % can be changed idx = find(abs(sample.data1-values)<tol) ; max_index = idx(1) ;

más de 3 años hace | 1

| aceptada

Respondida
Fisher Discriminant analysis - issues with classes
You should use: % Compute mean of each class mu = zeros(k,C); % k = 3 i.e. number rows and C is number of classes i.e.5 for...

más de 3 años hace | 0

Respondida
How to check whether point is inside high dimensional convex hull?
This link should help you: https://in.mathworks.com/matlabcentral/answers/101396-is-there-a-function-in-matlab-for-detecting-poi...

más de 3 años hace | 0

Respondida
Extract area of matrices (lat, lon, data) by shapefile. "Requested array exceeds the maximum possible variable size."
You need not to use meshgrid. Already your lon, lat values are in meshgrid. Remove these lines: lat = %MyLat 8000x8192; lon = ...

más de 3 años hace | 0

Respondida
extractin values from a struct that is in a table
rain = data.rain ; iwant = zeros(length(rain),1) ; for i = 1:length(rain) if ~isempty(rain{i}) iwant(i) = rain{...

más de 3 años hace | 0

| aceptada

Respondida
Find unknowns from inequations
Read about linprog

más de 3 años hace | 0

| aceptada

Respondida
How to find first 10 minimum values in a table array?
You can sort the array you want and arrange the other arrays/ table into that order. You can pick the first whatever number you ...

más de 3 años hace | 0

Respondida
How do I plot values taken from a for loop function?
clc B0=-0.00356616 ; %Lapse Rate T0=518.67 ; B=B0 ; %Lapse Rate a=0.1:36089.2 ; %Altutude in ft T...

más de 3 años hace | 0

Respondida
A general question about syntax regarding an Excel file's rows and columns in MATLAB
T = readtable(file,'HeaderLines',1) ; data = table2array(T) ; m = mean(data) [SL: fixed typo]

más de 3 años hace | 0

Cargar más