Answered
how to make a vertical plot?
r=[0 0 0 0 0 0 0 0 0 0 0.25 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0.15 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.3 0 0 0 0 0 0 0 0 0 0 0 ]; w=[...

3 years ago | 1

| accepted

Answered
How to use sortrows command in java.math.BigInteger?
import java.math.* %load sample BigInteger Array (100x2) for k=1:100 J(k,:)=[BigInteger(repmat(num2str(randi(1e14,1)),1,3))...

3 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]; d=num2str(diff(idx)==1); d(d==' ')=[]; f=strfind(d,'111'); idx(f:f+3)

3 years ago | 0

Answered
Why do I receive an error when running this code?
You have not defined several variables: gk_max, gL_max, H, JK, JL. Once you define these variable the code will run. gk_max=1;g...

3 years ago | 1

Answered
Printing values of a .txt simple file do not match with file values
function J = computeCost(X, y, theta) m = length(y); J=sum((X*theta-y).^2)/2/m; end

3 years ago | 1

| accepted

Answered
Using a function with a loop for finding the maximum value and its index.
Vec1=[4 5 9 2 10 -1 4 0 3 12 4]; [Max1,MaxI1] = VecMax(Vec1) function[Max1, MaxI1] = VecMax(Vec1) Max1 = Vec1(1); MaxI1 = ...

3 years ago | 0

Answered
3D plot a function f(x,y,z)
g=fimplicit3(@f); function g = f(x,y,z) g=1./x.^2 - 1./y.^2 + 1./z.^2; end

3 years ago | 1

Answered
plot an specific function in matlab
dn=@(x)1/32*sin(38.4*pi*sin(x))./sin(1.2*pi*sin(x)); x=-pi/2:.01:pi/2; plot(x,dn(x))

3 years ago | 1

Solved


Heronian Triangles with Consecutive Integral Sides and Integral Area
Hero's area formula for any triangle with sides a, b, c is: . Heronian triangles are triangles having integral sides and integr...

3 years ago

Problem


Heronian Triangles with Consecutive Integral Sides and Integral Area
Hero's area formula for any triangle with sides a, b, c is: . Heronian triangles are triangles having integral sides and integr...

3 years ago | 1 | 4 solvers

Answered
I get an error when I try to run my logistic regression.
function [J, grad] = costFunction(theta, X, y) m = length(y); h=sigmoid(X*theta); J=sum((-y.*log(h)-(1-y).*log(1-h)))/m; gra...

3 years ago | 0

Answered
I got the results I was looking for, but I believe there is an easier way to define the changing variable z which I am not sure of. Could you assist in any easier method?
r = 0:0.01:3; z= [.1,.25,1]; a = (1-r.^2).^2; b = (2*z'.*r).^2; yYor = (r.^2)./[sqrt(a + b)]; yYo1 = 1./sqrt(a + b); figu...

3 years ago | 0

| accepted

Answered
Printing values of a .txt simple file do not match with file values
Attach your data if you have additional questions. data = readmatrix('ex1data3.txt');%use readmatrix

3 years ago | 1

Answered
Add indicative labels to vector values
A1 = [ 1 ; 2 ; 3 ]; A2 = [ 4 ; 5 ; 6 ]; A_labeled=[A1,ones(size(A1));A2,zeros(size(A2))]

3 years ago | 0

Answered
How to sort rows?
import java.math.* %load sample BigInteger Array (100x2) for k=1:100 J(k,:)=[BigInteger(repmat(num2str(randi(1e14,1)),1,3))...

3 years ago | 1

| accepted

Answered
Error: Array indices must be positive integers or logical values
Runs without error m=100; l=5; k=200; g=9.82; o=[0:0.01:90]; %θ V=0.5*k*l^2*(sind(o)).^2+0.5*m*g*l*cosd(o); plot(o,V); t...

3 years ago | 0

Answered
How to take the sum of all the values in an array ?
import java.math.* s=BigInteger('0'); for k=1:length(Data) s=s.add(Data(k)); end

3 years ago | 1

| accepted

Solved


Reproduce this plot!
Write a function that will take a dataset (x,y), a best fit model (model), and the upper and lower prediction bounds (lb,ub) for...

3 years ago

Answered
how to solve logarithm equation
f=@(x)log10(x.^4)-log10(x.^3)-log10(5*x) +log10(2*x); fzero(f,2) x=.1:.1:10; plot(x,f(x));

3 years ago | 0

| accepted

Answered
How do I identify points within a user defined shape?
Look at polyshape and isinterior

3 years ago | 0

Answered
Complex number division of matrix over a vector
Obvisously the size of v must be consistent with the size of m. Attach your variables for additional help. m=[randi(10,10)+1i*r...

3 years ago | 0

Solved


Power Outages Histogram
Create a function that takes power outage data as an input and creates a histogram of the number of outages as a function of Reg...

3 years ago

Answered
How to sum a single column of a cell whose content are vectors
Simple loop. data = cell(20,2); for i=1:20 data{i,1} = i; data{i,2} = rand(1,13); end s=0; for k=1:size(data,1)...

3 years ago | 1

Answered
how to solve logarithm equation
if you plot, it never crosses zero. f=@(x)log10(4*x)-log10(3*x) -log10(5*x) +log10(2*x) fzero(f,1)

3 years ago | 0

Answered
extracting the second column of all cells of a struct
for k=1:length(x1_surf) x2_surf{k}=x1_surf{k}{2}; end

3 years ago | 0

| accepted

Answered
Read data from .txt file
Below works. If your version of matlab does not have readmatrix you could just copy the m.mat file attached. m=readmatrix('myda...

3 years ago | 0

| accepted

Answered
need to solve for a variable numerically
m=readmatrix('HW_3_problem_2_data.xlsx'); index3=305:696; pr=m(index3,2)./m(index3,3); gamma=1.4; syms M1 M2=((((M1).^(2))+...

3 years ago | 0

Answered
Selecting the same amount of data for all categories based on different labels
cvs_data =readmatrix('spruce tree timber quality.csv'); quality=cvs_data(:,12); bad_data=cvs_data(quality<=4,1:11); good_data...

3 years ago | 1

| accepted

Answered
rref using complex numbers
node1 = [complex(.25,-.2) complex(0,.2) complex(12.46,-.9)]; node2 = [complex(0,.2) complex(.1,-.2) 0]; a = [node1; node2]; r...

3 years ago | 0

| accepted

Load more