Programacion C++
Enviado por ninan • 15 de Septiembre de 2013 • 1.552 Palabras (7 Páginas) • 324 Visitas
Problema3
clear all;
close all;
fprintf('\n\n\n');
x=input('ingrese el valor de x:');
fprintf('\n');
n=input('ingrese el valor de n:');
if(n==floor(n))&&(n>=0)
sum=0;
num=1;
den=1;
sg=1;
for k=1:n
num=num.*x;
den=den.*k.*2;
sum=sum+sg*(num./den);
sg=sg*(-1);
end
fprintf('\n RPTA:');
fprintf('\n\n suma aproximada es :% 5.6f\n\n',sum);
else
fprintf('n debe ser entero y positivo:');
end
clear all;
close all;
for x=-5:0.1:5;
for y=10:-0.2:-10;
Z(x,y)=x.^3 + y.^3 - x.*y - 7*x + 5*y - 9;
end
disp(maximo valor de Z en e intervalo dado)
end
>> N=[ 12 15 06 10 09 08 08]
N =
12 15 6 10 9 8 8
>> Pa=mean(N<
??? Pa=mean(N<
|
Error: Expression or statement is incorrect--possibly unbalanced (, {, or [.
>> Pa=mean(N(N>10))
Pa =
13.5000
>> PTs=mean(N(N>10)/3)
PTs =
4.5000
>> A=[1 2 3 4 5 6 7 8 9]
A =
1 2 3 4 5 6 7 8 9
>> N=[ 12 13 10 09 08 06 11 15 16]
N =
12 13 10 9 8 6 11 15 16
>> PTs=mean(N/3)
PTs =
3.7037
>> PTs=mean(N(N/3))
??? Subscript indices must either be real positive integers or logicals.
>> P=mean(N/3)
P =
3.7037
>> N=[ 12 15 06 10 09 08]
N =
12 15 6 10 9 8
>> P=mean(max(N)./(N/3))
P =
4.8958
>> P=mean(max(N)/(N/3))
??? Error using ==> mldivide
Matrix dimensions must agree.
>> mean((max(N(N>10)))/3)
ans =
5
>> PTs=mean((N(N>10))/3)
PTs =
4.5000
>> PTs=mean( (N(N>10))/(N/3))
??? Error using ==> mldivide
Matrix dimensions must agree.
>> PTs=mean((N(N>10))./(N/3))
??? Error using ==> rdivide
Matrix dimensions must agree.
>> N=[ 12 15 06 10 09 08]
N =
12 15 6 10 9 8
>> S=sort(N)
S =
6 8 9 10 12 15
>> L=lenght(N)
??? Undefined function or method 'lenght' for input arguments of type 'double'.
>> L=lenght(N)
??? Undefined function or method 'lenght' for input arguments of type 'double'.
>> L=lenght(N)
??? Undefined function or method 'lenght' for input arguments of type 'double'.
>> L=length(N)
L =
6
>> PTs=mean(N/(L-(L/3)+1:L))
??? Error using ==> mldivide
Matrix dimensions must agree.
>> PTs=mean(N/(L-(L/3)+1:L))
??? Error using ==> mldivide
Matrix dimensions must agree.
>> N=[ 12 13 10 09 08 06 11 15 16]
N =
12 13 10 9 8 6 11 15 16
>> S=sort(N)
S =
6 8 9 10 11 12 13 15 16
>> L=length(N)
L =
9
>> PTs=mean(N/(L-(L/3)+1:L))
??? Error using ==> mldivide
Matrix dimensions must agree.
>> PTs=mean(N/(L-(L/3):L))
??? Error using ==> mldivide
Matrix dimensions must agree.
>> PTs=mean(N./(L-(L/3)+1:L))
??? Error using ==> rdivide
Matrix dimensions must agree.
>> PTs=mean(N./(L-(L/3)-1:L))
??? Error using ==> rdivide
Matrix dimensions must agree.
>> PTs=mean(N(L-(L/3)+1:L))
PTs =
14
>> PTs=mean(N./(L-(L/3))+1:L)
PTs =
6
>> PTs=mean(N/(L-(L/3)+1:L))
??? Error using ==> mldivide
Matrix dimensions must agree.
>> PTs=mean(N((L/3)+1:L))
PTs =
10.8333
>> PTs=mean(N/(L-(L/3)+1:L))
???
...